[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54234] trunk/blender/source/blender/ blenlib/BLI_utildefines.h: Fix UI translation partly missing in scons builds ( reported by Leon Cheung and Gabriel Gazz?\195?\161n on ML, and lockal on IRC, thanks).

Bastien Montagne montagne29 at wanadoo.fr
Thu Jan 31 15:25:12 CET 2013


Revision: 54234
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54234
Author:   mont29
Date:     2013-01-31 14:25:07 +0000 (Thu, 31 Jan 2013)
Log Message:
-----------
Fix UI translation partly missing in scons builds (reported by Leon Cheung and Gabriel Gazz?\195?\161n on ML, and lockal on IRC, thanks).

The problem is that, when HAVE__BOOL is not defined (as it is the case in scons currently), BLI_utildefines.h defines bool as a standard type. Was using signed char, which makes eg "bool foo = 1024" be false (overflow)! Especially nasty when using bitflags (think we have been lucky to not have worse bugs because of that)!

So changed fallback bool type to unsigned int.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_utildefines.h

Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h	2013-01-31 13:44:13 UTC (rev 54233)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h	2013-01-31 14:25:07 UTC (rev 54234)
@@ -45,7 +45,11 @@
 #  ifdef __cplusplus
 typedef bool _BLI_Bool;
 #  else
-#   define _BLI_Bool signed char
+/* using char here may cause nasty tricky bugs, e.g.
+ *     bool do_translate = RNA_property_flag(prop) & PROP_STRING_PY_TRANSLATE;
+ * as PROP_STRING_PY_TRANSLATE is farther than 8th bit, do_translate would be always false!
+ */
+#   define _BLI_Bool unsigned int
 #  endif
 # else
 #  define _BLI_Bool _Bool




More information about the Bf-blender-cvs mailing list