[Bf-blender-cvs] [7a2e271e543] blender2.8: Fix compiler warnings.

Brecht Van Lommel noreply at git.blender.org
Sun May 13 14:53:46 CEST 2018


Commit: 7a2e271e5439d1888b21e4dafe782027f6ef0f77
Author: Brecht Van Lommel
Date:   Sun May 13 14:10:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB7a2e271e5439d1888b21e4dafe782027f6ef0f77

Fix compiler warnings.

===================================================================

M	intern/clog/clog.c
M	source/blender/alembic/intern/abc_util.cc
M	source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
M	source/blender/blenkernel/intern/appdir.c
M	source/blender/editors/interface/interface_layout.c
M	source/blender/modifiers/intern/MOD_laplaciansmooth.c
M	source/blender/render/intern/source/pointdensity.c

===================================================================

diff --git a/intern/clog/clog.c b/intern/clog/clog.c
index e93ba9ec2b7..87a021ad35b 100644
--- a/intern/clog/clog.c
+++ b/intern/clog/clog.c
@@ -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);
 
diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc
index 8bdc7ae3455..6787d118fa1 100644
--- a/source/blender/alembic/intern/abc_util.cc
+++ b/source/blender/alembic/intern/abc_util.cc
@@ -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);
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
index c1a4f8dba53..fc4220277eb 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c
@@ -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++) {
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 16f8d16860f..2054442250e 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -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)) {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index f0ea6466763..d9db5c930fc 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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) {
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
index 04821b01e05..59e4faee633 100644
--- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -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);
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index a6350e3c448..51eaba3a054 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -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) {



More information about the Bf-blender-cvs mailing list