Fix compiler warnings.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 13 May 2018 12:10:05 +0000 (14:10 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sun, 13 May 2018 12:48:55 +0000 (14:48 +0200)
intern/clog/clog.c
source/blender/alembic/intern/abc_util.cc
source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
source/blender/blenkernel/intern/appdir.c
source/blender/editors/interface/interface_layout.c
source/blender/modifiers/intern/MOD_laplaciansmooth.c
source/blender/render/intern/source/pointdensity.c

index e93ba9ec2b75960bf75ef32496c8c099c0ba2a21..87a021ad35bac8f9c403ac52b75a0c6daac74863 100644 (file)
@@ -404,7 +404,8 @@ void CLG_log_str(
        clg_str_append(&cstr, "\n");
 
        /* could be optional */
-       write(lg->ctx->output, cstr.data, cstr.len);
+       ssize_t bytes_written = write(lg->ctx->output, cstr.data, cstr.len);
+       (void)bytes_written;
 
        clg_str_free(&cstr);
 
@@ -435,7 +436,8 @@ void CLG_logf(
        clg_str_append(&cstr, "\n");
 
        /* could be optional */
-       write(lg->ctx->output, cstr.data, cstr.len);
+       ssize_t bytes_written = write(lg->ctx->output, cstr.data, cstr.len);
+       (void)bytes_written;
 
        clg_str_free(&cstr);
 
index 8bdc7ae3455c7372e96688f7dfa73549b3b1039a..6787d118fa1311f07f56c7853dc60529c7aee4fc 100644 (file)
@@ -140,7 +140,10 @@ void create_swapped_rotation_matrix(
                        rz = -euler[1];
                        break;
                default:
+                       ry = 0.0f;
+                       rz = 0.0f;
                        BLI_assert(false);
+                       break;
        }
 
        unit_m3(rot_x_mat);
index c1a4f8dba531a9adb0ca7f95b96934602608192a..fc4220277eb2dbf27ff3b8c76c5eecc3b77ea17b 100644 (file)
@@ -543,7 +543,7 @@ static void opensubdiv_evaluateQuadFaceGrids(CCGSubSurf *ss,
        for (S = 0; S < face->numVerts; S++) {
                int x, y, k;
                CCGEdge *edge = NULL;
-               bool inverse_edge;
+               bool inverse_edge = false;
 
                for (x = 0; x < gridSize; x++) {
                        for (y = 0; y < gridSize; y++) {
index 16f8d16860f9725419199180e6a509825537f783..2054442250ecd3b645617c39a3cada92c6f256fa 100644 (file)
@@ -790,7 +790,9 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c
                                BLI_dir_create_recursive(tmp_name);
                        }
 #else
-                       mkdtemp(tmp_name);
+                       if (mkdtemp(tmp_name) == NULL) {
+                               BLI_dir_create_recursive(tmp_name);
+                       }
 #endif
                }
                if (BLI_is_dir(tmp_name)) {
index f0ea64667636ffb4602f9410c1b3a72725685ffd..d9db5c930fcb3cf3d85bddbd600ea8363bf1341b 100644 (file)
@@ -846,8 +846,9 @@ static uiBut *uiItemFullO_ptr_ex(
        w = ui_text_icon_width(layout, name, icon, 0);
 
        int prev_emboss = layout->emboss;
-       if (flag & UI_ITEM_R_NO_BG)
+       if (flag & UI_ITEM_R_NO_BG) {
                layout->emboss = UI_EMBOSS_NONE;
+       }
 
        /* create the button */
        if (icon) {
@@ -868,10 +869,9 @@ static uiBut *uiItemFullO_ptr_ex(
        if ((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
                but->drawflag |= UI_BUT_TEXT_LEFT;
 
-       if (flag & UI_ITEM_R_NO_BG)
+       if (flag & UI_ITEM_R_NO_BG) {
                layout->emboss = prev_emboss;
-
-       if (flag & UI_ITEM_R_NO_BG)
+       }
 
        if (flag & UI_ITEM_O_DEPRESS) {
                but->flag |= UI_SELECT_DRAW;
@@ -1501,8 +1501,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
        ui_item_rna_size(layout, name, icon, ptr, prop, index, icon_only, compact, &w, &h);
 
        int prev_emboss = layout->emboss;
-       if (flag & UI_ITEM_R_NO_BG)
+       if (no_bg) {
                layout->emboss = UI_EMBOSS_NONE;
+       }
        
        /* array property */
        if (index == RNA_NO_INDEX && is_array)
@@ -1548,8 +1549,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
                UI_but_flag_enable(but, UI_BUT_LIST_ITEM);
        }
 
-       if (flag & UI_ITEM_R_NO_BG)
+       if (no_bg) {
                layout->emboss = prev_emboss;
+       }
 
        /* ensure text isn't added to icon_only buttons */
        if (but && icon_only) {
index 04821b01e05d4d01f3c2a05685a84c2153198d75..59e4faee6336a66d3a37324c0a3d57621e04d600 100644 (file)
@@ -333,7 +333,7 @@ static void validate_solution(LaplacianSystem *sys, short flag, float lambda, fl
 {
        int i;
        float lam;
-       float vini, vend;
+       float vini = 0.0f, vend = 0.0f;
 
        if (flag & MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME) {
                vini = compute_volume(sys->vert_centroid, sys->vertexCos, sys->mpoly, sys->numPolys, sys->mloop);
index a6350e3c4485cde2461302f78067436d6327de4a..51eaba3a054b6912d5730fb6826cd863431768d7 100644 (file)
@@ -634,9 +634,6 @@ static int pointdensity(PointDensity *pd,
 
        texres->tin = 0.0f;
 
-       if ((!pd) || (!pd->point_tree))
-               return 0;
-
        init_pointdensityrangedata(pd, &pdr, &density, vec, &age, col,
                (pd->flag & TEX_PD_FALLOFF_CURVE ? pd->falloff_curve : NULL),
                pd->falloff_speed_scale * 0.001f);
@@ -694,9 +691,9 @@ static int pointdensity(PointDensity *pd,
        return retval;
 }
 
-static int pointdensity_color(PointDensity *pd, TexResult *texres, float age, const float vec[3], const float col[3])
+static void pointdensity_color(PointDensity *pd, TexResult *texres, float age, const float vec[3], const float col[3])
 {
-       int retval = TEX_RGB;
+       texres->tr = texres->tg = texres->tb = texres->ta = 1.0f;
 
        if (pd->source == TEX_PD_PSYS) {
                float rgba[4];
@@ -733,8 +730,6 @@ static int pointdensity_color(PointDensity *pd, TexResult *texres, float age, co
                                break;
                        case TEX_PD_COLOR_CONSTANT:
                        default:
-                               texres->tr = texres->tg = texres->tb = texres->ta = 1.0f;
-                               retval = TEX_INT;
                                break;
                }
        }
@@ -765,13 +760,9 @@ static int pointdensity_color(PointDensity *pd, TexResult *texres, float age, co
                                break;
                        case TEX_PD_COLOR_CONSTANT:
                        default:
-                               texres->tr = texres->tg = texres->tb = texres->ta = 1.0f;
-                               retval = TEX_INT;
                                break;
                }
        }
-       
-       return retval;
 }
 
 static void sample_dummy_point_density(int resolution, float *values)
@@ -920,6 +911,10 @@ static void point_density_sample_func(
        PointDensity *pd = data->pd;
        float *values = data->values;
 
+       if (!pd || !pd->point_tree) {
+               return;
+       }
+
        size_t z = (size_t)iter;
        for (size_t y = 0; y < resolution; ++y) {
                for (size_t x = 0; x < resolution; ++x) {