[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35061] trunk/blender/source/blender/ editors/physics/physics_fluid.c: Bug fix: Fluidsim paths were not handled properly

Janne Karhu jhkarh at gmail.com
Tue Feb 22 10:34:43 CET 2011


Revision: 35061
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35061
Author:   jhk
Date:     2011-02-22 09:34:43 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
Bug fix: Fluidsim paths were not handled properly
* Tsk! Using sizeof(string) to determine string length works if the string is a char array, but not if it's a pointer to a char array!
* Now the fluid code uses the actual size of the string directly.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/physics/physics_fluid.c

Modified: trunk/blender/source/blender/editors/physics/physics_fluid.c
===================================================================
--- trunk/blender/source/blender/editors/physics/physics_fluid.c	2011-02-22 09:14:29 UTC (rev 35060)
+++ trunk/blender/source/blender/editors/physics/physics_fluid.c	2011-02-22 09:34:43 UTC (rev 35061)
@@ -643,7 +643,7 @@
 	BLI_path_abs(targetDir, G.main->name); // fixed #frame-no 
 
 	// .tmp: dont overwrite/delete original file
-	BLI_snprintf(targetFile, sizeof(targetFile), "%s%s.tmp", targetDir, suffixConfig);
+	BLI_snprintf(targetFile, FILE_MAXDIR+FILE_MAXFILE, "%s%s.tmp", targetDir, suffixConfig);
 
 	// make sure all directories exist
 	// as the bobjs use the same dir, this only needs to be checked
@@ -664,13 +664,13 @@
 		char blendFile[FILE_MAXDIR+FILE_MAXFILE];
 		
 		// invalid dir, reset to current/previous
-		BLI_strncpy(blendDir, G.main->name, sizeof(blendDir));
+		BLI_strncpy(blendDir, G.main->name, FILE_MAXDIR+FILE_MAXFILE);
 		BLI_splitdirstring(blendDir, blendFile);
-		BLI_replace_extension(blendFile, sizeof(blendFile), ""); /* strip .blend */
+		BLI_replace_extension(blendFile, FILE_MAXDIR+FILE_MAXFILE, ""); /* strip .blend */
 
-		BLI_snprintf(newSurfdataPath, sizeof(newSurfdataPath) ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
+		BLI_snprintf(newSurfdataPath, FILE_MAXDIR+FILE_MAXFILE ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
 		
-		BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
+		BLI_snprintf(debugStrBuffer, 256, "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
 		elbeemDebugOut(debugStrBuffer);
 		outStringsChanged=1;
 	}
@@ -952,7 +952,7 @@
 
 	/* ********  start writing / exporting ******** */
 	// use .tmp, dont overwrite/delete original file
-	BLI_snprintf(targetFile, sizeof(targetFile), "%s%s.tmp", targetDir, suffixConfig);
+	BLI_snprintf(targetFile, 240, "%s%s.tmp", targetDir, suffixConfig);
 	
 	// make sure these directories exist as well
 	if(outStringsChanged) {
@@ -980,7 +980,7 @@
 	fsset->aniFrameTime = channels->aniFrameTime;
 	fsset->noOfFrames = noFrames; // is otherwise subtracted in parser
 
-	BLI_snprintf(targetFile, sizeof(targetFile), "%s%s", targetDir, suffixSurface);
+	BLI_snprintf(targetFile, 240, "%s%s", targetDir, suffixSurface);
 
 	// defaults for compressibility and adaptive grids
 	fsset->gstar = domainSettings->gstar;
@@ -990,7 +990,7 @@
 	fsset->surfaceSmoothing = domainSettings->surfaceSmoothing; 
 	fsset->surfaceSubdivs = domainSettings->surfaceSubdivs; 
 	fsset->farFieldSize = domainSettings->farFieldSize; 
-	BLI_strncpy(fsset->outputPath, targetFile, sizeof(fsset->outputPath));
+	BLI_strncpy(fsset->outputPath, targetFile, 240);
 
 	// domain channels
 	fsset->channelSizeFrameTime = 




More information about the Bf-blender-cvs mailing list