Fix #28663: All "unit" properties show a value of 0 (on WinXP&MinGW&scons)
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 16 Sep 2011 10:03:08 +0000 (10:03 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 16 Sep 2011 10:03:08 +0000 (10:03 +0000)
Initially problem was caused by updated version of mingw-runtime which
changed behavior of snprintf and vsnprintf so %lf isn't anymore valid
for doubles.

According to manpages, %f is a correct format for snprintf for doubles.

source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/unit.c

index e0b7ebe..d8b5197 100644 (file)
@@ -2021,7 +2021,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
                        {
                                if(edgecollpair.p21==6 || edgecollpair.p22 == 6)
                                {
-                                       printf("dist: %f, sol[k]: %lf, sol2[k]: %lf\n", distance, solution[k], solution2[k]);
+                                       printf("dist: %f, sol[k]: %f, sol2[k]: %f\n", distance, solution[k], solution2[k]);
                                        printf("a1: %f, a2: %f, b1: %f, b2: %f\n", x1[0], x2[0], x3[0], v1[0]);
                                        printf("b21: %d, b22: %d\n", edgecollpair.p21, edgecollpair.p22);
                                }
index 4ce5de7..002cfdb 100644 (file)
@@ -592,7 +592,7 @@ void BKE_image_print_memlist(void)
        for(ima= G.main->image.first; ima; ima= ima->id.next)
                totsize += image_mem_size(ima);
 
-       printf("\ntotal image memory len: %.3lf MB\n", (double)totsize/(double)(1024*1024));
+       printf("\ntotal image memory len: %.3f MB\n", (double)totsize/(double)(1024*1024));
 
        for(ima= G.main->image.first; ima; ima= ima->id.next) {
                size= image_mem_size(ima);
index 72fe1c1..8aeef0d 100644 (file)
@@ -345,7 +345,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC
 
        /* Convert to a string */
        {
-               len= BLI_snprintf(str, len_max, "%.*lf", prec, value_conv);
+               len= BLI_snprintf(str, len_max, "%.*f", prec, value_conv);
 
                if(len >= len_max)
                        len= len_max;