Code cleanup: quiet warnings & style

This commit is contained in:
2014-04-13 11:26:31 +10:00
parent a2b3c93852
commit 2025e4cbb9
6 changed files with 19 additions and 12 deletions

View File

@@ -543,7 +543,9 @@ static void edge_queue_insert(EdgeQueueContext *eq_ctx, BMEdge *e,
* that topology updates will also happen less frequent, that should be * that topology updates will also happen less frequent, that should be
* enough. */ * enough. */
if ((check_mask(eq_ctx, e->v1) || check_mask(eq_ctx, e->v2)) && if ((check_mask(eq_ctx, e->v1) || check_mask(eq_ctx, e->v2)) &&
!(BM_elem_flag_test_bool(e->v1, BM_ELEM_HIDDEN) || BM_elem_flag_test_bool(e->v2, BM_ELEM_HIDDEN))) { !(BM_elem_flag_test_bool(e->v1, BM_ELEM_HIDDEN) ||
BM_elem_flag_test_bool(e->v2, BM_ELEM_HIDDEN)))
{
pair = BLI_mempool_alloc(eq_ctx->pool); pair = BLI_mempool_alloc(eq_ctx->pool);
pair[0] = e->v1; pair[0] = e->v1;
pair[1] = e->v2; pair[1] = e->v2;

View File

@@ -1493,7 +1493,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
idname = (pid->ob->id.name + 2); idname = (pid->ob->id.name + 2);
/* convert chars to hex so they are always a valid filename */ /* convert chars to hex so they are always a valid filename */
while ('\0' != *idname) { while ('\0' != *idname) {
BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++)); BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (unsigned int)(*idname++));
newname+=2; newname+=2;
len += 2; len += 2;
} }

View File

@@ -211,8 +211,10 @@
} (void)0 } (void)0
#define FTOCHAR(val) (char)(((val) <= 0.0f) ? 0 : (((val) > (1.0f - 0.5f / 255.0f)) ? 255 : ((255.0f * (val)) + 0.5f))) #define FTOCHAR(val) ((CHECK_TYPE_INLINE(val, float)), \
#define FTOUSHORT(val) ((val >= 1.0f - 0.5f / 65535) ? 65535 : (val <= 0.0f) ? 0 : (unsigned short)(val * 65535.0f + 0.5f)) (char)(((val) <= 0.0f) ? 0 : (((val) > (1.0f - 0.5f / 255.0f)) ? 255 : ((255.0f * (val)) + 0.5f))))
#define FTOUSHORT(val) ((CHECK_TYPE_INLINE(val, float)), \
((val >= 1.0f - 0.5f / 65535) ? 65535 : (val <= 0.0f) ? 0 : (unsigned short)(val * 65535.0f + 0.5f)))
#define USHORTTOUCHAR(val) ((unsigned char)(((val) >= 65535 - 128) ? 255 : ((val) + 128) >> 8)) #define USHORTTOUCHAR(val) ((unsigned char)(((val) >= 65535 - 128) ? 255 : ((val) + 128) >> 8))
#define F3TOCHAR3(v2, v1) { \ #define F3TOCHAR3(v2, v1) { \
(v1)[0] = FTOCHAR((v2[0])); \ (v1)[0] = FTOCHAR((v2[0])); \

View File

@@ -361,7 +361,7 @@ static void bli_adddirstrings(struct BuildDirCtx *dir_ctx)
BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner)); BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
} }
else { else {
BLI_snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid); BLI_snprintf(file->owner, sizeof(file->owner), "%u", file->s.st_uid);
} }
} }
#endif #endif

View File

@@ -3021,7 +3021,7 @@ void uiLayoutContextCopy(uiLayout *layout, bContextStore *context)
static void ui_intro_button(DynStr *ds, uiButtonItem *bitem) static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
{ {
uiBut *but = bitem->but; uiBut *but = bitem->but;
BLI_dynstr_appendf(ds, "'type':%d, ", but->type); /* see ~ UI_interface.h:200 */ BLI_dynstr_appendf(ds, "'type':%d, ", (int)but->type);
BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr); BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr);
BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); /* not exactly needed, rna has this */ BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); /* not exactly needed, rna has this */

View File

@@ -1684,6 +1684,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3], bool is
} }
else if (strcmp(bt->str, "Hex: ") == 0) { else if (strcmp(bt->str, "Hex: ") == 0) {
float rgb_gamma[3]; float rgb_gamma[3];
unsigned char rgb_gamma_uchar[3];
double intpart; double intpart;
char col[16]; char col[16];
@@ -1700,8 +1701,8 @@ static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3], bool is
if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart); if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart);
if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart);
BLI_snprintf(col, sizeof(col), "%02X%02X%02X", rgb_float_to_uchar(rgb_gamma_uchar, rgb_gamma);
FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); BLI_snprintf(col, sizeof(col), "%02X%02X%02X", UNPACK3OP((unsigned int), rgb_gamma_uchar));
strcpy(bt->poin, col); strcpy(bt->poin, col);
} }
@@ -1883,6 +1884,7 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
static char tip[50]; static char tip[50];
static char hexcol[128]; static char hexcol[128];
float rgb_gamma[3]; float rgb_gamma[3];
unsigned char rgb_gamma_uchar[3];
float softmin, softmax, hardmin, hardmax, step, precision; float softmin, softmax, hardmin, hardmax, step, precision;
float *hsv = ui_block_hsv_get(block); float *hsv = ui_block_hsv_get(block);
int yco; int yco;
@@ -1987,7 +1989,8 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
rgba[3] = 1.0f; rgba[3] = 1.0f;
} }
BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); rgb_float_to_uchar(rgb_gamma_uchar, rgb_gamma);
BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", UNPACK3OP((unsigned int), rgb_gamma_uchar));
yco = -3.0f * UI_UNIT_Y; yco = -3.0f * UI_UNIT_Y;
bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)")); bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));