[Bf-blender-cvs] [4ae7ae6] master: Code Cleanup: use bool for return values and correct comments

Campbell Barton noreply at git.blender.org
Tue Jan 21 16:57:23 CET 2014


Commit: 4ae7ae6f2e49287f4565b8bd6bec486f37a826af
Author: Campbell Barton
Date:   Wed Jan 22 02:48:11 2014 +1100
https://developer.blender.org/rB4ae7ae6f2e49287f4565b8bd6bec486f37a826af

Code Cleanup: use bool for return values and correct comments

also remove CDDM_Check, theres no need for it.

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

M	source/blender/blenkernel/BKE_cdderivedmesh.h
M	source/blender/blenkernel/BKE_image.h
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/blenkernel/intern/image.c
M	source/blender/blenkernel/intern/mask_rasterize.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenlib/BLI_smallhash.h
M	source/blender/blenlib/intern/smallhash.c
M	source/blender/bmesh/tools/bmesh_decimate_collapse.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/include/ED_node.h
M	source/blender/editors/include/ED_uvedit.h
M	source/blender/editors/interface/interface.c
M	source/blender/editors/mask/mask_intern.h
M	source/blender/editors/mask/mask_select.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_graph/graph_select.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_node/node_add.c
M	source/blender/editors/space_node/node_edit.c
M	source/blender/editors/uvedit/uvedit_ops.c
M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 7006b29..db06d19 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -46,9 +46,6 @@ struct Object;
 struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces,
                              int numLoops, int numPolys);
 
-/*tests if a given DerivedMesh is a CDDM*/
-int CDDM_Check(struct DerivedMesh *dm);
-
 /* creates a CDDerivedMesh from the given Mesh, this will reference the
  * original data in Mesh, but it is safe to apply vertex coordinates or
  * calculate normals as those functions will automatically create new
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 3504f8c..65540d7 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -57,7 +57,7 @@ void    BKE_image_free(struct Image *me);
 
 void    BKE_imbuf_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
 void    BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
-int     BKE_imbuf_alpha_test(struct ImBuf *ibuf);
+bool    BKE_imbuf_alpha_test(struct ImBuf *ibuf);
 int     BKE_imbuf_write_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
 int     BKE_imbuf_write(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
 int     BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy);
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 1d81dfe..60cb479 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -103,14 +103,14 @@ void BKE_paint_brush_set(struct Paint *paint, struct Brush *br);
 /* testing face select mode
  * Texture paint could be removed since selected faces are not used
  * however hiding faces is useful */
-int paint_facesel_test(struct Object *ob);
-int paint_vertsel_test(struct Object *ob);
+bool paint_facesel_test(struct Object *ob);
+bool paint_vertsel_test(struct Object *ob);
 
 /* partial visibility */
-int paint_is_face_hidden(const struct MFace *f, const struct MVert *mvert);
-int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
-                              int gridsize, int x, int y);
-int paint_is_bmesh_face_hidden(struct BMFace *f);
+bool paint_is_face_hidden(const struct MFace *f, const struct MVert *mvert);
+bool paint_is_grid_face_hidden(const unsigned int *grid_hidden,
+                               int gridsize, int x, int y);
+bool paint_is_bmesh_face_hidden(struct BMFace *f);
 
 /* paint masks */
 float paint_grid_paint_mask(const struct GridPaintMask *gpm, unsigned level,
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 712f79c..a34b680 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1702,11 +1702,6 @@ static void cdDM_release(DerivedMesh *dm)
 	}
 }
 
-int CDDM_Check(DerivedMesh *dm)
-{
-	return dm && dm->getMinMax == cdDM_getMinMax;
-}
-
 /**************** CDDM interface functions ****************/
 static CDDerivedMesh *cdDM_create(const char *desc)
 {
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index db4a639..336656e 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1912,7 +1912,7 @@ void BKE_imbuf_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf)
 	if (stamp_data.rendertime[0]) IMB_metadata_change_field(ibuf, "RenderTime", stamp_data.rendertime);
 }
 
-int BKE_imbuf_alpha_test(ImBuf *ibuf)
+bool BKE_imbuf_alpha_test(ImBuf *ibuf)
 {
 	int tot;
 	if (ibuf->rect_float) {
@@ -3025,7 +3025,7 @@ static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *frame_r,
 	return ibuf;
 }
 
-BLI_INLINE int image_quick_test(Image *ima, ImageUser *iuser)
+BLI_INLINE bool image_quick_test(Image *ima, ImageUser *iuser)
 {
 	if (ima == NULL)
 		return FALSE;
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 546c3f9..3ecca00 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -324,10 +324,11 @@ static void maskrasterize_spline_differentiate_point_outset(float (*diff_feather
  * - if not get the max radius to a corner of the bucket and see how close we
  *   are to any of the triangle edges.
  */
-static int layer_bucket_isect_test(MaskRasterLayer *layer, unsigned int face_index,
-                                   const unsigned int bucket_x, const unsigned int bucket_y,
-                                   const float bucket_size_x, const float bucket_size_y,
-                                   const float bucket_max_rad_squared)
+static bool layer_bucket_isect_test(
+        MaskRasterLayer *layer, unsigned int face_index,
+        const unsigned int bucket_x, const unsigned int bucket_y,
+        const float bucket_size_x, const float bucket_size_y,
+        const float bucket_max_rad_squared)
 {
 	unsigned int *face = layer->face_array[face_index];
 	float (*cos)[3] = layer->face_coords;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 7329fe6..6359c13 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3504,7 +3504,7 @@ static Object *obrel_armature_find(Object *ob)
 	return ob_arm;
 }
 
-static int obrel_list_test(Object *ob)
+static bool obrel_list_test(Object *ob)
 {
 	return ob && !(ob->id.flag & LIB_DOIT);
 }
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 6bdfb22..690217a 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -265,7 +265,7 @@ void BKE_paint_brush_set(Paint *p, Brush *br)
 }
 
 /* are we in vertex paint or weight pain face select mode? */
-int paint_facesel_test(Object *ob)
+bool paint_facesel_test(Object *ob)
 {
 	return ( (ob != NULL) &&
 	         (ob->type == OB_MESH) &&
@@ -276,7 +276,7 @@ int paint_facesel_test(Object *ob)
 }
 
 /* are we in weight paint vertex select mode? */
-int paint_vertsel_test(Object *ob)
+bool paint_vertsel_test(Object *ob)
 {
 	return ( (ob != NULL) &&
 	         (ob->type == OB_MESH) &&
@@ -319,7 +319,7 @@ void BKE_paint_copy(Paint *src, Paint *tar)
 
 /* returns non-zero if any of the face's vertices
  * are hidden, zero otherwise */
-int paint_is_face_hidden(const MFace *f, const MVert *mvert)
+bool paint_is_face_hidden(const MFace *f, const MVert *mvert)
 {
 	return ((mvert[f->v1].flag & ME_HIDE) ||
 	        (mvert[f->v2].flag & ME_HIDE) ||
@@ -330,7 +330,7 @@ int paint_is_face_hidden(const MFace *f, const MVert *mvert)
 /* returns non-zero if any of the corners of the grid
  * face whose inner corner is at (x, y) are hidden,
  * zero otherwise */
-int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
+bool paint_is_grid_face_hidden(const unsigned int *grid_hidden,
                               int gridsize, int x, int y)
 {
 	/* skip face if any of its corners are hidden */
@@ -341,7 +341,7 @@ int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
 }
 
 /* Return TRUE if all vertices in the face are visible, FALSE otherwise */
-int paint_is_bmesh_face_hidden(BMFace *f)
+bool paint_is_bmesh_face_hidden(BMFace *f)
 {
 	BMLoop *l_iter;
 	BMLoop *l_first;
diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h
index 4f54460..ec7b27f 100644
--- a/source/blender/blenlib/BLI_smallhash.h
+++ b/source/blender/blenlib/BLI_smallhash.h
@@ -32,11 +32,6 @@
  *  \ingroup bli
  */
 
-/* a light stack-friendly hash library,
- * (it uses stack space for smallish hash tables) */
-
-/* based on a doubling non-chaining approach */
-
 #include "BLI_compiler_attrs.h"
 
 typedef struct {
@@ -66,7 +61,7 @@ void    BLI_smallhash_release(SmallHash *hash) ATTR_NONNULL(1);
 void    BLI_smallhash_insert(SmallHash *hash, uintptr_t key, void *item) ATTR_NONNULL(1);
 void    BLI_smallhash_remove(SmallHash *hash, uintptr_t key) ATTR_NONNULL(1);
 void   *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
-int     BLI_smallhash_haskey(SmallHash *hash, uintptr_t key) ATTR_NONNULL(1);
+bool    BLI_smallhash_haskey(SmallHash *hash, uintptr_t key) ATTR_NONNULL(1);
 int     BLI_smallhash_count(SmallHash *hash)  ATTR_NONNULL(1);
 void   *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key)  ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
 void   *BLI_smallhash_iternew(SmallHash *hash, SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
index 9790ce1..b6924af 100644
--- a/source/blender/blenlib/intern/smallhash.c
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -27,6 +27,11 @@
 
 /** \file blender/blenlib/intern/smallhash.c
  *  \ingroup bli
+ *
+ * A light stack-friendly hash library, it uses stack space for smallish hash tables
+ * but falls back to heap memory once the stack limits reached.
+ *
+ * based on a doubling non-chaining approach
  */
 
 #include <string.h>
@@ -35,6 +40,7 @@
 #include "BLI_utildefines.h"
 
 #include "BLI_smallhash.h"
+
 #include "BLI_strict_flags.h"
 
 /* SMHASH_CELL_UNUSED means this cell is inside a key series,
@@ -43,7 +49,7 @@
  * no chance of anyone shoving INT32_MAX-2 into a *val pointer, I
  * imagine.  hopefully.
  *
- * note: these have the SMHASH suffix because we may want to make them public.
+ * note: these have the SMHASH prefix because we may want to make them public.
  */
 #define SMHASH_CELL_UNUSED  ((void *)0x7FFFFFFF)
 #define SMHASH_CELL_FREE    ((void *)0x7FFFFFFD)
@@ -191,7 +197,7 @@ void *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key)
 }
 
 
-int BLI_s

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list