From a2e10608626a9b3bd8a17cf4264a54ce2f03ed6f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 27 Nov 2011 23:41:01 +0000 Subject: [PATCH] quiet some warnings and logical errors. - curve map insert point had a nested loop which used the same value to index different arrays. - dynamic paint used ternary operator where both outcomes were the same. --- source/blender/blenkernel/intern/dynamicpaint.c | 6 +++--- source/blender/editors/interface/interface_handlers.c | 8 ++++++-- source/blender/makesdna/intern/makesdna.c | 5 +++-- source/blender/modifiers/intern/MOD_fluidsim_util.c | 1 + 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 519ac1cf534..a6ca7fcab36 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1693,7 +1693,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData } /* apply weights into a vertex group, if doesnt exists add a new layer */ - if (defgrp_index >= 0 && !dvert && strlen(surface->output_name)>0) + if (defgrp_index >= 0 && !dvert && (surface->output_name[0] != '\0')) dvert = CustomData_add_layer_named(&result->vertData, CD_MDEFORMVERT, CD_CALLOC, NULL, sData->total_points, surface->output_name); if (defgrp_index >= 0 && dvert) { @@ -2282,10 +2282,10 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) tPoint->quad = (isInside == 2) ? 1 : 0; /* quad or tri part*/ /* save vertex indexes */ - tPoint->v1 = (isInside == 2) ? mface[i].v1 : mface[i].v1; + tPoint->v1 = mface[i].v1; /* (isInside == 2) ? mface[i].v1 : mface[i].v1; */ /* same! */ tPoint->v2 = (isInside == 2) ? mface[i].v3 : mface[i].v2; tPoint->v3 = (isInside == 2) ? mface[i].v4 : mface[i].v3; - + sample = 5; /* make sure we exit sample loop as well */ break; } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index cd3243bb9dc..c24d07f73b9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3795,6 +3795,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt } if (sel == -1) { + int i; + /* if the click didn't select anything, check if it's clicked on the * curve itself, and if so, add a point */ fx= ((float)mx - but->x1)/zoomx + offsx; @@ -3804,8 +3806,10 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt /* loop through the curve segment table and find what's near the mouse. * 0.05 is kinda arbitrary, but seems to be what works nicely. */ - for(a=0; a<=CM_TABLE; a++) { - if ( ( fabs(fx - cmp[a].x) < (0.05) ) && ( fabs(fy - cmp[a].y) < (0.05) ) ) { + for(i=0; i<=CM_TABLE; i++) { + if ( (fabsf(fx - cmp[i].x) < 0.05f) && + (fabsf(fy - cmp[i].y) < 0.05f)) + { curvemap_insert(cuma, fx, fy); curvemapping_changed(cumap, 0); diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 64893420db4..b9bd2c073bf 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -309,8 +309,9 @@ static int add_name(const char *str) if (debugSDNA > 3) printf("seen %c ( %d) \n", str[j], str[j]); j++; } - if (debugSDNA > 3) printf("seen %c ( %d) \n", str[j], str[j]); - if (debugSDNA > 3) printf("special after offset %d\n", j); + if (debugSDNA > 3) printf("seen %c ( %d) \n" + "special after offset%d\n", + str[j], str[j], j); if (!isfuncptr) { /* multidimensional array pointer case */ diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 8696bd12502..6541b15f66e 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -572,6 +572,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, /* unused */ (void)fluidmd; (void)scene; + (void)ob; (void)dm; (void)useRenderParams; return NULL;