Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-13 05:26:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-13 05:26:31 +0400
commit2025e4cbb9772ad6c72b56ad28e5bdd62d596b9a (patch)
tree1ac23304e3c45b0063df4c21d40d9c15320b5dea
parenta2b3c938527aed00a72895f37c634db883d95db9 (diff)
Code cleanup: quiet warnings & style
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c4
-rw-r--r--source/blender/blenkernel/intern/pointcache.c2
-rw-r--r--source/blender/blenlib/BLI_utildefines.h12
-rw-r--r--source/blender/blenlib/intern/storage.c2
-rw-r--r--source/blender/editors/interface/interface_layout.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c9
6 files changed, 19 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 40605c598bd..e625713dcff 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 57abd49752a..b97861c6c35 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -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;
}
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index ef6edda1118..ea3701f804a 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -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); \
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index de40cab425d..20830570432 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -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
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 1686abab9c7..942ffec74fd 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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 */
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index f8466b17b0b..b98bf0f1514 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -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)"));