From 0955c664aa7c5fc5f0bd345c58219c40f04ab9c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 13 Feb 2011 10:52:18 +0000 Subject: fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions. - use NULL rather then 0 where possible (makes code & function calls more readable IMHO). - set static variables and functions (exposed some unused vars/funcs). - use func(void) rather then func() for definitions. --- source/blender/blenkernel/intern/font.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'source/blender/blenkernel/intern/font.c') diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 9de8af2c981..bf0427e4fee 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -208,7 +208,7 @@ int utf8towchar(wchar_t *w, char *c) /* The vfont code */ void free_vfont(struct VFont *vf) { - if (vf == 0) return; + if (vf == NULL) return; if (vf->data) { while(vf->data->characters.first) @@ -476,7 +476,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i nu2->flagu = CU_NURB_CYCLIC; bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp"); - if (bp == 0){ + if (bp == NULL){ MEM_freeN(nu2); return; } @@ -544,10 +544,10 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float bezt1 = nu1->bezt; if (bezt1){ nu2 =(Nurb*) MEM_mallocN(sizeof(Nurb),"duplichar_nurb"); - if (nu2 == 0) break; + if (nu2 == NULL) break; memcpy(nu2, nu1, sizeof(struct Nurb)); nu2->resolu= cu->resolu; - nu2->bp = 0; + nu2->bp = NULL; nu2->knotsu = nu2->knotsv = NULL; nu2->flag= CU_SMOOTH; nu2->charidx = charidx; @@ -562,7 +562,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float i = nu2->pntsu; bezt2 = (BezTriple*)MEM_mallocN(i * sizeof(BezTriple),"duplichar_bezt2"); - if (bezt2 == 0){ + if (bezt2 == NULL){ MEM_freeN(nu2); break; } @@ -686,14 +686,14 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) /* renark: do calculations including the trailing '\0' of a string because the cursor can be at that location */ - if(ob->type!=OB_FONT) return 0; + if(ob->type!=OB_FONT) return NULL; // Set font data cu= (Curve *) ob->data; vfont= cu->vfont; - if(cu->str == NULL) return 0; - if(vfont == NULL) return 0; + if(cu->str == NULL) return NULL; + if(vfont == NULL) return NULL; // Create unicode string utf8len = utf8slen(cu->str); @@ -723,7 +723,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if(!vfd) { if(mem) MEM_freeN(mem); - return 0; + return NULL; } /* calc offset and rotation of each char */ @@ -787,11 +787,11 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) che= find_vfont_char(vfd, ascii); /* No VFont found */ - if (vfont==0) { + if (vfont==NULL) { if(mem) MEM_freeN(mem); MEM_freeN(chartransdata); - return 0; + return NULL; } if (vfont != oldvfont) { @@ -804,7 +804,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if(mem) MEM_freeN(mem); MEM_freeN(chartransdata); - return 0; + return NULL; } twidth = char_width(cu, che, info); @@ -1219,7 +1219,5 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) MEM_freeN(mem); MEM_freeN(chartransdata); - return 0; + return NULL; } - - -- cgit v1.2.3