Commit: 6f45c9d6c6d9ab7dc050bec2adb7244b7e769624
Author: Campbell Barton
Date:   Tue Jan 30 14:30:28 2018 +1100
Branches: blender-v2.79a-release
https://developer.blender.org/rB6f45c9d6c6d9ab7dc050bec2adb7244b7e769624

Fix T50630: Fluid fails on win32 w/ unicode paths

Allow overriding gzip open w/ elbeem.

===================================================================

M       intern/elbeem/CMakeLists.txt
M       intern/elbeem/intern/ntl_blenderdumper.cpp

===================================================================

diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt
index 30c5615f1d2..1534219a052 100644
--- a/intern/elbeem/CMakeLists.txt
+++ b/intern/elbeem/CMakeLists.txt
@@ -107,6 +107,14 @@ add_definitions(
        -DNEWDIRVELMOTEST=0
 )
 
+if(WIN32)
+       # We need BLI_gzopen on win32 for unicode paths
+       add_definitions(
+               
-DLBM_GZIP_OVERRIDE_H="${CMAKE_SOURCE_DIR}/source/blender/blenlib/BLI_fileops.h"
+               -D LBM_GZIP_OPEN_FN="\(gzFile\)BLI_gzopen"
+       )
+endif()
+
 if(WITH_OPENMP)
        add_definitions(-DPARALLEL=1)
 else()
diff --git a/intern/elbeem/intern/ntl_blenderdumper.cpp 
b/intern/elbeem/intern/ntl_blenderdumper.cpp
index ec05c25004d..af99dc03add 100644
--- a/intern/elbeem/intern/ntl_blenderdumper.cpp
+++ b/intern/elbeem/intern/ntl_blenderdumper.cpp
@@ -22,7 +22,11 @@
 
 #include <zlib.h>
 
-
+#ifdef LBM_GZIP_OVERRIDE_H
+#  include LBM_GZIP_OVERRIDE_H
+#else
+#  define LBM_GZIP_OPEN_FN(a, b) gzopen(a, b)
+#endif
 
 /******************************************************************************
  * Constructor
@@ -141,7 +145,8 @@ int ntlBlenderDumper::renderScene( void )
                                        std::ostringstream bvelfilename;
                                        bvelfilename << boutfilename.str();
                                        bvelfilename << ".bvel.gz";
-                                       gzf = 
gzopen(bvelfilename.str().c_str(), "wb9");
+                                       /* wraps gzopen */
+                                       gzf = 
LBM_GZIP_OPEN_FN(bvelfilename.str().c_str(), "wb9");
                                        if(gzf) {
                                                int numVerts;
                                                if(sizeof(numVerts)!=4) { 
errMsg("ntlBlenderDumper::renderScene","Invalid int size"); return 1; }
@@ -162,7 +167,8 @@ int ntlBlenderDumper::renderScene( void )
 
                                // compress all bobj's 
                                boutfilename << ".bobj.gz";
-                               gzf = gzopen(boutfilename.str().c_str(), 
"wb1"); // wb9 is slow for large meshes!
+                               /* wraps gzopen */
+                               gzf = 
LBM_GZIP_OPEN_FN(boutfilename.str().c_str(), "wb1"); // wb9 is slow for large 
meshes!
                                if (!gzf) {
                                        
errMsg("ntlBlenderDumper::renderScene","Unable to open output '" + 
boutfilename.str() + "' ");
                                        return 1; }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to