From 7c65581dd3cd34554ff030dee53e6a00856916a5 Mon Sep 17 00:00:00 2001 From: kgv Date: Sun, 28 Feb 2016 02:07:27 +0300 Subject: [PATCH] 0027197: Configuration - fix compilation issues when using mingw AIS_ColorScale, AIS_Dimension - the protected method DrawText() has been renamed to drawText() to avoid name collisions with macros. _MSC_VER/_WIN32 misuse has been fixed in several places. Header is now included where alloca() is used. Draw_Window - dllimport flag has been dropped from inline methods. TKernel - mandatory dependencies Winspool.lib and Psapi.lib are now linked explicitly (instead of msvc-specific pragma syntax). CMake scripts - the option -std=c++0x has been replaced by -std=gnu++0x for mingw to allow extensions (like _wfopen() and others). The minimum Windows version has been set to _WIN32_WINNT=0x0501. Invalid options "-z defs" and "-lm" have been dropped for mingw. Flag --export-all-symbols has been added to CMAKE_SHARED_LINKER_FLAGS to workaround missing vtable symbols when using mingw. FreeType is now linked explicitly on Windows. Draw::Load() - "lib" suffix is now prepended on mingw as well. Drop redundant declaration of _TINT from OSD_WNT_1.hxx. NCollection_UtfString::FromLocale() - platform-specific code has been moved to .cxx file. Draw_BasicCommands - fixed incorrect mingw64 version macros. genproj, cbp - added workaround for process argument list limits on Windows. TKSTEP linkage is failing on this platform due to too long list of files. The list of object files to link is now stored in dedicated file which is passed to gcc. Option "-z defs" removed from CMake linker options to avoid problems when building with different configurations of VTK on Linux Some MinGW-specific compiler warnings (potentially uninitialized vars, use of NULL, parentheses in conditional expressions) are fixed (speculatively) --- adm/cmake/occt_csf.cmake | 14 + adm/cmake/occt_defs_flags.cmake | 15 +- adm/genproj.tcl | 490 ++++++++++-------- adm/templates/codeblocks.bat | 19 + adm/templates/env.bat | 8 +- src/AIS/AIS_AngleDimension.cxx | 4 +- src/AIS/AIS_ColorScale.cxx | 18 +- src/AIS/AIS_ColorScale.hxx | 4 +- src/AIS/AIS_Dimension.cxx | 10 +- src/AIS/AIS_Dimension.hxx | 2 +- src/BRepAlgo/BRepAlgo_DSAccess.cxx | 3 + src/BSplCLib/BSplCLib.cxx | 2 +- src/CDF/CDF_FWOSDriver.cxx | 2 +- src/Dico/Dico_Dictionary.gxx | 2 +- src/Draw/CommandWindow.cxx | 2 +- src/Draw/Draw.cxx | 2 +- src/Draw/DrawRessource.h | 2 +- src/Draw/Draw_BasicCommands.cxx | 2 +- src/Draw/Draw_Interpretor.cxx | 7 +- src/Draw/Draw_Main.cxx | 7 - src/Draw/Draw_Window.cxx | 6 +- src/Draw/Draw_Window.hxx | 12 +- src/DrawTrSurf/DrawTrSurf.cxx | 16 +- src/DrawTrSurf/DrawTrSurf_Point.cxx | 4 +- src/FSD/FSD_File.cxx | 2 +- src/HLRBRep/HLRBRep_PolyAlgo.cxx | 1 + src/IntAna/IntAna_Curve.cxx | 1 + src/MeshVS/MeshVS_MeshPrsBuilder.cxx | 4 + src/Message/Message_PrinterOStream.cxx | 2 +- src/MoniTool/MoniTool_TypedValue.cxx | 3 +- src/NCollection/FILES | 1 + src/NCollection/NCollection_UtfString.cxx | 89 ++++ src/NCollection/NCollection_UtfString.lxx | 60 +-- .../NCollection_WinHeapAllocator.cxx | 2 +- src/OSD/OSD_DirectoryIterator.cxx | 4 +- src/OSD/OSD_File.cxx | 65 +-- src/OSD/OSD_File.hxx | 2 +- src/OSD/OSD_FileIterator.cxx | 4 +- src/OSD/OSD_Host.cxx | 4 +- src/OSD/OSD_MemInfo.cxx | 9 +- src/OSD/OSD_OpenFile.cxx | 20 +- src/OSD/OSD_Path.cxx | 2 +- src/OSD/OSD_Process.cxx | 5 +- src/OSD/OSD_WNT_1.hxx | 4 - src/OSD/OSD_signal_WNT.cxx | 6 + src/OpenGl/OpenGl_Context.cxx | 2 +- src/OpenGl/OpenGl_ShaderObject.cxx | 3 + src/OpenGl/OpenGl_ShaderProgram.cxx | 4 + src/PCDM/PCDM_ReferenceIterator.cxx | 14 +- src/QABugs/QABugs_11.cxx | 4 +- src/Standard/Standard.cxx | 2 +- src/Standard/Standard_Assert.hxx | 2 +- src/Standard/Standard_CLocaleSentry.cxx | 4 +- src/Standard/Standard_CLocaleSentry.hxx | 2 +- src/Standard/Standard_CString.cxx | 4 +- src/Standard/Standard_values.h | 2 +- src/TCollection/TCollection_AsciiString.cxx | 5 +- .../TCollection_ExtendedString.cxx | 2 + src/TKD3DHost/EXTERNLIB | 1 + src/TKernel/EXTERNLIB | 5 +- src/TopOpeBRepBuild/TopOpeBRepBuild_GIter.cxx | 6 +- src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx | 3 +- src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx | 4 +- src/V3d/V3d_View_Print.cxx | 4 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 2 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 4 +- src/WNT/WNT_WClass.cxx | 2 +- src/WNT/WNT_Window.cxx | 8 +- .../XmlLDrivers_DocumentRetrievalDriver.cxx | 14 +- 69 files changed, 624 insertions(+), 422 deletions(-) create mode 100644 adm/templates/codeblocks.bat create mode 100644 src/NCollection/NCollection_UtfString.cxx diff --git a/adm/cmake/occt_csf.cmake b/adm/cmake/occt_csf.cmake index 6a6d263c6b..08b2cf19ce 100644 --- a/adm/cmake/occt_csf.cmake +++ b/adm/cmake/occt_csf.cmake @@ -33,9 +33,23 @@ if (WIN32) set (CSF_gdi32 "gdi32.lib") set (CSF_user32 "user32.lib") set (CSF_wsock32 "wsock32.lib") + set (CSF_winspool "Winspool.lib") + set (CSF_psapi "Psapi.lib") set (CSF_AviLibs "ws2_32.lib vfw32.lib") set (CSF_OpenGlLibs "opengl32.lib glu32.lib") + if (USE_FREETYPE) + set (CSF_FREETYPE "freetype.lib") + else() + set (CSF_FREETYPE) + endif() + + if (USE_FREEIMAGE) + set (CSF_FreeImagePlus "freeimage.lib freeimageplus.lib") + else() + set (CSF_FreeImagePlus) + endif() + if (USE_TCL) set (CSF_TclLibs "tcl${3RDPARTY_TCL_LIBRARY_VERSION}.lib") set (CSF_TclTkLibs "tk${3RDPARTY_TK_LIBRARY_VERSION}.lib") diff --git a/adm/cmake/occt_defs_flags.cmake b/adm/cmake/occt_defs_flags.cmake index acadf4a557..187a41d08e 100644 --- a/adm/cmake/occt_defs_flags.cmake +++ b/adm/cmake/occt_defs_flags.cmake @@ -101,17 +101,22 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMP if (BUILD_SHARED_LIBS) if (APPLE) set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}") - else() - set (CMAKE_SHARED_LINKER_FLAGS "-lm -z defs ${CMAKE_SHARED_LINKER_FLAGS}") + elseif(NOT WIN32) + set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}") endif() else() - if (NOT ANDROID) + if (NOT ANDROID AND NOT MINGW) set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}") endif() endif() endif() -if (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang") +if(MINGW) + set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}") + add_definitions(-D_WIN32_WINNT=0x0501) + # workaround bugs in mingw with vtable export + set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols") +elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang") set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}") endif() @@ -122,4 +127,4 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR MINGW) endif() set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception") -set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception") \ No newline at end of file +set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception") diff --git a/adm/genproj.tcl b/adm/genproj.tcl index 3f232122fe..aabb02321c 100644 --- a/adm/genproj.tcl +++ b/adm/genproj.tcl @@ -128,6 +128,7 @@ proc genproj { args } { # Setting default IDE. set anTarget "" + set aCmpl "gcc" switch -exact -- "$targetStation" { "wnt" {set anTarget "$::env(VCVER)"} "lin" {set anTarget "cbp"} @@ -215,7 +216,7 @@ proc genproj { args } { set anAdmPath "$path/adm" - OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" + OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" "$aCmpl" genprojbat "$anTarget" } @@ -260,7 +261,10 @@ proc genprojbat {theIDE} { file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat" } else { switch -exact -- "$theIDE" { - "cbp" { file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" } + "cbp" { + file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" + file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat" + } "xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" } } } @@ -279,7 +283,12 @@ set aTKNullKey "TKNull" set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}" # Entry function to generate project files and solutions for IDE -proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform ""} } { +# @param theOutDir Root directory for project files +# @param theIDE IDE code name (vc10 for Visual Studio 2010, cbp for Code::Blocks, xcd for XCode) +# @param theLibType Library type - dynamic or static +# @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS +# @param theCmpl Compiler option (msvc or gcc) +proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } { global path targetStation set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" } @@ -352,7 +361,7 @@ proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform " "vc11" - "vc12" - "vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE } - "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution } + "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $theCmpl } "xcd" { set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000" OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform @@ -1076,6 +1085,8 @@ proc osutils:tk:csfInExternlib { EXTERNLIB } { return $lret } +# Collect dependencies map depending on target OS (libraries for CSF_ codenames used in EXTERNLIB) . +# @param theOS - target OS # @param theCsfLibsMap - libraries map # @param theCsfFrmsMap - frameworks map, OS X specific proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } { @@ -1085,60 +1096,75 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } { unset theCsfLibsMap unset theCsfFrmsMap + set aLibsMap(CSF_FREETYPE) "freetype" + set aLibsMap(CSF_TclLibs) "tcl8.6" + set aLibsMap(CSF_TclTkLibs) "tk8.6" + if { "$::HAVE_FREEIMAGE" == "true" } { + if { "$theOS" == "wnt" } { + set aLibsMap(CSF_FreeImagePlus) "FreeImage FreeImagePlus" + } else { + set aLibsMap(CSF_FreeImagePlus) "freeimage" + } + } + if { "$::HAVE_GL2PS" == "true" } { + set aLibsMap(CSF_GL2PS) "gl2ps" + } + if { "$::HAVE_TBB" == "true" } { + set aLibsMap(CSF_TBB) "tbb tbbmalloc" + } + if { "$::HAVE_VTK" == "true" } { + if { "$theOS" == "wnt" } { + set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"] + } else { + set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"] + } + } + if { "$theOS" == "wnt" } { # WinAPI libraries - set aLibsMap(CSF_kernel32) "kernel32.lib" - set aLibsMap(CSF_advapi32) "advapi32.lib" - set aLibsMap(CSF_gdi32) "gdi32.lib" - set aLibsMap(CSF_user32) "user32.lib" - set aLibsMap(CSF_opengl32) "opengl32.lib" - set aLibsMap(CSF_wsock32) "wsock32.lib" - set aLibsMap(CSF_netapi32) "netapi32.lib" - set aLibsMap(CSF_AviLibs) "ws2_32.lib vfw32.lib" - set aLibsMap(CSF_OpenGlLibs) "opengl32.lib" + set aLibsMap(CSF_kernel32) "kernel32" + set aLibsMap(CSF_advapi32) "advapi32" + set aLibsMap(CSF_gdi32) "gdi32" + set aLibsMap(CSF_user32) "user32 comdlg32" + set aLibsMap(CSF_opengl32) "opengl32" + set aLibsMap(CSF_wsock32) "wsock32" + set aLibsMap(CSF_netapi32) "netapi32" + set aLibsMap(CSF_AviLibs) "ws2_32 vfw32" + set aLibsMap(CSF_OpenGlLibs) "opengl32" + set aLibsMap(CSF_winspool) "Winspool" + set aLibsMap(CSF_psapi) "Psapi" + set aLibsMap(CSF_d3d9) "d3d9" - set aLibsMap(CSF_QT) "QtCore4.lib QtGui4.lib" + # the naming is different on Windows + set aLibsMap(CSF_TclLibs) "tcl86" + set aLibsMap(CSF_TclTkLibs) "tk86" - # VTK - set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"] + set aLibsMap(CSF_QT) "QtCore4 QtGui4" + + # tbb headers define different pragma lib depending on debug/release + set aLibsMap(CSF_TBB) "" } else { - set aLibsMap(CSF_FREETYPE) "freetype" if { "$theOS" == "mac" } { set aLibsMap(CSF_objc) "objc" set aFrmsMap(CSF_Appkit) "Appkit" set aFrmsMap(CSF_IOKit) "IOKit" set aFrmsMap(CSF_OpenGlLibs) "OpenGL" set aFrmsMap(CSF_TclLibs) "Tcl" + set aLibsMap(CSF_TclLibs) "" set aFrmsMap(CSF_TclTkLibs) "Tk" + set aLibsMap(CSF_TclTkLibs) "" } else { if { "$theOS" == "qnx" } { - # CSF_ThreadLibs - pthread API is part og libc on QNX + # CSF_ThreadLibs - pthread API is part of libc on QNX set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2" - set aLibsMap(CSF_TclLibs) "tcl8.6" - set aLibsMap(CSF_TclTkLibs) "tk8.6" } else { set aLibsMap(CSF_ThreadLibs) "pthread rt" set aLibsMap(CSF_OpenGlLibs) "GL" - set aLibsMap(CSF_TclLibs) "tcl8.6" set aLibsMap(CSF_TclTkLibs) "X11 tk8.6" set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi" set aLibsMap(CSF_MotifLibs) "X11" } } - - # optional 3rd-parties - if { "$::HAVE_TBB" == "true" } { - set aLibsMap(CSF_TBB) "tbb tbbmalloc" - } - if { "$::HAVE_FREEIMAGE" == "true" } { - set aLibsMap(CSF_FreeImagePlus) "freeimage" - } - if { "$::HAVE_GL2PS" == "true" } { - set aLibsMap(CSF_GL2PS) "gl2ps" - } - if { "$::HAVE_VTK" == "true" } { - set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"] - } } } @@ -1146,12 +1172,9 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } { proc osutils:vtkCsf {{theOS ""}} { set aVtkVer "6.1" - set aLibSuffix "" set aPathSplitter ":" - if {"$theOS" == "wnt"} { set aPathSplitter ";" - set aLibSuffix ".lib" } set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"] @@ -1167,7 +1190,7 @@ proc osutils:vtkCsf {{theOS ""}} { # Additional suffices for the libraries set anIdx 0 foreach anItem $aLibArray { - lset aLibArray $anIdx $anItem-$aVtkVer$aLibSuffix + lset aLibArray $anIdx $anItem-$aVtkVer incr anIdx } @@ -1449,24 +1472,26 @@ proc osutils:vcproj { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl - set aCommonUsedTK [list] + set aUsedLibs [list] foreach tkx [osutils:commonUsedTK $theToolKit] { - lappend aCommonUsedTK "${tkx}.lib" + lappend aUsedLibs "${tkx}.lib" } osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks - set aUsedToolKits [concat $aCommonUsedTK $aLibs] + foreach aLibIter $aLibs { + lappend aUsedLibs "${aLibIter}.lib" + } # correct names of referred third-party libraries that are named with suffix # depending on VC version - regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits + regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs # and put this list to project file - #puts "$theToolKit requires $aUsedToolKits" + #puts "$theToolKit requires $aUsedLibs" if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } { - set aUsedToolKits [join $aUsedToolKits {;}] + set aUsedLibs [join $aUsedLibs {;}] } - regsub -all -- {__TKDEP__} $theProjTmpl $aUsedToolKits theProjTmpl + regsub -all -- {__TKDEP__} $theProjTmpl $aUsedLibs theProjTmpl set anIncPaths "..\\..\\..\\inc" set aTKDefines "" @@ -1666,23 +1691,25 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl - set aCommonUsedTK [list] + set aUsedLibs [list] foreach tkx [osutils:commonUsedTK $theToolKit] { - lappend aCommonUsedTK "${tkx}.lib" + lappend aUsedLibs "${tkx}.lib" } osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks - set aUsedToolKits [concat $aCommonUsedTK $aLibs] + foreach aLibIter $aLibs { + lappend aUsedLibs "${aLibIter}.lib" + } # correct names of referred third-party libraries that are named with suffix # depending on VC version - regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits + regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs -# puts "$aProjName requires $aUsedToolKits" +# puts "$aProjName requires $aUsedLibs" if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } { - set aUsedToolKits [join $aUsedToolKits {;}] + set aUsedLibs [join $aUsedLibs {;}] } - regsub -all -- {__TKDEP__} $aProjTmpl $aUsedToolKits aProjTmpl + regsub -all -- {__TKDEP__} $aProjTmpl $aUsedLibs aProjTmpl set aFilesSection "" set aVcFilesX(units) "" @@ -1848,13 +1875,13 @@ proc osutils:justunix { listloc } { ####### CODEBLOCK ################################################################### # Function to generate Code Blocks workspace and project files -proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } { +proc OS:MKCBP { theOutDir theModules theAllSolution theCmpl } { puts stderr "Generating project files for Code Blocks" # Generate projects for toolkits and separate workspace for each module foreach aModule $theModules { - OS:cworkspace $aModule $aModule $theOutDir - OS:cbp $aModule $theOutDir + OS:cworkspace $aModule $aModule $theOutDir + OS:cbp $theCmpl $aModule $theOutDir } # Generate single workspace "OCCT" containing projects from all modules @@ -1866,30 +1893,69 @@ proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } { } # Generate Code Blocks projects -proc OS:cbp { theModules theOutDir } { +proc OS:cbp { theCmpl theModules theOutDir } { set aProjectFiles {} foreach aModule $theModules { foreach aToolKit [${aModule}:toolkits] { - lappend aProjectFiles [osutils:cbptk $theOutDir $aToolKit ] + lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit ] } foreach anExecutable [OS:executable ${aModule}] { - lappend aProjectFiles [osutils:cbpx $theOutDir $anExecutable] + lappend aProjectFiles [osutils:cbpx $theCmpl $theOutDir $anExecutable] } } return $aProjectFiles } # Generate Code::Blocks project file for ToolKit -proc osutils:cbptk { theOutDir theToolKit } { - set aUsedToolKits [list] +proc osutils:cbptk { theCmpl theOutDir theToolKit } { + set aUsedLibs [list] set aFrameworks [list] set anIncPaths [list] set aTKDefines [list] set aTKSrcFiles [list] - osutils:tkinfo "../../.." $theToolKit aUsedToolKits aFrameworks anIncPaths aTKDefines aTKSrcFiles + global path targetStation + set aWokStation "$targetStation" - return [osutils:cbp $theOutDir $theToolKit $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines] + # collect list of referred libraries to link with + osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks + set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] + foreach tkx $aDepToolkits { + lappend aUsedLibs "${tkx}" + } + + lappend anIncPaths "../../../inc" + set listloc [osutils:tk:units $theToolKit] + + if { [llength $listloc] == 0 } { + set listloc $theToolKit + } + + if { "$aWokStation" == "wnt" } { + set resultloc [osutils:justwnt $listloc] + } else { + set resultloc [osutils:justunix $listloc] + } + if [array exists written] { unset written } + foreach fxlo $resultloc { + set xlo $fxlo + set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0] + foreach aSrcFile [lsort $aSrcFiles] { + if { ![info exists written([file tail $aSrcFile])] } { + set written([file tail $aSrcFile]) 1 + lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]" + } else { + puts "Warning : more than one occurences for [file tail $aSrcFile]" + } + } + + # macros for correct DLL exports + if { "$aWokStation" == "wnt" } { + lappend aTKDefines "__${xlo}_DLL" + } + } + + return [osutils:cbp $theCmpl $theOutDir $theToolKit $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines] } # Generates Code Blocks workspace. @@ -1962,7 +2028,7 @@ proc OS:cworkspace { theSolName theModules theOutDir } { } # Generate Code::Blocks project file for Executable -proc osutils:cbpx { theOutDir theToolKit } { +proc osutils:cbpx { theCmpl theOutDir theToolKit } { global path targetStation set aWokStation "$targetStation" set aWokArch "$::env(ARCH)" @@ -1970,21 +2036,22 @@ proc osutils:cbpx { theOutDir theToolKit } { set aCbpFiles {} foreach aSrcFile [osutils:tk:files $theToolKit osutils:compilable 0] { # collect list of referred libraries to link with - set aUsedToolKits [list] + set aUsedLibs [list] set aFrameworks [list] set anIncPaths [list] set aTKDefines [list] set aTKSrcFiles [list] set aProjName [file rootname [file tail $aSrcFile]] - osutils:usedOsLibs $theToolKit "$aWokStation" aUsedToolKits aFrameworks + osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks + set aDepToolkits [LibToLinkX $theToolKit $aProjName] foreach tkx $aDepToolkits { if {[_get_type $tkx] == "t"} { - lappend aUsedToolKits "${tkx}" + lappend aUsedLibs "${tkx}" } if {[lsearch [glob -tails -directory "$path/src" -types d *] $tkx] == "-1"} { - lappend aUsedToolKits "${tkx}" + lappend aUsedLibs "${tkx}" } } @@ -1997,7 +2064,7 @@ proc osutils:cbpx { theOutDir theToolKit } { if { ![info exists written([file tail $aSrcFile])] } { set written([file tail $aSrcFile]) 1 - lappend aTKSrcFiles $aSrcFile + lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]" } else { puts "Warning : in cbp there are more than one occurences for [file tail $aSrcFile]" } @@ -2010,25 +2077,14 @@ proc osutils:cbpx { theOutDir theToolKit } { # common include paths lappend anIncPaths "../../../inc" - # extra macros - if { "$aWokStation" == "wnt" } { - lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE" - } else { - lappend aTKDefines "OCC_CONVERT_SIGNALS" - #lappend aTKDefines "_GNU_SOURCE=1" - } - - lappend aCbpFiles [osutils:cbp $theOutDir $aProjName $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines $isExecutable] + lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable] } return $aCbpFiles } -proc osutils:optinal_libs { } { - return [list tbb.lib tbbmalloc.lib FreeImage.lib FreeImagePlus.lib gl2ps.lib] -} - # This function intended to generate Code::Blocks project file +# @param theCmpl - the compiler (gcc or msvc) # @param theOutDir - output directory to place project file # @param theProjName - project name # @param theSrcFiles - list of source files @@ -2037,12 +2093,60 @@ proc osutils:optinal_libs { } { # @param theIncPaths - header search paths # @param theDefines - compiler macro definitions # @param theIsExe - flag to indicate executable / library target -proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } { +proc osutils:cbp { theCmpl theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } { global targetStation set aWokStation "$targetStation" set aWokArch "$::env(ARCH)" - set aCbpFilePath "${theOutDir}/${theProjName}.cbp" + set aCmplCbp "gcc" + set aCmplFlags [list] + set aCmplFlagsRelease [list] + set aCmplFlagsDebug [list] + set toPassArgsByFile 0 + set aLibPrefix "lib" + if { "$aWokStation" == "wnt" || "$aWokStation" == "qnx" } { + set toPassArgsByFile 1 + } + if { "$theCmpl" == "msvc" } { + set aCmplCbp "msvc8" + set aLibPrefix "" + } + + if { "$theCmpl" == "msvc" } { + set aCmplFlags "-arch:SSE2 -EHsc -W4 -MP" + set aCmplFlagsRelease "-MD -O2" + set aCmplFlagsDebug "-MDd -Od -Zi" + lappend aCmplFlags "-D_CRT_SECURE_NO_WARNINGS" + lappend aCmplFlags "-D_CRT_NONSTDC_NO_DEPRECATE" + } elseif { "$theCmpl" == "gcc" } { + if { "$aWokStation" != "qnx" } { + set aCmplFlags "-mmmx -msse -msse2 -mfpmath=sse" + } + set aCmplFlagsRelease "-O2" + set aCmplFlagsDebug "-O0 -g" + if { "$aWokStation" == "wnt" } { + lappend aCmplFlags "-std=gnu++0x" + lappend aCmplFlags "-D_WIN32_WINNT=0x0501" + } else { + lappend aCmplFlags "-std=c++0x" + lappend aCmplFlags "-fPIC" + lappend aCmplFlags "-DOCC_CONVERT_SIGNALS" + } + lappend aCmplFlags "-Wall" + lappend aCmplFlags "-fexceptions" + } + lappend aCmplFlagsRelease "-DNDEBUG" + lappend aCmplFlagsRelease "-DNo_Exception" + lappend aCmplFlagsDebug "-D_DEBUG" + if { "$aWokStation" == "qnx" } { + lappend aCmplFlags "-D_QNX_SOURCE" + } + + set aCbpFilePath "${theOutDir}/${theProjName}.cbp" + set aLnkFileName "${theProjName}_obj.link" + set aLnkDebFileName "${theProjName}_objd.link" + set aLnkFilePath "${theOutDir}/${aLnkFileName}" + set aLnkDebFilePath "${theOutDir}/${aLnkDebFileName}" set aFile [open $aCbpFilePath "w"] puts $aFile "" puts $aFile "" @@ -2050,11 +2154,7 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t puts $aFile "\t" puts $aFile "\t\t" puts $aFile "" close $aFile @@ -2232,74 +2334,6 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t return $aCbpFilePath } -# Auxiliary function to achieve complete information to build Toolkit -# @param theRelativePath - relative path to CASROOT -# @param theToolKit - Toolkit name -# @param theUsedLib - dependencies (libraries list) -# @param theFrameworks - dependencies (frameworks list, Mac OS X specific) -# @param theIncPaths - header search paths -# @param theTKDefines - compiler macro definitions -# @param theTKSrcFiles - list of source files -proc osutils:tkinfo { theRelativePath theToolKit theUsedLib theFrameworks theIncPaths theTKDefines theTKSrcFiles } { - global path targetStation - set aWokStation "$targetStation" - - # collect list of referred libraries to link with - upvar $theUsedLib aUsedLibs - upvar $theFrameworks aFrameworks - upvar $theIncPaths anIncPaths - upvar $theTKDefines aTKDefines - upvar $theTKSrcFiles aTKSrcFiles - - osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks - set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] - foreach tkx $aDepToolkits { - lappend aUsedLibs "${tkx}" - } - - lappend anIncPaths "$theRelativePath/inc" - set listloc [osutils:tk:units $theToolKit] - - if { [llength $listloc] == 0 } { - set listloc $theToolKit - } - - if { "$aWokStation" == "wnt" } { - set resultloc [osutils:justwnt $listloc] - } else { - set resultloc [osutils:justunix $listloc] - } - if [array exists written] { unset written } - foreach fxlo $resultloc { - set xlo $fxlo - set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0] - foreach aSrcFile [lsort $aSrcFiles] { - if { ![info exists written([file tail $aSrcFile])] } { - set written([file tail $aSrcFile]) 1 - lappend aTKSrcFiles "${theRelativePath}/[wokUtils:FILES:wtail $aSrcFile 3]" - } else { - puts "Warning : more than one occurences for [file tail $aSrcFile]" - } - } - - # macros for correct DLL exports - if { "$aWokStation" == "wnt" } { - lappend aTKDefines "__${xlo}_DLL" - } - - # common include paths -# lappend anIncPaths "${theRelativePath}/src/${xlo}" - } - - # extra macros - if { "$aWokStation" == "wnt" } { - lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE" - } else { - lappend aTKDefines "OCC_CONVERT_SIGNALS" - #lappend aTKDefines "_GNU_SOURCE=1" - } -} - # Define libraries to link using only EXTERNLIB file proc LibToLinkX {thePackage theDummyName} { set aToolKits [LibToLink $thePackage] @@ -2431,7 +2465,7 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection upvar $theDepsRefGuids aDepsRefGuids set aBuildFileSection "" - set aUsedToolKits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] + set aUsedLibs [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit] if { "$theTargetType" == "executable" } { @@ -2449,9 +2483,9 @@ proc osutils:xcdtk:deps {theToolKit theTargetType theGuidsMap theFileRefSection } osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks - set aUsedToolKits [concat $aUsedToolKits $aLibs] - set aUsedToolKits [concat $aUsedToolKits $aFrameworks] - foreach tkx $aUsedToolKits { + set aUsedLibs [concat $aUsedLibs $aLibs] + set aUsedLibs [concat $aUsedLibs $aFrameworks] + foreach tkx $aUsedLibs { set aDepLib "${tkx}_Dep" set aDepLibRef "${tkx}_DepRef" diff --git a/adm/templates/codeblocks.bat b/adm/templates/codeblocks.bat new file mode 100644 index 0000000000..f70d479742 --- /dev/null +++ b/adm/templates/codeblocks.bat @@ -0,0 +1,19 @@ +@echo off + +rem Setup environment +call "%~dp0env.bat" %1 %2 %3 + +rem Define path to project file +set "PRJFILE=%~dp0\adm\wnt\cbp\OCCT.workspace" +if not exist "%PRJFILE%" set "PRJFILE=%~dp0\adm\wnt\cbp\Products.workspace" +if not "%4" == "" ( + set "PRJFILE=%4" +) + +if "%CB_PATH%"=="" if exist "%PROGRAMFILES%\CodeBlocks" set "CB_PATH=%PROGRAMFILES%\CodeBlocks\codeblocks.exe" +if "%CB_PATH%"=="" set "CB_PATH=codeblocks.exe" + +set "CASBIN=wnt\cbp" +set "PATH=%~dp0%CASBIN%\bin%CASDEB%;%PATH%" + +start "" "%CB_PATH%" "%PRJFILE%" diff --git a/adm/templates/env.bat b/adm/templates/env.bat index 38dd5aee92..db1c722f43 100644 --- a/adm/templates/env.bat +++ b/adm/templates/env.bat @@ -160,9 +160,13 @@ set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1" goto :eof :concatLib32 -set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1" +rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc +rem set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1" +set "OPT_LIB32=%OPT_LIB32% -L%1" goto :eof :concatLib64 -set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1" +rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc +rem set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1" +set "OPT_LIB64=%OPT_LIB64% -L%1" goto :eof diff --git a/src/AIS/AIS_AngleDimension.cxx b/src/AIS/AIS_AngleDimension.cxx index d2d30fa324..c7a2be3e06 100644 --- a/src/AIS/AIS_AngleDimension.cxx +++ b/src/AIS/AIS_AngleDimension.cxx @@ -451,7 +451,7 @@ void AIS_AngleDimension::DrawArcWithText (const Handle(Prs3d_Presentation)& theP gp_Dir aTextDir = gce_MakeDir (theFirstAttach, theSecondAttach); // Drawing text - DrawText (thePresentation, + drawText (thePresentation, aTextPos, aTextDir, theText, @@ -696,7 +696,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /* : GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint); gp_Dir aTextDir = aDimensionDir; - DrawText (thePresentation, + drawText (thePresentation, aTextPos, aTextDir, aLabelString, diff --git a/src/AIS/AIS_ColorScale.cxx b/src/AIS/AIS_ColorScale.cxx index 65042bb4ec..4648f0a574 100644 --- a/src/AIS/AIS_ColorScale.cxx +++ b/src/AIS/AIS_ColorScale.cxx @@ -556,7 +556,7 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr if (aTitle.Length()) { aTitleHeight += myTextHeight + aSpacer; - DrawText (thePresentation, aTitle, (Standard_Integer)myXPos + aSpacer, myHeight - ((Standard_Integer)myYPos - 2 * aSpacer + aTitleHeight), aFgColor); + drawText (thePresentation, aTitle, (Standard_Integer)myXPos + aSpacer, myHeight - ((Standard_Integer)myYPos - 2 * aSpacer + aTitleHeight), aFgColor); } Standard_Boolean toReverse = IsReversed(); @@ -637,7 +637,7 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr aGroup->AddPrimitiveArray (aPrim); if (aStep > 0) - DrawFrame (thePresentation, aX - 1, (Standard_Integer)(myYPos + anOffset - 1), aColorBreadth + 2, (Standard_Integer)(aColors.Length() * aStep + 2), aFgColor); + drawFrame (thePresentation, aX - 1, (Standard_Integer)(myYPos + anOffset - 1), aColorBreadth + 2, (Standard_Integer)(aColors.Length() * aStep + 2), aFgColor); // Draw Labels anOffset = 1.0 * Abs (aLabCount - aNum - 1) * ( aStep - aTextHeight ) / 2 + 1.0 * Abs (aLabCount - aNum - 1) * aTextHeight / 2; @@ -666,12 +666,12 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr Standard_Integer aPos2 = aLabCount - 1 - i2; if (aFilter && !( aPos1 % aFilter )) { - DrawText (thePresentation, aLabels.Value (i1 + 1), aX, (Standard_Integer)( myYPos + i1 * aStep + anAscent + anOffset ), aFgColor); + drawText (thePresentation, aLabels.Value (i1 + 1), aX, (Standard_Integer)( myYPos + i1 * aStep + anAscent + anOffset ), aFgColor); aLast1 = i1; } if (aFilter && !( aPos2 % aFilter )) { - DrawText (thePresentation, aLabels.Value (i2 + 1), aX, (Standard_Integer)( myYPos + i2 * aStep + anAscent + anOffset ), aFgColor); + drawText (thePresentation, aLabels.Value (i2 + 1), aX, (Standard_Integer)( myYPos + i2 * aStep + anAscent + anOffset ), aFgColor); aLast2 = i2; } i1++; @@ -687,15 +687,15 @@ void AIS_ColorScale::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr } if (i0 != -1) - DrawText (thePresentation, aLabels.Value (i0 + 1), aX, (Standard_Integer)( myYPos + i0 * aStep + anAscent + anOffset ), aFgColor); + drawText (thePresentation, aLabels.Value (i0 + 1), aX, (Standard_Integer)( myYPos + i0 * aStep + anAscent + anOffset ), aFgColor); } } //======================================================================= -//function : DrawFrame +//function : drawFrame //purpose : //======================================================================= -void AIS_ColorScale::DrawFrame (const Handle(Prs3d_Presentation)& thePresentation, +void AIS_ColorScale::drawFrame (const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theX, const Standard_Integer theY, const Standard_Integer theWidth, const Standard_Integer theHeight, const Quantity_Color& theColor) @@ -715,10 +715,10 @@ void AIS_ColorScale::DrawFrame (const Handle(Prs3d_Presentation)& thePresentatio } //======================================================================= -//function : DrawText +//function : drawText //purpose : //======================================================================= -void AIS_ColorScale::DrawText (const Handle(Prs3d_Presentation)& thePresentation, +void AIS_ColorScale::drawText (const Handle(Prs3d_Presentation)& thePresentation, const TCollection_ExtendedString& theText, const Standard_Integer theX, const Standard_Integer theY, const Quantity_Color& theColor) diff --git a/src/AIS/AIS_ColorScale.hxx b/src/AIS/AIS_ColorScale.hxx index 2976714184..7f352434de 100644 --- a/src/AIS/AIS_ColorScale.hxx +++ b/src/AIS/AIS_ColorScale.hxx @@ -232,7 +232,7 @@ protected: //! @param theWidth [in] the width of frame. //! @param theHeight [in] the height of frame. //! @param theColor [in] the color of frame. - Standard_EXPORT void DrawFrame (const Handle(Prs3d_Presentation)& thePresentation, + Standard_EXPORT void drawFrame (const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theX, const Standard_Integer theY, const Standard_Integer theWidth, const Standard_Integer theHeight, const Quantity_Color& theColor); @@ -242,7 +242,7 @@ protected: //! @param theX [in] the X coordinate of text position. //! @param theY [in] the Y coordinate of text position. //! @param theColor [in] the color of text. - Standard_EXPORT void DrawText (const Handle(Prs3d_Presentation)& thePresentation, + Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation, const TCollection_ExtendedString& theText, const Standard_Integer theX, const Standard_Integer theY, const Quantity_Color& theColor); diff --git a/src/AIS/AIS_Dimension.cxx b/src/AIS/AIS_Dimension.cxx index 1aba01e8f3..fd6f5f4a54 100755 --- a/src/AIS/AIS_Dimension.cxx +++ b/src/AIS/AIS_Dimension.cxx @@ -393,10 +393,10 @@ void AIS_Dimension::DrawArrow (const Handle(Prs3d_Presentation)& thePresentation } //======================================================================= -//function : DrawText -//purpose : +//function : drawText +//purpose : //======================================================================= -void AIS_Dimension::DrawText (const Handle(Prs3d_Presentation)& thePresentation, +void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation, const gp_Pnt& theTextPos, const gp_Dir& theTextDir, const TCollection_ExtendedString& theText, @@ -572,7 +572,7 @@ void AIS_Dimension::DrawExtension (const Handle(Prs3d_Presentation)& thePresenta gp_Pnt aTextPos = ElCLib::Value (theExtensionSize, anExtensionLine); gp_Dir aTextDir = theExtensionDir; - DrawText (thePresentation, + drawText (thePresentation, aTextPos, aTextDir, theLabelString, @@ -727,7 +727,7 @@ void AIS_Dimension::DrawLinearDimension (const Handle(Prs3d_Presentation)& thePr // add text primitives if (theMode == ComputeMode_All || theMode == ComputeMode_Text) { - DrawText (thePresentation, + drawText (thePresentation, aTextPos, aTextDir, aLabelString, diff --git a/src/AIS/AIS_Dimension.hxx b/src/AIS/AIS_Dimension.hxx index bc70fc43cc..55eb6ddfca 100755 --- a/src/AIS/AIS_Dimension.hxx +++ b/src/AIS/AIS_Dimension.hxx @@ -403,7 +403,7 @@ protected: //! @param theLabelPosition [in] the text label vertical and horizontal positioning option //! respectively to the main dimension line. //! @return text width relative to the dimension working plane. For 2d text this value will be zero. - Standard_EXPORT void DrawText (const Handle(Prs3d_Presentation)& thePresentation, + Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation, const gp_Pnt& theTextPos, const gp_Dir& theTextDir, const TCollection_ExtendedString& theText, diff --git a/src/BRepAlgo/BRepAlgo_DSAccess.cxx b/src/BRepAlgo/BRepAlgo_DSAccess.cxx index ae103e3ac4..1440ccbf9e 100644 --- a/src/BRepAlgo/BRepAlgo_DSAccess.cxx +++ b/src/BRepAlgo/BRepAlgo_DSAccess.cxx @@ -1456,6 +1456,9 @@ void BRepAlgo_DSAccess::PntVtxOnSectEdge Standard_Integer& ipv2, TopOpeBRepDS_Kind& pvk2) { + ipv1 = ipv2 = 0; + pvk1 = pvk2 = TopOpeBRepDS_UNKNOWN; + // myHB->ChangeBuilder(); TopOpeBRepDS_DataStructure& DS = myHDS->ChangeDS(); TopOpeBRepDS_Kind kind = TopOpeBRepDS_POINT; diff --git a/src/BSplCLib/BSplCLib.cxx b/src/BSplCLib/BSplCLib.cxx index 6d3a574ed8..e4ab7f5870 100644 --- a/src/BSplCLib/BSplCLib.cxx +++ b/src/BSplCLib/BSplCLib.cxx @@ -2806,7 +2806,7 @@ void BSplCLib::Trimming(const Standard_Integer Degree, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewPoles) { - Standard_Integer i, nbpoles, nbknots; + Standard_Integer i, nbpoles=0, nbknots=0; Standard_Real kk[2]; Standard_Integer mm[2]; TColStd_Array1OfReal K( kk[0], 1, 2 ); diff --git a/src/CDF/CDF_FWOSDriver.cxx b/src/CDF/CDF_FWOSDriver.cxx index 99337493e9..2c4f95e533 100644 --- a/src/CDF/CDF_FWOSDriver.cxx +++ b/src/CDF/CDF_FWOSDriver.cxx @@ -173,7 +173,7 @@ TCollection_ExtendedString CDF_FWOSDriver::DefaultFolder() #ifdef _WIN32 TCollection_ExtendedString hd=UTL::xgetenv("HOMEDRIVE"); - if(hd.Length() != NULL) { + if(hd.Length() != 0) { theDefaultFolder=hd; theDefaultFolder+=UTL::xgetenv("HOMEPATH"); } diff --git a/src/Dico/Dico_Dictionary.gxx b/src/Dico/Dico_Dictionary.gxx index 4878e279b8..b50f0beb51 100644 --- a/src/Dico/Dico_Dictionary.gxx +++ b/src/Dico/Dico_Dictionary.gxx @@ -376,7 +376,7 @@ Dico_Dictionary::Dico_Dictionary () else { stat = stat2; reslev = lev2; return; } } } - else if (car < thecars[0]) { acell = this; stat = -1; return; } + else /*if (car < thecars[0])*/{ acell = this; stat = -1; return; } } diff --git a/src/Draw/CommandWindow.cxx b/src/Draw/CommandWindow.cxx index 420279139a..52f2f91a13 100644 --- a/src/Draw/CommandWindow.cxx +++ b/src/Draw/CommandWindow.cxx @@ -193,7 +193,7 @@ LRESULT APIENTRY EditProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam ) { char buffer[COMMANDSIZE]; POINT pos; - BOOL rep; + BOOL rep = 0; static LRESULT nbline; // Process the buffer of the edit window LRESULT index; diff --git a/src/Draw/Draw.cxx b/src/Draw/Draw.cxx index f859e9b6ab..7394dc8f43 100644 --- a/src/Draw/Draw.cxx +++ b/src/Draw/Draw.cxx @@ -491,7 +491,7 @@ void Draw::Load(Draw_Interpretor& theDI, const TCollection_AsciiString& theKey, } TCollection_AsciiString aPluginLibrary(""); -#ifndef _WIN32 +#if !defined(_WIN32) || defined(__MINGW32__) aPluginLibrary += "lib"; #endif aPluginLibrary += aPluginResource->Value(theKey.ToCString()); diff --git a/src/Draw/DrawRessource.h b/src/Draw/DrawRessource.h index 0b542ee2d9..eb751f0383 100644 --- a/src/Draw/DrawRessource.h +++ b/src/Draw/DrawRessource.h @@ -14,7 +14,7 @@ commercial license or contractual agreement. */ -#ifdef _MSC_VER +#ifdef _WIN32 //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. diff --git a/src/Draw/Draw_BasicCommands.cxx b/src/Draw/Draw_BasicCommands.cxx index 3460a6df0e..0fda933618 100644 --- a/src/Draw/Draw_BasicCommands.cxx +++ b/src/Draw/Draw_BasicCommands.cxx @@ -334,7 +334,7 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c di << "Cygwin\n"; #endif #if defined(__MINGW64__) - di << "MinGW 64 " << __MINGW64_MAJOR_VERSION << "." << __MINGW64_MINOR_VERSION << "\n"; + di << "MinGW 64 " << __MINGW64_VERSION_MAJOR << "." << __MINGW64_VERSION_MINOR << "\n"; #elif defined(__MINGW32__) di << "MinGW 32 " << __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION << "\n"; #endif diff --git a/src/Draw/Draw_Interpretor.cxx b/src/Draw/Draw_Interpretor.cxx index bffe2fbef9..b350be731e 100644 --- a/src/Draw/Draw_Interpretor.cxx +++ b/src/Draw/Draw_Interpretor.cxx @@ -35,7 +35,7 @@ #endif // for capturing of cout and cerr (dup(), dup2()) -#ifdef _MSC_VER +#ifdef _WIN32 #include #endif @@ -86,8 +86,13 @@ namespace { return; // restore normal descriptors of console stream + #ifdef _WIN32 + _dup2(save_fd, std_fd); + _close(save_fd); + #else dup2(save_fd, std_fd); close(save_fd); + #endif // extract all output and copy it to log and optionally to cout const int BUFSIZE = 2048; diff --git a/src/Draw/Draw_Main.cxx b/src/Draw/Draw_Main.cxx index 66b51684da..c33a54f77a 100644 --- a/src/Draw/Draw_Main.cxx +++ b/src/Draw/Draw_Main.cxx @@ -63,13 +63,6 @@ extern Draw_Viewer dout; -static char* ColorNames[MAXCOLOR] = { - "White","Red","Green","Blue","Cyan","Gold","Magenta", - "Maroon","Orange","Pink","Salmon","Violet","Yellow","Khaki","Coral" - }; - -static Standard_Boolean XLoop; - // extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21 Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30 // true if complete command diff --git a/src/Draw/Draw_Window.cxx b/src/Draw/Draw_Window.cxx index 918465da8d..1948e0aca6 100644 --- a/src/Draw/Draw_Window.cxx +++ b/src/Draw/Draw_Window.cxx @@ -1430,7 +1430,7 @@ DrawWindow::DrawWindow() : } //________________________ -DrawWindow::DrawWindow(char* title, +DrawWindow::DrawWindow(const char* title, Standard_Integer X, Standard_Integer Y, Standard_Integer dX,Standard_Integer dY) : win(0), next(firstWindow), previous(NULL), myMemHbm(NULL), myUseBuffer(Standard_False) @@ -1440,7 +1440,7 @@ DrawWindow::DrawWindow(char* title, Init(X, Y, dX, dY); SetTitle(title); } -DrawWindow::DrawWindow(char* title, +DrawWindow::DrawWindow(const char* title, Standard_Integer X, Standard_Integer Y, Standard_Integer dX,Standard_Integer dY, HWND theWin) : @@ -1657,7 +1657,7 @@ Standard_Integer DrawWindow::WidthWin() const /*--------------------------------------------------------*\ | SetTitle \*--------------------------------------------------------*/ -void DrawWindow::SetTitle(char* title) +void DrawWindow::SetTitle(const char* title) { SetWindowText(win, title); } diff --git a/src/Draw/Draw_Window.hxx b/src/Draw/Draw_Window.hxx index 2f1655ada4..6bab470838 100644 --- a/src/Draw/Draw_Window.hxx +++ b/src/Draw/Draw_Window.hxx @@ -417,12 +417,12 @@ public: Standard_EXPORT static void RemoveCallbackBeforeTerminate(FCallbackBeforeTerminate theCB); __Draw_API DrawWindow(); - __Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer, + __Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer); - __Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer, + __Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer, HWND); //destructeur - __Draw_API ~DrawWindow(); + __Draw_API virtual ~DrawWindow(); //methods public: @@ -432,7 +432,7 @@ public: __Draw_API void SetUseBuffer(Standard_Boolean); // Turns on/off usage of off-screen image buffer (can be used for redrawing optimization) - __Draw_API Standard_Boolean GetUseBuffer() const { return myUseBuffer; } + Standard_Boolean GetUseBuffer() const { return myUseBuffer; } // Returns Standard_True if off-screen image buffer is being used //taille et position @@ -443,7 +443,7 @@ public: __Draw_API Standard_Integer WidthWin() const; //Title - __Draw_API void SetTitle(char*); + __Draw_API void SetTitle(const char*); __Draw_API char* GetTitle(); //Affichage @@ -451,7 +451,7 @@ public: __Draw_API void Hide(); __Draw_API void Destroy(); __Draw_API void Clear(); - __Draw_API static void Flush() {} ; + static void Flush() {} ; // save snapshot __Draw_API Standard_Boolean Save(const char* theFileName) const; diff --git a/src/DrawTrSurf/DrawTrSurf.cxx b/src/DrawTrSurf/DrawTrSurf.cxx index 57cdc5ef17..adba8f4511 100644 --- a/src/DrawTrSurf/DrawTrSurf.cxx +++ b/src/DrawTrSurf/DrawTrSurf.cxx @@ -1741,7 +1741,7 @@ static void pntsave(const Handle(Draw_Drawable3D)&d, ostream& OS) { Handle(DrawTrSurf_Point) N = Handle(DrawTrSurf_Point)::DownCast(d); -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) ios::fmtflags F = OS.flags(); OS.setf(ios::scientific,ios::floatfield); OS.precision(15); @@ -1758,7 +1758,7 @@ static void pntsave(const Handle(Draw_Drawable3D)&d, ostream& OS) OS << "0 "; OS << P.X() << " " << P.Y() << "\n"; } -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) OS.setf(F); #else OS.setf(form); @@ -1803,7 +1803,7 @@ static void triasave(const Handle(Draw_Drawable3D)&d, ostream& OS) { Handle(DrawTrSurf_Triangulation) T = Handle(DrawTrSurf_Triangulation)::DownCast(d); -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) ios::fmtflags F = OS.flags(); OS.setf(ios::scientific,ios::floatfield); OS.precision(15); @@ -1812,7 +1812,7 @@ static void triasave(const Handle(Draw_Drawable3D)&d, ostream& OS) std::streamsize prec = OS.precision(15); #endif Poly::Write(T->Triangulation(),OS); -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) OS.setf(F); #else OS.setf(form); @@ -1844,7 +1844,7 @@ static void poly3dsave(const Handle(Draw_Drawable3D)&d, ostream& OS) { Handle(DrawTrSurf_Polygon3D) T = Handle(DrawTrSurf_Polygon3D)::DownCast(d); -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) ios::fmtflags F = OS.flags(); OS.setf(ios::scientific,ios::floatfield); OS.precision(15); @@ -1853,7 +1853,7 @@ static void poly3dsave(const Handle(Draw_Drawable3D)&d, ostream& OS) std::streamsize prec = OS.precision(15); #endif Poly::Write(T->Polygon3D(),OS); -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) OS.setf(F); #else OS.setf(form); @@ -1884,7 +1884,7 @@ static void poly2dsave(const Handle(Draw_Drawable3D)&d, ostream& OS) { Handle(DrawTrSurf_Polygon2D) T = Handle(DrawTrSurf_Polygon2D)::DownCast(d); -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) ios::fmtflags F = OS.flags(); OS.setf(ios::scientific, ios::floatfield); OS.precision(15); @@ -1893,7 +1893,7 @@ static void poly2dsave(const Handle(Draw_Drawable3D)&d, ostream& OS) std::streamsize prec = OS.precision(15); #endif Poly::Write(T->Polygon2D(),OS); -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) OS.setf(F); #else OS.setf(form); diff --git a/src/DrawTrSurf/DrawTrSurf_Point.cxx b/src/DrawTrSurf/DrawTrSurf_Point.cxx index a43fb75e6e..53a78553bf 100644 --- a/src/DrawTrSurf/DrawTrSurf_Point.cxx +++ b/src/DrawTrSurf/DrawTrSurf_Point.cxx @@ -184,7 +184,7 @@ Handle(Draw_Drawable3D) DrawTrSurf_Point::Copy() const void DrawTrSurf_Point::Dump(Standard_OStream& S) const { -#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX) +#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX) ios::fmtflags F = S.flags(); S.setf(ios::scientific,ios::floatfield); S.precision(15); @@ -196,7 +196,7 @@ void DrawTrSurf_Point::Dump(Standard_OStream& S) const S << "Point : " << myPoint.X() << ", " << myPoint.Y() << ", " << myPoint.Z() <DomainSup) && (!TwoCurves)) || (Theta>(DomainSup+DomainSup-DomainInf+0.00000000000001))) { + SigneSqrtDis = 0.; Standard_DomainError::Raise("IntAna_Curve::Domain"); } diff --git a/src/MeshVS/MeshVS_MeshPrsBuilder.cxx b/src/MeshVS/MeshVS_MeshPrsBuilder.cxx index 54a8e66288..1253884018 100644 --- a/src/MeshVS/MeshVS_MeshPrsBuilder.cxx +++ b/src/MeshVS/MeshVS_MeshPrsBuilder.cxx @@ -54,6 +54,10 @@ #include #include +#ifdef _WIN32 + #include // for alloca() +#endif + IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder) //================================================================ diff --git a/src/Message/Message_PrinterOStream.cxx b/src/Message/Message_PrinterOStream.cxx index 36be8fe28f..d77e503978 100644 --- a/src/Message/Message_PrinterOStream.cxx +++ b/src/Message/Message_PrinterOStream.cxx @@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(Message_PrinterOStream,Message_Printer) -#ifndef _WIN32 +#if !defined(_MSC_VER) #include #endif diff --git a/src/MoniTool/MoniTool_TypedValue.cxx b/src/MoniTool/MoniTool_TypedValue.cxx index d08f5ef6fa..0b8f5c2d1f 100644 --- a/src/MoniTool/MoniTool_TypedValue.cxx +++ b/src/MoniTool/MoniTool_TypedValue.cxx @@ -181,7 +181,8 @@ static Standard_Boolean StaticPath(const Handle(TCollection_HAsciiString)& val) break; case MoniTool_ValueEnum : { def.AssignCat("Enum"); - Standard_Integer startcase, endcase; Standard_Boolean match; + Standard_Integer startcase=0, endcase=0; + Standard_Boolean match=0; EnumDef (startcase,endcase,match); Sprintf(mess," [%s%d-%d]",(match ? "in " : ""),startcase,endcase); def.AssignCat(mess); diff --git a/src/NCollection/FILES b/src/NCollection/FILES index 07f9554296..2d2def7b5e 100755 --- a/src/NCollection/FILES +++ b/src/NCollection/FILES @@ -69,6 +69,7 @@ NCollection_UtfIterator.hxx NCollection_UtfIterator.lxx NCollection_UtfString.hxx NCollection_UtfString.lxx +NCollection_UtfString.cxx NCollection_Vec2.hxx NCollection_Vec3.hxx NCollection_Vec4.hxx diff --git a/src/NCollection/NCollection_UtfString.cxx b/src/NCollection/NCollection_UtfString.cxx new file mode 100644 index 0000000000..8d845b0fd2 --- /dev/null +++ b/src/NCollection/NCollection_UtfString.cxx @@ -0,0 +1,89 @@ +// Created on: 2016-02-23 +// Created by: Kirill Gavrilov +// Copyright (c) 2016 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#if defined(_WIN32) + #include +#endif + +#include + +//======================================================================= +//function : ~NCollection_UtfStringTool +//purpose : +//======================================================================= +NCollection_UtfStringTool::~NCollection_UtfStringTool() +{ + delete[] myWideBuffer; +} + +//======================================================================= +//function : FromLocale() +//purpose : +//======================================================================= +wchar_t* NCollection_UtfStringTool::FromLocale (const char* theString) +{ + if (myWideBuffer != NULL) + { + delete[] myWideBuffer; + myWideBuffer = NULL; + } + +#if defined(_WIN32) + // use WinAPI + int aWideSize = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, NULL, 0); + if (aWideSize <= 0) + { + return NULL; + } + + myWideBuffer = new wchar_t[aWideSize + 1]; + MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, myWideBuffer, aWideSize); + myWideBuffer[aWideSize] = L'\0'; +#else + // this is size in bytes but should probably be enough to store string in wide chars + // notice that these functions are sensitive to locale set by application! + int aMbLen = mblen (theString, MB_CUR_MAX); + if (aMbLen <= 0) + { + return NULL; + } + + myWideBuffer = new wchar_t[aMbLen + 1]; + mbstowcs (myWideBuffer, theString, aMbLen); + myWideBuffer[aMbLen] = L'\0'; +#endif + return myWideBuffer; +} + +//======================================================================= +//function : ToLocale() +//purpose : +//======================================================================= +bool NCollection_UtfStringTool::ToLocale (const wchar_t* theWideString, + char* theBuffer, + const Standard_Integer theSizeBytes) +{ +#if defined(_WIN32) + int aMbBytes = WideCharToMultiByte (CP_ACP, 0, theWideString, -1, theBuffer, theSizeBytes, NULL, NULL); +#else + std::size_t aMbBytes = std::wcstombs (theBuffer, theWideString, theSizeBytes); +#endif + if (aMbBytes <= 0) + { + *theBuffer = '\0'; + return false; + } + return true; +} diff --git a/src/NCollection/NCollection_UtfString.lxx b/src/NCollection/NCollection_UtfString.lxx index 011ccffc88..c11070040b 100755 --- a/src/NCollection/NCollection_UtfString.lxx +++ b/src/NCollection/NCollection_UtfString.lxx @@ -272,6 +272,28 @@ void NCollection_UtfString::FromUnicode (const TypeFrom* theStringU strFree (anOldBuffer); } +//! Auxiliary convertion tool. +class NCollection_UtfStringTool +{ +public: + //! Empty constructor. + NCollection_UtfStringTool() : myWideBuffer (NULL) {} + + //! Destructor for temporary resources. + Standard_EXPORT ~NCollection_UtfStringTool(); + + //! Convert the string from current locale into UNICODE (wide characters) using system APIs. + //! Returned pointer will be released by this tool. + Standard_EXPORT wchar_t* FromLocale (const char* theString); + + //! Convert the UNICODE (wide characters) string into locale using system APIs. + Standard_EXPORT static bool ToLocale (const wchar_t* theWideString, + char* theBuffer, + const Standard_Integer theSizeBytes); +private: + wchar_t* myWideBuffer; //!< temporary variable +}; + // ======================================================================= // function : FromLocale // purpose : @@ -280,34 +302,14 @@ template inline void NCollection_UtfString::FromLocale (const char* theString, const Standard_Integer theLength) { -#if(defined(_WIN32) || defined(__WIN32__)) - // use WinAPI - int aWideSize = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, NULL, 0); - if (aWideSize <= 0) + NCollection_UtfStringTool aConvertor; + wchar_t* aWideBuffer = aConvertor.FromLocale (theString); + if (aWideBuffer == NULL) { Clear(); return; } - wchar_t* aWideBuffer = new wchar_t[aWideSize + 1]; - MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, aWideBuffer, aWideSize); - aWideBuffer[aWideSize] = L'\0'; FromUnicode (aWideBuffer, theLength); - delete[] aWideBuffer; -#else - // this is size in bytes but should probably be enough to store string in wide chars - // notice that these functions are sensitive to locale set by application! - int aMbLen = mblen (theString, MB_CUR_MAX); - if (aMbLen <= 0) - { - Clear(); - return; - } - wchar_t* aWideBuffer = new wchar_t[aMbLen + 1]; - mbstowcs (aWideBuffer, theString, aMbLen); - aWideBuffer[aMbLen] = L'\0'; - FromUnicode (aWideBuffer, theLength); - delete[] aWideBuffer; -#endif } // ======================================================================= @@ -319,17 +321,7 @@ bool NCollection_UtfString::ToLocale (char* theBuffer, const Standard_Integer theSizeBytes) const { NCollection_UtfString aWideCopy (myString, myLength); -#if(defined(_WIN32) || defined(__WIN32__)) - int aMbBytes = WideCharToMultiByte (CP_ACP, 0, aWideCopy.ToCString(), -1, theBuffer, theSizeBytes, NULL, NULL); -#else - std::size_t aMbBytes = std::wcstombs (theBuffer, aWideCopy.ToCString(), theSizeBytes); -#endif - if (aMbBytes <= 0) - { - *theBuffer = '\0'; - return false; - } - return true; + return NCollection_UtfStringTool::ToLocale (aWideCopy.ToCString(), theBuffer, theSizeBytes); } // ======================================================================= diff --git a/src/NCollection/NCollection_WinHeapAllocator.cxx b/src/NCollection/NCollection_WinHeapAllocator.cxx index 4efabbf3f7..c833e8cbe7 100644 --- a/src/NCollection/NCollection_WinHeapAllocator.cxx +++ b/src/NCollection/NCollection_WinHeapAllocator.cxx @@ -34,7 +34,7 @@ NCollection_WinHeapAllocator::NCollection_WinHeapAllocator #endif myToZeroMemory (Standard_False) { -#if(defined(_WIN32) || defined(__WIN32__)) +#if defined(_WIN32) && (_WIN32_WINNT >= 0x0501) // activate LHF to improve small size allocations ULONG aHeapInfo = 2; HeapSetInformation (myHeapH, HeapCompatibilityInformation, diff --git a/src/OSD/OSD_DirectoryIterator.cxx b/src/OSD/OSD_DirectoryIterator.cxx index 104487a0c0..1970977888 100644 --- a/src/OSD/OSD_DirectoryIterator.cxx +++ b/src/OSD/OSD_DirectoryIterator.cxx @@ -267,9 +267,7 @@ Standard_Boolean OSD_DirectoryIterator :: More () { void OSD_DirectoryIterator :: Next () { - if ( myFirstCall && !( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) || - !myFirstCall - ) { + if ( ! myFirstCall || ! ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) { do { diff --git a/src/OSD/OSD_File.cxx b/src/OSD/OSD_File.cxx index 1630c1ce3a..fb0c6f0c9f 100644 --- a/src/OSD/OSD_File.cxx +++ b/src/OSD/OSD_File.cxx @@ -384,7 +384,7 @@ return OSD_UNKNOWN ; // -------------------------------------------------------------------------- // Read content of a file // -------------------------------------------------------------------------- -void OSD_File::Read( Standard_Address& Buffer, +void OSD_File::Read(const Standard_Address Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte) { @@ -841,11 +841,12 @@ void OSD_File::Rewind() { #if defined(__CYGWIN32__) || defined(__MINGW32__) #define VAC -#define _int64 int #endif -#pragma comment( lib, "WSOCK32.LIB" ) -#pragma comment( lib, "WINSPOOL.LIB" ) +#if defined(_MSC_VER) + #pragma comment( lib, "WSOCK32.LIB" ) + #pragma comment( lib, "WINSPOOL.LIB" ) +#endif #define ACE_HEADER_SIZE ( sizeof ( ACCESS_ALLOWED_ACE ) - sizeof ( DWORD ) ) @@ -1085,19 +1086,18 @@ void OSD_File :: Read ( } Standard_Integer NbyteRead; - Standard_Address buff; TEST_RAISE( "Read" ); - buff = ( Standard_Address )new Standard_Character[ Nbyte + 1 ]; + char* buff = new Standard_Character[ Nbyte + 1 ]; Read ( buff, Nbyte, NbyteRead ); - ( ( Standard_PCharacter )buff )[ NbyteRead ] = 0; + buff[ NbyteRead ] = 0; if ( NbyteRead != 0 ) - Buffer = ( Standard_PCharacter )buff; + Buffer = buff; else @@ -1259,7 +1259,7 @@ void OSD_File :: ReadLine ( // -------------------------------------------------------------------------- void OSD_File :: Read ( - Standard_Address& Buffer, + const Standard_Address Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte ) { @@ -1456,7 +1456,7 @@ OSD_KindFile OSD_File :: KindOfFile () const { typedef struct _osd_wnt_key { HKEY hKey; - LPTSTR keyPath; + const char* keyPath; } OSD_WNT_KEY; @@ -1627,23 +1627,26 @@ Standard_Boolean OSD_File :: IsLocked () { // Return size of a file // -------------------------------------------------------------------------- -Standard_Size OSD_File :: Size () { - - Standard_Integer retVal; - - TEST_RAISE( "Size" ); - - LARGE_INTEGER aSize; - aSize.QuadPart = 0; - retVal = GetFileSizeEx (myFileHandle, &aSize); - - if ( retVal == 0 ) - - _osd_wnt_set_error ( myError, OSD_WFile ); - - return (Standard_Size)aSize.QuadPart; - -} // end OSD_File :: Size +Standard_Size OSD_File::Size() +{ + TEST_RAISE("Size"); +#if (_WIN32_WINNT >= 0x0500) + LARGE_INTEGER aSize; + aSize.QuadPart = 0; + if (GetFileSizeEx (myFileHandle, &aSize) == 0) + { + _osd_wnt_set_error (myError, OSD_WFile); + } + return (Standard_Size)aSize.QuadPart; +#else + DWORD aSize = GetFileSize (myFileHandle, NULL); + if (aSize == INVALID_FILE_SIZE) + { + _osd_wnt_set_error (myError, OSD_WFile); + } + return aSize; +#endif +} // -------------------------------------------------------------------------- // Print contains of a file @@ -1701,9 +1704,9 @@ PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( DWORD dwAccessOwner; DWORD dwAccessWorld; DWORD dwAccessAdminDir; - DWORD dwAccessGroupDir; +// DWORD dwAccessGroupDir; DWORD dwAccessOwnerDir; - DWORD dwAccessWorldDir; +// DWORD dwAccessWorldDir; DWORD dwACLsize = sizeof ( ACL ); DWORD dwIndex = 0; PTOKEN_OWNER pTkOwner = NULL; @@ -1769,9 +1772,9 @@ retry: dwAccessWorld = _get_access_mask ( prot.World () ); dwAccessAdminDir = _get_dir_access_mask ( prot.System () ); - dwAccessGroupDir = _get_dir_access_mask ( prot.Group () ); +// dwAccessGroupDir = _get_dir_access_mask ( prot.Group () ); dwAccessOwnerDir = _get_dir_access_mask ( prot.User () ); - dwAccessWorldDir = _get_dir_access_mask ( prot.World () ); +// dwAccessWorldDir = _get_dir_access_mask ( prot.World () ); if ( dwAccessGroup != 0 ) { diff --git a/src/OSD/OSD_File.hxx b/src/OSD/OSD_File.hxx index 4ecc16a5e0..c37bd772cb 100644 --- a/src/OSD/OSD_File.hxx +++ b/src/OSD/OSD_File.hxx @@ -117,7 +117,7 @@ public: //! may be less than Nbyte if the number of bytes left in the file //! is less than Nbyte bytes. For this reason the output //! parameter Readbyte will contain the number of read bytes. - Standard_EXPORT void Read (Standard_Address& Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte); + Standard_EXPORT void Read (const Standard_Address Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte); //! Attempts to write Nbyte bytes from the AsciiString to the file //! associated to the object File. diff --git a/src/OSD/OSD_FileIterator.cxx b/src/OSD/OSD_FileIterator.cxx index b5462671ca..f8f78b2032 100644 --- a/src/OSD/OSD_FileIterator.cxx +++ b/src/OSD/OSD_FileIterator.cxx @@ -345,9 +345,7 @@ Standard_Boolean OSD_FileIterator :: More () { void OSD_FileIterator :: Next () { - if ( myFirstCall && ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) || - !myFirstCall - ) { + if ( ! myFirstCall || ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) { do { diff --git a/src/OSD/OSD_Host.cxx b/src/OSD/OSD_Host.cxx index 60c88ee7af..8bf2a0849d 100644 --- a/src/OSD/OSD_Host.cxx +++ b/src/OSD/OSD_Host.cxx @@ -187,7 +187,9 @@ Standard_Integer OSD_Host::Error()const{ #include -#pragma comment( lib, "WSOCK32.LIB" ) +#if defined(_MSC_VER) + #pragma comment( lib, "WSOCK32.LIB" ) +#endif void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... ); diff --git a/src/OSD/OSD_MemInfo.cxx b/src/OSD/OSD_MemInfo.cxx index 25ebc7686e..f96df93e53 100644 --- a/src/OSD/OSD_MemInfo.cxx +++ b/src/OSD/OSD_MemInfo.cxx @@ -58,11 +58,18 @@ void OSD_MemInfo::Update() myCounters[anIter] = Standard_Size(-1); } -#if (defined(_WIN32) || defined(__WIN32__)) +#if defined(_WIN32) +#if (_WIN32_WINNT >= 0x0500) MEMORYSTATUSEX aStatEx; aStatEx.dwLength = sizeof(aStatEx); GlobalMemoryStatusEx (&aStatEx); myCounters[MemVirtual] = Standard_Size(aStatEx.ullTotalVirtual - aStatEx.ullAvailVirtual); +#else + MEMORYSTATUS aStat; + aStat.dwLength = sizeof(aStat); + GlobalMemoryStatus (&aStat); + myCounters[MemVirtual] = Standard_Size(aStat.dwTotalVirtual - aStat.dwAvailVirtual); +#endif // use Psapi library HANDLE aProcess = GetCurrentProcess(); diff --git a/src/OSD/OSD_OpenFile.cxx b/src/OSD/OSD_OpenFile.cxx index 938622b74c..0be7e84be4 100644 --- a/src/OSD/OSD_OpenFile.cxx +++ b/src/OSD/OSD_OpenFile.cxx @@ -11,6 +11,10 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#ifdef _WIN32 + #include +#endif + #include #include #include @@ -23,7 +27,7 @@ FILE* OSD_OpenFile(const char* theName, const char* theMode) { FILE* aFile = 0; -#ifdef _WIN32 +#if defined(_WIN32) // file name is treated as UTF-8 string and converted to UTF-16 one const TCollection_ExtendedString aFileNameW (theName, Standard_True); const TCollection_ExtendedString aFileModeW (theMode, Standard_True); @@ -43,7 +47,7 @@ FILE* OSD_OpenFile(const TCollection_ExtendedString& theName, const char* theMode) { FILE* aFile = 0; -#ifdef _WIN32 +#if defined(_WIN32) const TCollection_ExtendedString aFileModeW (theMode, Standard_True); aFile = ::_wfopen ((const wchar_t* )theName.ToExtString(), (const wchar_t* )aFileModeW.ToExtString()); @@ -63,7 +67,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff, const char* theName, const std::ios_base::openmode theMode) { -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSC_VER) // file name is treated as UTF-8 string and converted to UTF-16 one const TCollection_ExtendedString aFileNameW (theName, Standard_True); theBuff.open ((const wchar_t* )aFileNameW.ToExtString(), theMode); @@ -80,7 +84,7 @@ void OSD_OpenFileBuf(std::filebuf& theBuff, const TCollection_ExtendedString& theName, const std::ios_base::openmode theMode) { -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSC_VER) theBuff.open ((const wchar_t* )theName.ToExtString(), theMode); #else // conversion in UTF-8 for linux @@ -97,7 +101,7 @@ void OSD_OpenStream(std::ofstream& theStream, const char* theName, const std::ios_base::openmode theMode) { -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSC_VER) // file name is treated as UTF-8 string and converted to UTF-16 one const TCollection_ExtendedString aFileNameW (theName, Standard_True); theStream.open ((const wchar_t* )aFileNameW.ToExtString(), theMode); @@ -114,7 +118,7 @@ void OSD_OpenStream(std::ofstream& theStream, const TCollection_ExtendedString& theName, const std::ios_base::openmode theMode) { -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSC_VER) theStream.open ((const wchar_t* )theName.ToExtString(), theMode); #else // conversion in UTF-8 for linux @@ -131,7 +135,7 @@ void OSD_OpenStream (std::ifstream& theStream, const char* theName, const std::ios_base::openmode theMode) { -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSC_VER) // file name is treated as UTF-8 string and converted to UTF-16 one const TCollection_ExtendedString aFileNameW (theName, Standard_True); theStream.open ((const wchar_t*)aFileNameW.ToExtString(), theMode); @@ -148,7 +152,7 @@ void OSD_OpenStream (std::ifstream& theStream, const TCollection_ExtendedString& theName, const std::ios_base::openmode theMode) { -#ifdef _WIN32 +#if defined(_WIN32) && defined(_MSC_VER) theStream.open ((const wchar_t*)theName.ToExtString(), theMode); #else // conversion in UTF-8 for linux diff --git a/src/OSD/OSD_Path.cxx b/src/OSD/OSD_Path.cxx index 21d9d66a90..c434dbe7f6 100644 --- a/src/OSD/OSD_Path.cxx +++ b/src/OSD/OSD_Path.cxx @@ -1103,7 +1103,7 @@ Standard_Integer OSD_Path :: TrekLength () const { Standard_Integer i = 1; Standard_Integer retVal = 0; - if ( myTrek.IsEmpty () || myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|' ) + if ( myTrek.IsEmpty () || (myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|') ) return retVal; diff --git a/src/OSD/OSD_Process.cxx b/src/OSD/OSD_Process.cxx index f9623fd31d..b73c1e2ce9 100644 --- a/src/OSD/OSD_Process.cxx +++ b/src/OSD/OSD_Process.cxx @@ -197,8 +197,9 @@ Standard_Integer OSD_Process::Error()const{ #include #include /// pour UNLEN ( see MSDN about GetUserName() ) - -#pragma warning( disable : 4700 ) +#if defined(_MSC_VER) + #pragma warning( disable : 4700 ) +#endif void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... ); diff --git a/src/OSD/OSD_WNT_1.hxx b/src/OSD/OSD_WNT_1.hxx index 3dc32102d7..a708714137 100644 --- a/src/OSD/OSD_WNT_1.hxx +++ b/src/OSD/OSD_WNT_1.hxx @@ -35,10 +35,6 @@ # endif # endif /* OSDAPI */ -#if defined(__CYGWIN32__) || defined(__MINGW32__) -#define _TINT int -#endif - # ifdef __cplusplus extern "C" { # endif /* __cplusplus */ diff --git a/src/OSD/OSD_signal_WNT.cxx b/src/OSD/OSD_signal_WNT.cxx index 163661363c..7c09160596 100644 --- a/src/OSD/OSD_signal_WNT.cxx +++ b/src/OSD/OSD_signal_WNT.cxx @@ -24,6 +24,12 @@ #endif #include +#ifndef STATUS_FLOAT_MULTIPLE_FAULTS + // + #define STATUS_FLOAT_MULTIPLE_FAULTS (0xC00002B4L) + #define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L) +#endif + #include #include #include diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx index ab026e979a..b96d00049b 100644 --- a/src/OpenGl/OpenGl_Context.cxx +++ b/src/OpenGl/OpenGl_Context.cxx @@ -559,7 +559,7 @@ void* OpenGl_Context::findProc (const char* theFuncName) #if defined(HAVE_EGL) return (void* )eglGetProcAddress (theFuncName); #elif defined(_WIN32) - return wglGetProcAddress (theFuncName); + return (void* )wglGetProcAddress (theFuncName); #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) return (myGlLibHandle != NULL) ? dlsym (myGlLibHandle, theFuncName) : NULL; #else diff --git a/src/OpenGl/OpenGl_ShaderObject.cxx b/src/OpenGl/OpenGl_ShaderObject.cxx index c9cfd8050a..96affd49ea 100755 --- a/src/OpenGl/OpenGl_ShaderObject.cxx +++ b/src/OpenGl/OpenGl_ShaderObject.cxx @@ -20,6 +20,9 @@ #include #include +#ifdef _WIN32 + #include // for alloca() +#endif IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderObject,OpenGl_Resource) diff --git a/src/OpenGl/OpenGl_ShaderProgram.cxx b/src/OpenGl/OpenGl_ShaderProgram.cxx index 90ef45b78f..7392d07f78 100755 --- a/src/OpenGl/OpenGl_ShaderProgram.cxx +++ b/src/OpenGl/OpenGl_ShaderProgram.cxx @@ -28,6 +28,10 @@ #include +#ifdef _WIN32 + #include // for alloca() +#endif + IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderProgram,OpenGl_Resource) OpenGl_VariableSetterSelector OpenGl_ShaderProgram::mySetterSelector = OpenGl_VariableSetterSelector(); diff --git a/src/PCDM/PCDM_ReferenceIterator.cxx b/src/PCDM/PCDM_ReferenceIterator.cxx index 6327ec09d5..60ee20bbaa 100644 --- a/src/PCDM/PCDM_ReferenceIterator.cxx +++ b/src/PCDM/PCDM_ReferenceIterator.cxx @@ -121,14 +121,14 @@ Handle(CDM_MetaData) PCDM_ReferenceIterator::MetaData(const Standard_Boolean ) c chr = dir.Value ( i ); switch ( chr ) { - - case _TEXT( '|' ): - dirRet += _TEXT( "/" ); + + case '|': + dirRet += "/"; break; - - case _TEXT( '^' ): - - dirRet += _TEXT( ".." ); + + case '^': + + dirRet += ".."; break; default: diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index 24557a6427..e3f18eeedb 100644 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -2385,7 +2385,7 @@ static int StackOverflow (int i = -1) #endif // this code does not work with optimize mode on Windows -#ifdef _WIN32 +#if defined(_MSC_VER) #pragma optimize( "", off ) #endif static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) @@ -2642,7 +2642,7 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co return 0; } -#ifdef _WIN32 +#if defined(_MSC_VER) #pragma optimize( "", on ) #endif diff --git a/src/Standard/Standard.cxx b/src/Standard/Standard.cxx index 185cb64705..edd261483f 100644 --- a/src/Standard/Standard.cxx +++ b/src/Standard/Standard.cxx @@ -84,7 +84,7 @@ Standard_MMgrFactory::Standard_MMgrFactory() aVar = getenv ("MMGT_OPT"); Standard_Integer anAllocId = (aVar ? atoi (aVar): OCCT_MMGT_OPT_DEFAULT); -#if defined(_WIN32) && !defined(_WIN64) +#if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__) static const DWORD _SSE2_FEATURE_BIT(0x04000000); if ( anAllocId == 2 ) { diff --git a/src/Standard/Standard_Assert.hxx b/src/Standard/Standard_Assert.hxx index a7f363f6e5..aa4df3c0c0 100644 --- a/src/Standard/Standard_Assert.hxx +++ b/src/Standard/Standard_Assert.hxx @@ -72,7 +72,7 @@ inline void Standard_ASSERT_DO_NOTHING() {} // User messages are activated in debug mode only #ifdef _DEBUG #if (defined(_WIN32) || defined(__WIN32__)) - #if defined(_MSC_VER) + #if defined(_MSC_VER) || defined(__MINGW64__) // VS-specific intrinsic #define Standard_ASSERT_DBGBREAK_() __debugbreak() #else diff --git a/src/Standard/Standard_CLocaleSentry.cxx b/src/Standard/Standard_CLocaleSentry.cxx index 26e54cce47..fc7a4b33cd 100644 --- a/src/Standard/Standard_CLocaleSentry.cxx +++ b/src/Standard/Standard_CLocaleSentry.cxx @@ -32,7 +32,7 @@ namespace CLocalePtr() #ifdef HAVE_XLOCALE_H : myLocale (newlocale (LC_ALL_MASK, "C", NULL)) - #elif defined(_WIN32) + #elif defined(_WIN32) && !defined(__MINGW32__) : myLocale (_create_locale (LC_ALL, "C")) #else : myLocale (NULL) @@ -43,7 +43,7 @@ namespace { #ifdef HAVE_XLOCALE_H freelocale (myLocale); - #elif defined(_WIN32) + #elif defined(_WIN32) && !defined(__MINGW32__) _free_locale (myLocale); #endif } diff --git a/src/Standard/Standard_CLocaleSentry.hxx b/src/Standard/Standard_CLocaleSentry.hxx index 25d30c722d..4d9f7b9277 100755 --- a/src/Standard/Standard_CLocaleSentry.hxx +++ b/src/Standard/Standard_CLocaleSentry.hxx @@ -65,7 +65,7 @@ public: #ifdef HAVE_XLOCALE_H typedef locale_t clocale_t; -#elif defined(_WIN32) +#elif defined(_WIN32) && !defined(__MINGW32__) typedef _locale_t clocale_t; #else typedef void* clocale_t; diff --git a/src/Standard/Standard_CString.cxx b/src/Standard/Standard_CString.cxx index ed39493abb..ec33b0a38f 100755 --- a/src/Standard/Standard_CString.cxx +++ b/src/Standard/Standard_CString.cxx @@ -63,7 +63,7 @@ Standard_Integer HashCodes (const Standard_CString Value, #ifdef __APPLE__ // There are a lot of *_l functions availalbe on Mac OS X - we use them #define SAVE_TL() -#elif defined(_WIN32) +#elif defined(_WIN32) && !defined(__MINGW32__) // MSVCRT has equivalents with slightly different syntax #define SAVE_TL() #define strtod_l(thePtr, theNextPtr, theLocale) _strtod_l(thePtr, theNextPtr, theLocale) @@ -80,7 +80,7 @@ Standard_Integer HashCodes (const Standard_CString Value, // glibc version for android platform use locale-independent implementation of // strtod, strtol, strtoll functions. For other system with locale-depended // implementations problems may appear if "C" locale is not set explicitly. - #if !defined(__ANDROID__) && !defined(__QNX__) + #if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__MINGW32__) #error System does not support xlocale. Import/export could be broken if C locale did not specified by application. #endif #define strtod_l(thePtr, theNextPtr, theLocale) strtod(thePtr, theNextPtr) diff --git a/src/Standard/Standard_values.h b/src/Standard/Standard_values.h index b51b98f362..8d397dd84e 100644 --- a/src/Standard/Standard_values.h +++ b/src/Standard/Standard_values.h @@ -17,7 +17,7 @@ #ifndef _Standard_values_HeaderFile # define _Standard_values_HeaderFile -#ifdef _WIN32 +#if defined(_MSC_VER) # include #else # include diff --git a/src/TCollection/TCollection_AsciiString.cxx b/src/TCollection/TCollection_AsciiString.cxx index 2aa7f1dc35..51edd9211b 100644 --- a/src/TCollection/TCollection_AsciiString.cxx +++ b/src/TCollection/TCollection_AsciiString.cxx @@ -57,7 +57,7 @@ TCollection_AsciiString::TCollection_AsciiString() // Create an asciistring from a Standard_CString // ---------------------------------------------------------------------------- TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring) - : mystring(0) + : mystring(0), mylength(0) { if (astring) { mylength = Standard_Integer( strlen(astring) ); @@ -75,10 +75,9 @@ TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring) // ---------------------------------------------------------------------------- TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring, const Standard_Integer aLen ) - : mystring(0) + : mystring(0), mylength(aLen) { if (astring) { - mylength = aLen ; mystring = Allocate(mylength+1); strncpy( mystring , astring , mylength ); mystring [ mylength ] = '\0' ; diff --git a/src/TCollection/TCollection_ExtendedString.cxx b/src/TCollection/TCollection_ExtendedString.cxx index b12c0e5e85..f4d408e691 100644 --- a/src/TCollection/TCollection_ExtendedString.cxx +++ b/src/TCollection/TCollection_ExtendedString.cxx @@ -133,6 +133,7 @@ TCollection_ExtendedString::TCollection_ExtendedString() TCollection_ExtendedString::TCollection_ExtendedString (const Standard_CString astring, const Standard_Boolean isMultiByte) + : mystring(0), mylength(0) { if (astring) { if(!isMultiByte) { @@ -166,6 +167,7 @@ TCollection_ExtendedString::TCollection_ExtendedString //-------------------------------------------------------------------------- TCollection_ExtendedString::TCollection_ExtendedString (const Standard_ExtString astring) + : mystring(0), mylength(0) { if (astring) { diff --git a/src/TKD3DHost/EXTERNLIB b/src/TKD3DHost/EXTERNLIB index 43447d8673..4208b02798 100644 --- a/src/TKD3DHost/EXTERNLIB +++ b/src/TKD3DHost/EXTERNLIB @@ -7,3 +7,4 @@ CSF_XwLibs CSF_OpenGlLibs CSF_user32 CSF_gdi32 +CSF_d3d9 diff --git a/src/TKernel/EXTERNLIB b/src/TKernel/EXTERNLIB index c2a9cf8372..c7ceace8fd 100755 --- a/src/TKernel/EXTERNLIB +++ b/src/TKernel/EXTERNLIB @@ -3,4 +3,7 @@ CSF_advapi32 CSF_gdi32 CSF_user32 CSF_TBB -CSF_dl \ No newline at end of file +CSF_dl +CSF_wsock32 +CSF_winspool +CSF_psapi diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_GIter.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_GIter.cxx index 45ae98557a..7dd7e101dd 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_GIter.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_GIter.cxx @@ -69,7 +69,11 @@ void TopOpeBRepBuild_GIter::Next() void TopOpeBRepBuild_GIter::Current(TopAbs_State& s1, TopAbs_State& s2) const { - if ( !More() ) return; + if ( !More() ) + { + s1 = s2 = TopAbs_UNKNOWN; + return; + } Standard_Integer i1,i2; MYGTOPO.Index(myII,i1,i2); s1 = MYGTOPO.GState(i1); diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx index bb21c52f2b..bed27733d4 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx @@ -171,7 +171,8 @@ Standard_Boolean TopOpeBRepBuild_GTopo::Value(const TopAbs_State s1, Standard_Boolean TopOpeBRepBuild_GTopo::Value(const Standard_Integer II) const { - Standard_Integer i1,i2; Index(II,i1,i2); + Standard_Integer i1=0,i2=0; + Index(II,i1,i2); Standard_Boolean b = Value(i1,i2); return b; } diff --git a/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx b/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx index fe531f9817..96746b7462 100644 --- a/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx +++ b/src/TopOpeBRepDS/TopOpeBRepDS_EXPORT.cxx @@ -1446,7 +1446,9 @@ Standard_EXPORT Standard_Integer FUN_ds_hasI2d( Standard_Boolean is3d = Standard_False; for (; itF.More(); itF.Next()){ const Handle(TopOpeBRepDS_Interference)& IF = itF.Value(); - TopOpeBRepDS_Kind GTF,STF; Standard_Integer GF,SF; FDS_data(IF,GTF,GF,STF,SF); + TopOpeBRepDS_Kind GTF,STF; + Standard_Integer GF=0,SF=0; + FDS_data(IF,GTF,GF,STF,SF); if (GE != GF) continue; if (SF==isb) { is3d = Standard_True; diff --git a/src/V3d/V3d_View_Print.cxx b/src/V3d/V3d_View_Print.cxx index edeaa5903c..3e07ed972d 100644 --- a/src/V3d/V3d_View_Print.cxx +++ b/src/V3d/V3d_View_Print.cxx @@ -20,7 +20,9 @@ #ifdef _WIN32 #include -#pragma comment( lib, "comdlg32.lib" ) +#if defined(_MSC_VER) + #pragma comment( lib, "comdlg32.lib" ) +#endif #endif diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 0841a16135..01af7825fa 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -139,7 +139,7 @@ #include #include -#ifdef _WIN32 +#if defined(_MSC_VER) # define _CRT_SECURE_NO_DEPRECATE # pragma warning (disable:4996) #endif diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index a82705dca1..f882441b80 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -234,7 +234,7 @@ const Handle(MMgt_TShared)& ViewerTest::WClass() #if defined(_WIN32) if (theWClass.IsNull()) { - theWClass = new WNT_WClass ("GW3D_Class", AdvViewerWindowProc, + theWClass = new WNT_WClass ("GW3D_Class", (Standard_Address )AdvViewerWindowProc, CS_VREDRAW | CS_HREDRAW, 0, 0, ::LoadCursor (NULL, IDC_ARROW)); } @@ -8649,7 +8649,7 @@ static Standard_Integer VProgressiveMode (Draw_Interpretor& /*theDI*/, Standard_Boolean toExit = Standard_False; MSG aMsg; - while (PeekMessage (&aMsg, NULL, NULL, NULL, PM_REMOVE)) + while (PeekMessage (&aMsg, NULL, 0, 0, PM_REMOVE)) { if (aMsg.message == WM_KEYDOWN && (aMsg.wParam == 0x0d || aMsg.wParam == 0x1b)) { diff --git a/src/WNT/WNT_WClass.cxx b/src/WNT/WNT_WClass.cxx index 014348b6f6..d2d12c6c52 100644 --- a/src/WNT/WNT_WClass.cxx +++ b/src/WNT/WNT_WClass.cxx @@ -63,7 +63,7 @@ WNT_WClass::WNT_WClass ( lpszName = new char[ strlen ( aClassName ) + 1 ]; strcpy ( (Standard_PCharacter)lpszName, aClassName ); - lpfnWndProc = wc.lpfnWndProc; + lpfnWndProc = (void* )wc.lpfnWndProc; } // end constructor diff --git a/src/WNT/WNT_Window.cxx b/src/WNT/WNT_Window.cxx index b8d586fe2f..201853f00a 100644 --- a/src/WNT/WNT_Window.cxx +++ b/src/WNT/WNT_Window.cxx @@ -221,10 +221,10 @@ Aspect_TypeOfResize WNT_Window::DoResize() const if (wp.showCmd != SW_SHOWMINIMIZED) { - if (Abs (wp.rcNormalPosition.left - aXLeft ) > 2) mask |= 1; - if (Abs (wp.rcNormalPosition.right - aXRight ) > 2) mask |= 2; - if (Abs (wp.rcNormalPosition.top - aYTop ) > 2) mask |= 4; - if (Abs (wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8; + if (Abs ((int )wp.rcNormalPosition.left - aXLeft ) > 2) mask |= 1; + if (Abs ((int )wp.rcNormalPosition.right - aXRight ) > 2) mask |= 2; + if (Abs ((int )wp.rcNormalPosition.top - aYTop ) > 2) mask |= 4; + if (Abs ((int )wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8; switch (mask) { diff --git a/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx b/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx index 633dfc2b89..db72502ace 100644 --- a/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx +++ b/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx @@ -377,14 +377,14 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument chr = dir.Value ( i ); switch ( chr ) { - - case _TEXT( '|' ): - dirRet += _TEXT( "/" ); + + case '|': + dirRet += "/"; break; - - case _TEXT( '^' ): - - dirRet += _TEXT( ".." ); + + case '^': + + dirRet += ".."; break; default: