quiet some clang warnings & fix for bugs in exceptional cases.

- ghost C api, BLI_get_folder_version() could assign garbage values.
- pointcache ptcache_find_frames_around() had a superfluous NULL check which would have crashed anyway if actually NULL.
This commit is contained in:
Campbell Barton 2011-04-23 12:57:03 +00:00
parent 7f56023e9b
commit d6d2f09dd9
8 changed files with 16 additions and 7 deletions

@ -403,7 +403,7 @@ GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_TSuccess result;
bool isdown;
bool isdown= false;
result = system->getModifierKeyState(mask, isdown);
*isDown = (int) isdown;
@ -419,7 +419,7 @@ GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_TSuccess result;
bool isdown;
bool isdown= false;
result = system->getButtonState(mask, isdown);
*isDown = (int) isdown;

@ -1373,11 +1373,13 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
while(pm->next && pm->next->frame < frame)
pm= pm->next;
if(pm2 && pm2->frame < frame)
if(pm2->frame < frame) {
pm2 = NULL;
}
else {
while(pm2->prev && pm2->prev->frame > frame)
while(pm2->prev && pm2->prev->frame > frame) {
pm2= pm2->prev;
}
}
if(pm && !pm2) {

@ -1144,6 +1144,8 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check)
ok= get_path_system(path, NULL, NULL, NULL, ver);
break;
default:
path[0]= '\0'; /* incase do_check is false */
ok= FALSE;
BLI_assert(!"incorrect ID");
}

@ -3224,7 +3224,7 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
View2D *v2d= &ac->ar->v2d;
float y, ymid, ytext;
float y, ymid /*, ytext*/;
short offset;
/* sanity checks - don't draw anything */
@ -3243,7 +3243,7 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b
y= (ymaxc - yminc)/2 + yminc;
ymid= y - 7;
/* y-coordinates for text is only 4 down from middle */
ytext= y - 4;
/* ytext= y - 4; */
/* no button backdrop behind icons */
uiBlockSetEmboss(block, UI_EMBOSSN);

@ -2093,6 +2093,8 @@ void ui_check_but(uiBut *but)
str= strcat(str, "Alt ");
if(but->modifier_key & KM_OSKEY)
str= strcat(str, "Cmd ");
(void)str; /* UNUSED */
}
else
strcat(but->drawstr, "Press a key ");

@ -2326,6 +2326,7 @@ static void confirm_operator(bContext *C, wmOperator *op, const char *title, con
s= buf;
if (title) s+= sprintf(s, "%s%%t|%s", title, item);
(void)s;
handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);

@ -332,6 +332,8 @@ void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y,
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
(void)dx;
}
/* image drawing */

@ -313,7 +313,7 @@ static char *view3d_modeselect_pup(Scene *scene)
if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) {
str += sprintf(str, formatstr, "Particle Mode", OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
}
(void)str;
return (string);
}