[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39731] trunk/blender: - use %u rather tham %d for unsigned ints in string formatting funcs.

Campbell Barton ideasman42 at gmail.com
Sat Aug 27 05:25:05 CEST 2011


Revision: 39731
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39731
Author:   campbellbarton
Date:     2011-08-27 03:25:02 +0000 (Sat, 27 Aug 2011)
Log Message:
-----------
- use %u rather tham %d for unsigned ints in string formatting funcs.
- replace (strlen(str) == 0) with str[0]=='\0'

Modified Paths:
--------------
    trunk/blender/intern/itasc/kdl/frames_io.cpp
    trunk/blender/source/blender/blenkernel/intern/mesh_validate.c
    trunk/blender/source/blender/blenkernel/intern/pointcache.c
    trunk/blender/source/blender/blenloader/intern/readblenentry.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/animation/anim_markers.c
    trunk/blender/source/blender/editors/animation/fmodifier_ui.c
    trunk/blender/source/blender/editors/object/object_modifier.c
    trunk/blender/source/blender/gpu/intern/gpu_codegen.c
    trunk/blender/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
    trunk/blender/source/blender/imbuf/intern/tiff.c
    trunk/blender/source/blender/makesrna/intern/makesrna.c
    trunk/blender/source/blender/makesrna/intern/rna_define.c
    trunk/blender/source/gameengine/GameLogic/SCA_RandomActuator.cpp
    trunk/blender/source/gameengine/VideoTexture/Exception.cpp

Modified: trunk/blender/intern/itasc/kdl/frames_io.cpp
===================================================================
--- trunk/blender/intern/itasc/kdl/frames_io.cpp	2011-08-27 03:20:32 UTC (rev 39730)
+++ trunk/blender/intern/itasc/kdl/frames_io.cpp	2011-08-27 03:25:02 UTC (rev 39731)
@@ -133,7 +133,7 @@
 {   IOTrace("Stream input Vector (vector or ZERO)");
     char storage[10];
     EatWord(is,"[]",storage,10);
-    if (strlen(storage)==0) {
+    if (storage[0]=='\0') {
         Eat(is,'[');
         is >> v(0);
         Eat(is,',');
@@ -194,7 +194,7 @@
 {   IOTrace("Stream input Rotation (Matrix or EULERZYX, EULERZYZ,RPY, ROT, IDENTITY)");
     char storage[10];
     EatWord(is,"[]",storage,10);
-    if (strlen(storage)==0) {
+    if (storage[0]=='\0') {
         Eat(is,'[');
         for (int i=0;i<3;i++) {
             is >> r(i,0);
@@ -255,7 +255,7 @@
 {   IOTrace("Stream input Frame (Rotation,Vector) or DH[...]");
     char storage[10];
     EatWord(is,"[",storage,10);
-    if (strlen(storage)==0) {
+    if (storage[0]=='\0') {
         Eat(is,'[');
         is >> T.M;
         is >> T.p;

Modified: trunk/blender/source/blender/blenkernel/intern/mesh_validate.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mesh_validate.c	2011-08-27 03:20:32 UTC (rev 39730)
+++ trunk/blender/source/blender/blenkernel/intern/mesh_validate.c	2011-08-27 03:25:02 UTC (rev 39731)
@@ -80,7 +80,7 @@
 	edge_store_assign(es[3].verts, mf->v4, mf->v1);
 }
 
-static void edge_store_from_mface_tri(EdgeUUID es[3], MFace *mf)
+static void edge_store_from_mface_tri(EdgeUUID es[4], MFace *mf)
 {
 	edge_store_assign(es[0].verts, mf->v1, mf->v2);
 	edge_store_assign(es[1].verts, mf->v2, mf->v3);
@@ -143,30 +143,30 @@
 
 	BLI_assert(!(do_fixes && me == NULL));
 
-	PRINT("ED_mesh_validate: verts(%d), edges(%d), faces(%d)\n", totvert, totedge, totface);
+	PRINT("ED_mesh_validate: verts(%u), edges(%u), faces(%u)\n", totvert, totedge, totface);
 
 	if(totedge == 0 && totface != 0) {
-		PRINT("    locical error, %d faces and 0 edges\n", totface);
+		PRINT("    locical error, %u faces and 0 edges\n", totface);
 		do_edge_recalc= TRUE;
 	}
 
 	for(i=0, med= medges; i<totedge; i++, med++) {
 		int remove= FALSE;
 		if(med->v1 == med->v2) {
-			PRINT("    edge %d: has matching verts, both %d\n", i, med->v1);
+			PRINT("    edge %u: has matching verts, both %u\n", i, med->v1);
 			remove= do_fixes;
 		}
 		if(med->v1 >= totvert) {
-			PRINT("    edge %d: v1 index out of range, %d\n", i, med->v1);
+			PRINT("    edge %u: v1 index out of range, %u\n", i, med->v1);
 			remove= do_fixes;
 		}
 		if(med->v2 >= totvert) {
-			PRINT("    edge %d: v2 index out of range, %d\n", i, med->v2);
+			PRINT("    edge %u: v2 index out of range, %u\n", i, med->v2);
 			remove= do_fixes;
 		}
 
 		if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) {
-			PRINT("    edge %d: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
+			PRINT("    edge %u: is a duplicate of, %u\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
 			remove= do_fixes;
 		}
 
@@ -187,41 +187,41 @@
 		do {
 			fv[fidx]= *(&(mf->v1) + fidx);
 			if(fv[fidx] >= totvert) {
-				PRINT("    face %d: 'v%d' index out of range, %d\n", i, fidx + 1, fv[fidx]);
+				PRINT("    face %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
 				remove= do_fixes;
 			}
 		} while (fidx--);
 
 		if(remove == FALSE) {
 			if(mf->v4) {
-				if(mf->v1 == mf->v2) { PRINT("    face %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; }
-				if(mf->v1 == mf->v3) { PRINT("    face %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes;  }
-				if(mf->v1 == mf->v4) { PRINT("    face %d: verts invalid, v1/v4 both %d\n", i, mf->v1); remove= do_fixes;  }
+				if(mf->v1 == mf->v2) { PRINT("    face %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
+				if(mf->v1 == mf->v3) { PRINT("    face %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes;  }
+				if(mf->v1 == mf->v4) { PRINT("    face %u: verts invalid, v1/v4 both %u\n", i, mf->v1); remove= do_fixes;  }
 
-				if(mf->v2 == mf->v3) { PRINT("    face %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes;  }
-				if(mf->v2 == mf->v4) { PRINT("    face %d: verts invalid, v2/v4 both %d\n", i, mf->v2); remove= do_fixes;  }
+				if(mf->v2 == mf->v3) { PRINT("    face %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes;  }
+				if(mf->v2 == mf->v4) { PRINT("    face %u: verts invalid, v2/v4 both %u\n", i, mf->v2); remove= do_fixes;  }
 
-				if(mf->v3 == mf->v4) { PRINT("    face %d: verts invalid, v3/v4 both %d\n", i, mf->v3); remove= do_fixes;  }
+				if(mf->v3 == mf->v4) { PRINT("    face %u: verts invalid, v3/v4 both %u\n", i, mf->v3); remove= do_fixes;  }
 			}
 			else {
-				if(mf->v1 == mf->v2) { PRINT("    faceT %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; }
-				if(mf->v1 == mf->v3) { PRINT("    faceT %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes; }
+				if(mf->v1 == mf->v2) { PRINT("    faceT %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
+				if(mf->v1 == mf->v3) { PRINT("    faceT %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
 
-				if(mf->v2 == mf->v3) { PRINT("    faceT %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes; }
+				if(mf->v2 == mf->v3) { PRINT("    faceT %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
 			}
 
 			if(remove == FALSE) {
 				if(totedge) {
 					if(mf->v4) {
-						if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT("    face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT("    face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT("    face %d: edge v3/v4 (%d,%d) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT("    face %d: edge v4/v1 (%d,%d) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; }
+						if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT("    face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
+						if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT("    face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
+						if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT("    face %u: edge v3/v4 (%u,%u) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; }
+						if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT("    face %u: edge v4/v1 (%u,%u) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; }
 					}
 					else {
-						if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT("    face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT("    face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT("    face %d: edge v3/v1 (%d,%d) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; }
+						if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT("    face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
+						if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT("    face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
+						if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT("    face %u: edge v3/v1 (%u,%u) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; }
 					}
 				}
 
@@ -261,10 +261,10 @@
 			if(do_verbose) {
 				mf_prev= mfaces + sf_prev->index;
 				if(mf->v4) {
-					PRINT("    face %d & %d: are duplicates (%d,%d,%d,%d) (%d,%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
+					PRINT("    face %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
 				}
 				else {
-					PRINT("    face %d & %d: are duplicates (%d,%d,%d) (%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3);
+					PRINT("    face %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3);
 				}
 			}
 

Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pointcache.c	2011-08-27 03:20:32 UTC (rev 39730)
+++ trunk/blender/source/blender/blenkernel/intern/pointcache.c	2011-08-27 03:25:02 UTC (rev 39731)
@@ -967,12 +967,12 @@
 
 		if(pid->cache->flag & PTCACHE_EXTERNAL) {
 			if(pid->cache->index >= 0)
-				snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+				snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
 			else
 				snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */
 		}
 		else {
-			snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+			snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
 		}
 		len += 16;
 	}
@@ -2002,7 +2002,7 @@
 			if (dir==NULL)
 				return;
 
-			snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
+			snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index);
 			
 			while ((de = readdir(dir)) != NULL) {
 				if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
@@ -2204,7 +2204,7 @@
 			if (dir==NULL)
 				return;
 
-			snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list