From 9bcdb4b758d96d1fe5345858f6c61a90f7c57eac Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 17 Jan 2009 00:51:42 +0000 Subject: 2.5: various warning fixes. --- source/blender/blenkernel/BKE_context.h | 8 ++++---- source/blender/blenkernel/intern/DerivedMesh.c | 10 +++++----- source/blender/blenkernel/intern/context.c | 10 ++++++++++ source/blender/blenkernel/intern/exotic.c | 2 +- source/blender/blenkernel/intern/modifier.c | 12 ++++++------ source/blender/blenkernel/intern/report.c | 2 +- source/blender/blenlib/intern/BLI_ghash.c | 2 +- source/blender/blenlib/intern/BLI_kdopbvh.c | 9 ++++++--- source/blender/blenlib/intern/arithb.c | 6 +++++- source/blender/blenlib/intern/fnmatch.c | 5 +---- source/blender/blenlib/intern/graph.c | 2 -- source/blender/blenlib/intern/listbase.c | 2 -- source/blender/blenlib/intern/winstuff.c | 5 +---- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/editors/animation/keyframing.c | 2 +- source/blender/editors/armature/editarmature.c | 2 +- source/blender/editors/transform/transform_conversions.c | 2 +- source/blender/imbuf/intern/cineon/cineonlib.c | 6 +++--- source/blender/imbuf/intern/cineon/dpxlib.c | 8 ++++---- 19 files changed, 52 insertions(+), 45 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index d6efc1288ec..d9988abdaab 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -127,10 +127,10 @@ void CTX_data_list_add(bContextDataResult *result, void *data); BLI_freelistN(&ctx_data_list); \ } -#define CTX_DATA_COUNT(C, member, i) \ - CTX_DATA_BEGIN(C, void*, unused, member) \ - i++; \ - CTX_DATA_END +int ctx_data_list_count(const bContext *C, int (*func)(const bContext*, ListBase*)); + +#define CTX_DATA_COUNT(C, member) \ + ctx_data_list_count(C, CTX_data_##member) /* Data Context Members */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 063a0e4a31f..2ecc8cb1754 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1635,7 +1635,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos } /* create an orco derivedmesh in parallel */ - mask= (CustomDataMask)curr->link; + mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link); if(mask & CD_MASK_ORCO) { if(!orcodm) orcodm= create_orco_dm(ob, me, NULL); @@ -1655,7 +1655,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos DM_set_only_copy(dm, mask); /* add an origspace layer if needed */ - if(((CustomDataMask)curr->link) & CD_MASK_ORIGSPACE) + if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE) if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE)) DM_add_face_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL); @@ -1847,7 +1847,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri } /* create an orco derivedmesh in parallel */ - mask= (CustomDataMask)curr->link; + mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link); if(mask & CD_MASK_ORCO) { if(!orcodm) orcodm= create_orco_dm(ob, ob->data, em); @@ -1864,9 +1864,9 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri } /* set the DerivedMesh to only copy needed data */ - DM_set_only_copy(dm, (CustomDataMask)curr->link); + DM_set_only_copy(dm, (CustomDataMask)GET_INT_FROM_POINTER(curr->link)); - if(((CustomDataMask)curr->link) & CD_MASK_ORIGSPACE) + if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE) if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE)) DM_add_face_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index ef8b922c0b3..ceac604aace 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -310,6 +310,16 @@ void CTX_data_list_add(bContextDataResult *result, void *data) BLI_addtail(&result->list, link); } +int ctx_data_list_count(const bContext *C, int (*func)(const bContext*, ListBase*)) +{ + ListBase list; + + if(func(C, &list)) + return BLI_countlist(&list); + else + return 0; +} + /* data context */ Main *CTX_data_main(const bContext *C) diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index f2bcfdb5065..9c5d67660ba 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -3329,7 +3329,7 @@ static int read_groupf(char *str) } //XXX error() is now printf until we have a callback error -#define id_test(id) if(id<0) {char errmsg[128];fclose(dxf_fp); if(id==-1) sprintf(errmsg, "Error inputting dxf, near line %d", dxf_line); else if(id==-2) sprintf(errmsg, "Error reading dxf, near line %d", dxf_line);printf(errmsg); return;} +#define id_test(id) if(id<0) {char errmsg[128];fclose(dxf_fp); if(id==-1) sprintf(errmsg, "Error inputting dxf, near line %d", dxf_line); else if(id==-2) sprintf(errmsg, "Error reading dxf, near line %d", dxf_line);printf("%s", errmsg); return;} #define read_group(id,str) {id= read_groupf(str); id_test(id);} diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index ae1247a7327..62c9699aaf9 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -8604,7 +8604,7 @@ LinkNode *modifiers_calcDataMasks(ModifierData *md, CustomDataMask dataMask) if(mti->requiredDataMask) mask = mti->requiredDataMask(md); - BLI_linklist_prepend(&dataMasks, (void *)mask); + BLI_linklist_prepend(&dataMasks, SET_INT_IN_POINTER(mask)); } /* build the list of required data masks - each mask in the list must @@ -8615,14 +8615,14 @@ LinkNode *modifiers_calcDataMasks(ModifierData *md, CustomDataMask dataMask) */ for(curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) { if(prev) { - CustomDataMask prev_mask = (CustomDataMask)prev->link; - CustomDataMask curr_mask = (CustomDataMask)curr->link; + CustomDataMask prev_mask = (CustomDataMask)GET_INT_FROM_POINTER(prev->link); + CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link); - curr->link = (void *)(curr_mask | prev_mask); + curr->link = SET_INT_IN_POINTER(curr_mask | prev_mask); } else { - CustomDataMask curr_mask = (CustomDataMask)curr->link; + CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link); - curr->link = (void *)(curr_mask | dataMask); + curr->link = SET_INT_IN_POINTER(curr_mask | dataMask); } } diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index 89496fda701..116fd069948 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -245,7 +245,7 @@ void BKE_reports_print(ReportList *reports, ReportType level) if (cstring == NULL) return; - printf(cstring); + printf("%s", cstring); fflush(stdout); MEM_freeN(cstring); } diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 1967b8a88e2..80cd507520c 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -253,7 +253,7 @@ int BLI_ghashIterator_isDone(GHashIterator *ghi) { /***/ unsigned int BLI_ghashutil_ptrhash(void *key) { - return (unsigned int) key; + return (unsigned int)(intptr_t)key; } int BLI_ghashutil_ptrcmp(void *a, void *b) { if (a==b) diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 30472beb3e6..0f8194362c9 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -478,6 +478,7 @@ static void node_join(BVHTree *tree, BVHNode *node) /* * Debug and information functions */ +#if 0 static void bvhtree_print_tree(BVHTree *tree, BVHNode *node, int depth) { int i; @@ -509,6 +510,7 @@ static void bvhtree_info(BVHTree *tree) // bvhtree_print_tree(tree, tree->nodes[tree->totleaf], 0); } +#endif #if 0 @@ -1238,7 +1240,7 @@ static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node) int i; float nearest[3]; - if(data->proj[ node->main_axis ] <= node->children[0]->bv[node->main_axis*2+1]) + if(data->proj[ (int)node->main_axis ] <= node->children[0]->bv[(int)node->main_axis*2+1]) { for(i=0; i != node->totnode; i++) @@ -1267,6 +1269,7 @@ static void dfs_find_nearest_begin(BVHNearestData *data, BVHNode *node) } +#if 0 static void NodeDistance_push_heap(NodeDistance *heap, int heap_size) PUSH_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size) @@ -1350,7 +1353,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node) if(heap != default_heap) free(heap); } - +#endif int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata) { @@ -1463,7 +1466,7 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node) else { //pick loop direction to dive into the tree (based on ray direction and split axis) - if(data->ray_dot_axis[ node->main_axis ] > 0.0f) + if(data->ray_dot_axis[ (int)node->main_axis ] > 0.0f) { for(i=0; i != node->totnode; i++) { diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index 4d555a009c5..a21252d9aa8 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -4263,6 +4263,7 @@ float lambda_cp_line_ex(float p[3], float l1[3], float l2[3], float cp[3]) return lambda; } +#if 0 /* little sister we only need to know lambda */ static float lambda_cp_line(float p[3], float l1[3], float l2[3]) { @@ -4271,6 +4272,7 @@ static float lambda_cp_line(float p[3], float l1[3], float l2[3]) VecSubf(h, p, l1); return(Inpf(u,h)/Inpf(u,u)); } +#endif /* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */ void PointInQuad2DUV(float v0[2], float v1[2], float v2[2], float v3[2], float pt[2], float *uv) @@ -4423,7 +4425,7 @@ int IsPointInTri2D(float v0[2], float v1[2], float v2[2], float pt[2]) Vec2Copyf(v2_3d, v2); /* Doing this in 3D is not nice */ - return LineIntersectsTriangle(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, &uv); + return LineIntersectsTriangle(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, uv); } /* @@ -4505,6 +4507,7 @@ but see a 'spat' which is a deformed cube with paired parallel planes needs only return 1; } +#if 0 /*adult sister defining the slice planes by the origin and the normal NOTE |normal| may not be 1 but defining the thickness of the slice*/ static int point_in_slice_as(float p[3],float origin[3],float normal[3]) @@ -4525,6 +4528,7 @@ static int point_in_slice_m(float p[3],float origin[3],float normal[3],float lns if (h < 0.0f || h > 1.0f) return 0; return 1; } +#endif int point_in_tri_prism(float p[3], float v1[3], float v2[3], float v3[3]) diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c index 54114ad3448..32065283bd0 100644 --- a/source/blender/blenlib/intern/fnmatch.c +++ b/source/blender/blenlib/intern/fnmatch.c @@ -240,10 +240,7 @@ fnmatch (const char *pattern, const char *string, int flags) #else -static void BLI_FNMATCH_C_IS_EMPTY_FOR_UNIX(void) -{ - /*intentionally empty*/ -} +/* intentionally empty for UNIX */ #endif /* WIN32 */ diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index 8f35b38379e..03a565ef0bf 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -465,8 +465,6 @@ int subtreeShape(BNode *node, BArc *rootArc, int include_root) int BLI_subtreeShape(BGraph *graph, BNode *node, BArc *rootArc, int include_root) { - BNode *test_node; - BLI_flagNodes(graph, 0); return subtreeShape(node, rootArc, include_root); } diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 774e72091c0..e0fd5c37494 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -43,8 +43,6 @@ #include "BLI_listbase.h" -static int add_win32_extension(char *name); - /* implementation */ /* Ripped this from blender.c */ diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 666a54b54cc..2f96f7b6af1 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -219,9 +219,6 @@ int check_file_chars(char *filename) #else -static void BLI_WINSTUFF_C_IS_EMPTY_FOR_UNIX(void) -{ - /*intentionally empty*/ -} +/* intentionally empty for UNIX */ #endif diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index c0d873ed6b0..8e5b7ff06ed 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5366,7 +5366,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) } case SPACE_FILE: { - SpaceFile *sfile= (SpaceFile *)sl; + // SpaceFile *sfile= (SpaceFile *)sl; ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0; ar->v2d.tot.xmax = ar->winx; ar->v2d.tot.ymax = ar->winy; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 2cd2db3237a..5121932d0cc 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1416,7 +1416,7 @@ static short incl_v3d_ob_shapekey (bKeyingSet *ks, const char mode[]) /* if ks is shapekey entry (this could be callled for separator before too!) */ if (ks->flag == -3) - sprintf(ks->name, newname); + BLI_strncpy(ks->name, newname, sizeof(ks->name)); /* if it gets here, it's ok */ return 1; diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 54da3901a59..5548700b2e1 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -747,7 +747,7 @@ int join_armature(Scene *scene, View3D *v3d) joined_armature_fix_links(ob, base->object, pchan, curbone); /* Rename pchan */ - sprintf(pchan->name, curbone->name); + BLI_strncpy(pchan->name, curbone->name, sizeof(pchan->name)); /* Jump Ship! */ BLI_remlink(curarm->edbo, curbone); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 783636e3fdd..d69f318aa3f 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4153,7 +4153,7 @@ void createTransNodeData(bContext *C, TransInfo *t) TransData *td; TransData2D *td2d; - CTX_DATA_COUNT(C, selected_nodes, t->total) + t->total= CTX_DATA_COUNT(C, selected_nodes); td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransNode TransData"); td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransNode TransData2D"); diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 75516bbf3ae..85b7ef0d5e9 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -558,7 +558,7 @@ cineonOpen(const char* filename) { cineon->pixelBuffer = malloc(cineon->lineBufferLength * 3 * sizeof(unsigned short)); if (cineon->pixelBuffer == 0) { if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n", - (cineon->width * cineon->depth) * sizeof(unsigned short)); + (cineon->width * cineon->depth) * (int)sizeof(unsigned short)); cineonClose(cineon); return 0; } @@ -658,7 +658,7 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) { cineon->pixelBuffer = malloc(cineon->lineBufferLength * 3 * sizeof(unsigned short)); if (cineon->pixelBuffer == 0) { if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n", - (cineon->width * cineon->depth) * sizeof(unsigned short)); + (cineon->width * cineon->depth) * (int)sizeof(unsigned short)); cineonClose(cineon); return 0; } @@ -744,7 +744,7 @@ cineonCreate(const char* filename, int width, int height, int depth) { cineon->pixelBuffer = malloc(cineon->lineBufferLength * 3 * sizeof(unsigned short)); if (cineon->pixelBuffer == 0) { if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n", - (cineon->width * cineon->depth) * sizeof(unsigned short)); + (cineon->width * cineon->depth) * (int)sizeof(unsigned short)); cineonClose(cineon); return 0; } diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index 8a9adc73cdc..7314e82a132 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -240,7 +240,7 @@ dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y) { /* read enough longwords */ readLongs = pixelsToLongs(numPixels - dpx->pixelBufferUsed); if (logimage_fread(dpx->lineBuffer, 4, readLongs, dpx) != readLongs) { - if (verbose) d_printf("Couldn't read line %d length %d\n", y, readLongs * 4); + if (verbose) d_printf("Couldn't read line %d length %d\n", y, (int)readLongs * 4); return 1; } ++dpx->fileYPos; @@ -352,7 +352,7 @@ dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y) { /* write them */ if (fwrite(dpx->lineBuffer, 4, writeLongs, dpx->file) != writeLongs) { - if (verbose) d_printf("Couldn't write line %d length %d\n", y, writeLongs * 4); + if (verbose) d_printf("Couldn't write line %d length %d\n", y, (int)writeLongs * 4); return 1; } ++dpx->fileYPos; @@ -462,7 +462,7 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) { dpx->pixelBuffer = malloc((dpx->lineBufferLength * 3 + 2) * sizeof(unsigned short)); if (dpx->pixelBuffer == 0) { if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n", - (dpx->width * dpx->depth + 2 + 2) * sizeof(unsigned short)); + (dpx->width * dpx->depth + 2 + 2) * (int)sizeof(unsigned short)); dpxClose(dpx); return 0; } @@ -574,7 +574,7 @@ dpxCreate(const char* filename, int width, int height, int depth) { dpx->pixelBuffer = malloc((dpx->lineBufferLength * 3 + 2) * sizeof(unsigned short)); if (dpx->pixelBuffer == 0) { if (verbose) d_printf("Couldn't malloc pixel buffer of size %d\n", - (dpx->width * dpx->depth + 2 + 2) * sizeof(unsigned short)); + (dpx->width * dpx->depth + 2 + 2) * (int)sizeof(unsigned short)); dpxClose(dpx); return 0; } -- cgit v1.2.3