Code cleanup: quiet warnings & style

This commit is contained in:
Campbell Barton 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
* enough. */
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[0] = e->v1;
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);
/* convert chars to hex so they are always a valid filename */
while ('\0' != *idname) {
BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (unsigned int)(*idname++));
newname+=2;
len += 2;
}

View File

@ -211,8 +211,10 @@
} (void)0
#define FTOCHAR(val) (char)(((val) <= 0.0f) ? 0 : (((val) > (1.0f - 0.5f / 255.0f)) ? 255 : ((255.0f * (val)) + 0.5f)))
#define FTOUSHORT(val) ((val >= 1.0f - 0.5f / 65535) ? 65535 : (val <= 0.0f) ? 0 : (unsigned short)(val * 65535.0f + 0.5f))
#define FTOCHAR(val) ((CHECK_TYPE_INLINE(val, float)), \
(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 F3TOCHAR3(v2, v1) { \
(v1)[0] = FTOCHAR((v2[0])); \
@ -260,9 +262,9 @@
*(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (fac); \
} (void)0
#define VECMADD(v1, v2, v3, v4) { \
*(v1) = *(v2) + *(v3) * (*(v4)); \
*(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (*(v4 + 1)); \
*(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (*(v4 + 2)); \
*(v1) = *(v2) + *(v3) * (*(v4)); \
*(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (*(v4 + 1)); \
*(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (*(v4 + 2)); \
} (void)0
#define VECSUBFAC(v1, v2, v3, fac) { \
*(v1) = *(v2) - *(v3) * (fac); \

View File

@ -361,7 +361,7 @@ static void bli_adddirstrings(struct BuildDirCtx *dir_ctx)
BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
}
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

View File

@ -3021,7 +3021,7 @@ void uiLayoutContextCopy(uiLayout *layout, bContextStore *context)
static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
{
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, "'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) {
float rgb_gamma[3];
unsigned char rgb_gamma_uchar[3];
double intpart;
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[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart);
BLI_snprintf(col, sizeof(col), "%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(col, sizeof(col), "%02X%02X%02X", UNPACK3OP((unsigned int), rgb_gamma_uchar));
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 hexcol[128];
float rgb_gamma[3];
unsigned char rgb_gamma_uchar[3];
float softmin, softmax, hardmin, hardmax, step, precision;
float *hsv = ui_block_hsv_get(block);
int yco;
@ -1987,7 +1989,8 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper
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;
bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, yco, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));