From c96f28a718b0c94b52781cc91d384d2aeedf8c02 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 27 Aug 2011 03:25:02 +0000 Subject: [PATCH] - use %u rather tham %d for unsigned ints in string formatting funcs. - replace (strlen(str) == 0) with str[0]=='\0' --- intern/itasc/kdl/frames_io.cpp | 6 +-- .../blender/blenkernel/intern/mesh_validate.c | 52 +++++++++---------- source/blender/blenkernel/intern/pointcache.c | 10 ++-- .../blender/blenloader/intern/readblenentry.c | 2 +- source/blender/blenloader/intern/readfile.c | 6 +-- .../blender/editors/animation/anim_markers.c | 2 +- .../blender/editors/animation/fmodifier_ui.c | 2 +- .../blender/editors/object/object_modifier.c | 2 +- source/blender/gpu/intern/gpu_codegen.c | 2 +- .../imbuf/intern/dds/DirectDrawSurface.cpp | 16 +++--- source/blender/imbuf/intern/tiff.c | 2 +- source/blender/makesrna/intern/makesrna.c | 34 ++++++------ source/blender/makesrna/intern/rna_define.c | 2 +- .../GameLogic/SCA_RandomActuator.cpp | 2 +- source/gameengine/VideoTexture/Exception.cpp | 2 +- 15 files changed, 71 insertions(+), 71 deletions(-) diff --git a/intern/itasc/kdl/frames_io.cpp b/intern/itasc/kdl/frames_io.cpp index d84e95c766b..3db0790cabf 100644 --- a/intern/itasc/kdl/frames_io.cpp +++ b/intern/itasc/kdl/frames_io.cpp @@ -133,7 +133,7 @@ std::istream& operator >> (std::istream& is,Vector& v) { 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 @@ std::istream& operator >> (std::istream& is,Rotation& r) { 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 @@ std::istream& operator >> (std::istream& is,Frame& T) { 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; diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 34618a19ae9..9c916d517c5 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -80,7 +80,7 @@ static void edge_store_from_mface_quad(EdgeUUID es[4], MFace *mf) 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 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve 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; iv1 == 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 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve 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 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve 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); } } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index b8f4b2d302f..0f0afe30392 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -967,12 +967,12 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p 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 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) 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 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra 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?*/ @@ -2904,7 +2904,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) return; } - snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index); + snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); /* put new name into cache */ strcpy(pid->cache->name, to); diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 4ce5685ff18..31b3724e9f6 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -115,7 +115,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) buf[2]= buf[2]?buf[2]:' '; buf[3]= buf[3]?buf[3]:' '; - fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (long int)bhead->len+sizeof(BHead)); + fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (long int)(bhead->len+sizeof(BHead))); } } fprintf(fp, "]\n"); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0e99b357054..f3b478b90f9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10063,7 +10063,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) * to have them show in RNA viewer and accessible otherwise. */ for(ma= main->mat.first; ma; ma= ma->id.next) { - if(ma->nodetree && strlen(ma->nodetree->id.name)==0) + if(ma->nodetree && ma->nodetree->id.name[0] == '\0') strcpy(ma->nodetree->id.name, "NTShader Nodetree"); /* which_output 0 is now "not specified" */ @@ -10077,7 +10077,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } /* and composit trees */ for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->nodetree && strlen(sce->nodetree->id.name)==0) + if(sce->nodetree && sce->nodetree->id.name[0] == '\0') strcpy(sce->nodetree->id.name, "NTCompositing Nodetree"); /* move to cameras */ @@ -10099,7 +10099,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bNode *node; if(tx->nodetree) { - if(strlen(tx->nodetree->id.name)==0) + if(tx->nodetree->id.name[0] == '\0') strcpy(tx->nodetree->id.name, "NTTexture Nodetree"); /* which_output 0 is now "not specified" */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index b3338396598..f561bdc6183 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -339,7 +339,7 @@ void debug_markers_print_list(ListBase *markers) printf("List of markers follows: -----\n"); for (marker = markers->first; marker; marker = marker->next) { - printf("\t'%s' on %d at %p with %d\n", marker->name, marker->frame, (void *)marker, marker->flag); + printf("\t'%s' on %d at %p with %u\n", marker->name, marker->frame, (void *)marker, marker->flag); } printf("End of list ------------------\n"); diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 954928fc486..718188d5800 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -162,7 +162,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s if (i == 1) strcpy(xval, "x"); else - sprintf(xval, "x^%d", i); + sprintf(xval, "x^%u", i); uiDefBut(block, LABEL, 1, xval, 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "Power of x"); } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 2ac9161ffa3..c96d7c1fd10 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1280,7 +1280,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if(mmd->bindcagecos) { - if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos); + MEM_freeN(mmd->bindcagecos); if(mmd->dyngrid) MEM_freeN(mmd->dyngrid); if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences); if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 470b99de00b..910576fa34e 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -291,7 +291,7 @@ static void gpu_parse_functions_string(GHash *hash, char *code) } } - if(strlen(function->name) == 0 || function->totparam == 0) { + if(function->name[0] == '\0' || function->totparam == 0) { fprintf(stderr, "GPU functions parse error.\n"); MEM_freeN(function); break; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 971658ff482..44e029bd7ce 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -1426,12 +1426,12 @@ void DirectDrawSurface::printInfo() const if (header.flags & DDSD_LINEARSIZE) printf("\tDDSD_LINEARSIZE\n"); if (header.flags & DDSD_MIPMAPCOUNT) printf("\tDDSD_MIPMAPCOUNT\n"); - printf("Height: %d\n", header.height); - printf("Width: %d\n", header.width); - printf("Depth: %d\n", header.depth); - if (header.flags & DDSD_PITCH) printf("Pitch: %d\n", header.pitch); - else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %d\n", header.pitch); - printf("Mipmap count: %d\n", header.mipmapcount); + printf("Height: %u\n", header.height); + printf("Width: %u\n", header.width); + printf("Depth: %u\n", header.depth); + if (header.flags & DDSD_PITCH) printf("Pitch: %u\n", header.pitch); + else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %u\n", header.pitch); + printf("Mipmap count: %u\n", header.mipmapcount); printf("Pixel Format:\n"); printf("\tFlags: 0x%.8X\n", header.pf.flags); @@ -1468,7 +1468,7 @@ void DirectDrawSurface::printInfo() const } else { - printf("\tBit count: %d\n", header.pf.bitcount); + printf("\tBit count: %u\n", header.pf.bitcount); } printf("\tRed mask: 0x%.8X\n", header.pf.rmask); @@ -1522,7 +1522,7 @@ void DirectDrawSurface::printInfo() const if (header.reserved[7] == FOURCC_UVER) { - printf("User Version: %d\n", header.reserved[8]); + printf("User Version: %u\n", header.reserved[8]); } } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 36130aa0dbf..7beb853fe62 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -646,7 +646,7 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int } } else - printf("imb_loadtiff: mipmap level %d has unexpected size %dx%d instead of %dx%d\n", ibuf->miplevel, width, height, ibuf->x, ibuf->y); + printf("imb_loadtiff: mipmap level %d has unexpected size %ux%u instead of %dx%d\n", ibuf->miplevel, width, height, ibuf->x, ibuf->y); } else printf("imb_loadtiff: could not find mipmap level %d\n", ibuf->miplevel); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 7da538e171b..d47abced85e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -569,7 +569,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(prop->flag & PROP_DYNAMIC) fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop)); else - fprintf(f, "void %s(PointerRNA *ptr, %s values[%d])\n", func, rna_type_type(prop), prop->totarraylength); + fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength); fprintf(f, "{\n"); if(manualfunc) { @@ -587,7 +587,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr } else { fprintf(f, " int i;\n\n"); - fprintf(f, " for(i=0; i<%d; i++) {\n", prop->totarraylength); + fprintf(f, " for(i=0; i<%u; i++) {\n", prop->totarraylength); } if(dp->dnaarraylength == 1) { @@ -783,7 +783,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(prop->flag & PROP_DYNAMIC) fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop)); else - fprintf(f, "void %s(PointerRNA *ptr, const %s values[%d])\n", func, rna_type_type(prop), prop->totarraylength); + fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength); fprintf(f, "{\n"); if(manualfunc) { @@ -803,7 +803,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr else { fprintf(f, " int i;\n\n"); rna_clamp_value_range(f, prop); - fprintf(f, " for(i=0; i<%d; i++) {\n", prop->totarraylength); + fprintf(f, " for(i=0; i<%u; i++) {\n", prop->totarraylength); } if(dp->dnaarraylength == 1) { @@ -1324,7 +1324,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR //fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func); } else if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "void %sget(PointerRNA *ptr, int values[%d]);\n", func, prop->totarraylength); + fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength); //fprintf(f, "void %sset(PointerRNA *ptr, const int values[%d]);\n", func, prop->arraylength); } else { @@ -1339,7 +1339,7 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR //fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func); } else if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "void %sget(PointerRNA *ptr, float values[%d]);\n", func, prop->totarraylength); + fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength); //fprintf(f, "void %sset(PointerRNA *ptr, const float values[%d]);\n", func, prop->arraylength); } else { @@ -1420,21 +1420,21 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property if(!prop->arraydimension) fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier)); else - fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline Array %s(void);", prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_ENUM: { @@ -1495,21 +1495,21 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe if(!prop->arraydimension) fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_INT: { if(!prop->arraydimension) fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_FLOAT: { if(!prop->arraydimension) fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); else - fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %d, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); break; } case PROP_ENUM: { @@ -2028,7 +2028,7 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier); if(!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension) - fprintf(f, "%s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength); + fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength); else fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier); @@ -2129,7 +2129,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); + fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for(i=0; itotarraylength; i++) { if(bprop->defaultarray) @@ -2149,7 +2149,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); + fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for(i=0; itotarraylength; i++) { if(iprop->defaultarray) @@ -2169,7 +2169,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if(prop->arraydimension && prop->totarraylength) { - fprintf(f, "static float rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); + fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for(i=0; itotarraylength; i++) { if(fprop->defaultarray) @@ -2200,7 +2200,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_print_c_string(f, prop->name); fprintf(f, ",\n\t"); rna_print_c_string(f, prop->description); fprintf(f, ",\n\t"); fprintf(f, "%d,\n", prop->icon); - fprintf(f, "\t%s, %s|%s, %s, %d, {%d, %d, %d}, %d,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength); + fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength); fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable)); if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 8e9c7e287d6..758ddc9ac6a 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1049,7 +1049,7 @@ void RNA_def_property_array(PropertyRNA *prop, int length) } if(prop->arraydimension > 1) { - fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array dimensions has been set to %d but would be overwritten as 1.\n", srna->identifier, prop->identifier, prop->arraydimension); + fprintf(stderr, "RNA_def_property_array: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n", srna->identifier, prop->identifier, prop->arraydimension); DefRNA.error= 1; return; } diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 3a6b00198e1..d76f3f775a5 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -152,7 +152,7 @@ bool SCA_RandomActuator::Update() /* If x_1, x_2, ... is a sequence of random numbers with uniform */ /* distribution between zero and one, k is the first integer for */ /* which the product x_1*x_2*...*x_k < exp(-\lamba). */ - float a = 0.0, b = 0.0; + float a, b; int res = 0; /* The - sign is important here! The number to test for, a, must be */ /* between 0 and 1. */ diff --git a/source/gameengine/VideoTexture/Exception.cpp b/source/gameengine/VideoTexture/Exception.cpp index 8c8258585a5..fc316f1c3f0 100644 --- a/source/gameengine/VideoTexture/Exception.cpp +++ b/source/gameengine/VideoTexture/Exception.cpp @@ -105,7 +105,7 @@ Exception::Exception (ExceptionID & expID, RESULT rslt, const char * fil, int li : m_expID (&expID), m_hRslt (rslt) { // set file and line - if (strlen(fil) > 0 || lin > 0) + if (fil[0] != '\0' || lin > 0) setFileLine (fil, lin); }