Commit: 20a177814815e7e3a1a4a4d37e91880ef98aa68a
Author: Bastien Montagne
Date:   Mon Dec 1 17:11:18 2014 +0100
Branches: master
https://developer.blender.org/rB20a177814815e7e3a1a4a4d37e91880ef98aa68a

Cleanup: more int->bool.

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

M       source/blender/blenkernel/intern/DerivedMesh.c
M       source/blender/blenkernel/intern/action.c
M       source/blender/blenkernel/intern/anim_sys.c
M       source/blender/blenkernel/intern/blender.c
M       source/blender/blenkernel/intern/cdderivedmesh.c
M       source/blender/blenkernel/intern/constraint.c
M       source/blender/blenkernel/intern/customdata.c
M       source/blender/blenkernel/intern/dynamicpaint.c
M       source/blender/blenkernel/intern/fcurve.c
M       source/blender/blenkernel/intern/fmodifier.c
M       source/blender/blenkernel/intern/image.c
M       source/blender/blenkernel/intern/lattice.c
M       source/blender/blenkernel/intern/material.c
M       source/blender/blenkernel/intern/mball.c
M       source/blender/blenkernel/intern/nla.c
M       source/blender/blenkernel/intern/node.c
M       source/blender/blenkernel/intern/object.c
M       source/blender/blenkernel/intern/paint.c
M       source/blender/blenkernel/intern/particle.c
M       source/blender/blenkernel/intern/pbvh.c
M       source/blender/blenkernel/intern/scene.c
M       source/blender/blenkernel/intern/sequencer.c
M       source/blender/blenkernel/intern/smoke.c
M       source/blender/blenkernel/intern/text.c
M       source/blender/blenkernel/intern/texture.c

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

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 526ba61..a71f695 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1975,10 +1975,10 @@ bool editbmesh_modifier_is_enabled(Scene *scene, 
ModifierData *md, DerivedMesh *
        if (!modifier_isEnabled(scene, md, required_mode)) return 0;
        if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
                modifier_setError(md, "Modifier requires original data, bad 
stack position");
-               return 0;
+               return false;
        }
        
-       return 1;
+       return true;
 }
 
 static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, 
DerivedMesh **cage_r,
diff --git a/source/blender/blenkernel/intern/action.c 
b/source/blender/blenkernel/intern/action.c
index e753a7f..c1173cb 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1028,12 +1028,12 @@ bool action_has_motion(const bAction *act)
        if (act) {
                for (fcu = act->curves.first; fcu; fcu = fcu->next) {
                        if (fcu->totvert)
-                               return 1;
+                               return true;
                }
        }
        
        /* nothing found */
-       return 0;
+       return false;
 }
 
 /* Calculate the extents of given action */
diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index 5bf4588..8e36449 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -83,7 +83,7 @@ bool id_type_can_have_animdata(ID *id)
 {
        /* sanity check */
        if (id == NULL)
-               return 0;
+               return false;
 
        /* Only some ID-blocks have this info for now */
        /* TODO: finish adding this for the other blocktypes */
@@ -102,12 +102,12 @@ bool id_type_can_have_animdata(ID *id)
                case ID_MSK:
                case ID_GD:
                {
-                       return 1;
+                       return true;
                }
                
                /* no AnimData */
                default:
-                       return 0;
+                       return false;
        }
 }
 
@@ -194,20 +194,20 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, 
bAction *act)
                        /* can set */
                        adt->action = act;
                        id_us_plus((ID *)adt->action);
-                       ok = 1;
+                       ok = true;
                }
                else {
                        /* cannot set */
                        BKE_reportf(reports, RPT_ERROR,
                                    "Could not set action '%s' onto ID '%s', as 
it does not have suitably rooted paths "
                                    "for this purpose", act->id.name + 2, 
id->name);
-                       /* ok = 0; */
+                       /* ok = false; */
                }
        }
        else {
                /* just clearing the action... */
                adt->action = NULL;
-               ok = 1;
+               ok = true;
        }
        
        return ok;
@@ -290,7 +290,7 @@ bool BKE_copy_animdata_id(ID *id_to, ID *id_from, const 
bool do_action)
        AnimData *adt;
 
        if ((id_to && id_from) && (GS(id_to->name) != GS(id_from->name)))
-               return 0;
+               return false;
 
        BKE_free_animdata(id_to);
 
@@ -300,7 +300,7 @@ bool BKE_copy_animdata_id(ID *id_to, ID *id_from, const 
bool do_action)
                iat->adt = BKE_copy_animdata(adt, do_action);
        }
 
-       return 1;
+       return true;
 }
 
 void BKE_copy_animdata_id_action(ID *id)
@@ -1353,7 +1353,7 @@ static bool animsys_remap_path(AnimMapper *UNUSED(remap), 
char *path, char **dst
 
        /* nothing suitable found, so just set dst to look at path (i.e. no 
alloc/free needed) */
        *dst = path;
-       return 0;
+       return false;
 }
 
 
@@ -1382,7 +1382,7 @@ static bool animsys_write_rna_setting(PointerRNA *ptr, 
char *path, int array_ind
                                               path, array_index, array_len - 
1);
                                }
                                
-                               return 0;
+                               return false;
                        }
                        
                        switch (RNA_property_type(prop)) {
@@ -1436,7 +1436,7 @@ static bool animsys_write_rna_setting(PointerRNA *ptr, 
char *path, int array_ind
                                        break;
                                default:
                                        /* nothing can be done here... so it is 
unsuccessful? */
-                                       return 0;
+                                       return false;
                        }
                        
                        /* RNA property update disabled for now - [#28525] 
[#28690] [#28774] [#28777] */
@@ -1475,7 +1475,7 @@ static bool animsys_write_rna_setting(PointerRNA *ptr, 
char *path, int array_ind
                }
                
                /* successful */
-               return 1;
+               return true;
        }
        else {
                /* failed to get path */
@@ -1486,7 +1486,7 @@ static bool animsys_write_rna_setting(PointerRNA *ptr, 
char *path, int array_ind
                               (ptr->id.data) ? (((ID *)ptr->id.data)->name + 
2) : "<No ID>",
                               path, array_index);
                }
-               return 0;
+               return false;
        }
 }
 
diff --git a/source/blender/blenkernel/intern/blender.c 
b/source/blender/blenkernel/intern/blender.c
index 66bd31c..96f7695 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -494,10 +494,11 @@ bool BKE_read_file_from_memory(
                        BLO_update_defaults_startup_blend(bfd->main);
                setup_app_data(C, bfd, "<memory2>");
        }
-       else
+       else {
                BKE_reports_prepend(reports, "Loading failed: ");
+       }
 
-       return (bfd ? 1 : 0);
+       return (bfd != NULL);
 }
 
 /* memfile is the undo buffer */
@@ -517,10 +518,11 @@ bool BKE_read_file_from_memfile(
                
                setup_app_data(C, bfd, "<memory1>");
        }
-       else
+       else {
                BKE_reports_prepend(reports, "Loading failed: ");
+       }
 
-       return (bfd ? 1 : 0);
+       return (bfd != NULL);
 }
 
 /* only read the userdef from a .blend */
@@ -835,13 +837,13 @@ bool BKE_undo_save_file(const char *filename)
        int file, oflags;
 
        if ((U.uiflag & USER_GLOBALUNDO) == 0) {
-               return 0;
+               return false;
        }
 
        uel = curundo;
        if (uel == NULL) {
                fprintf(stderr, "No undo buffer to save recovery file\n");
-               return 0;
+               return false;
        }
 
        /* note: This is currently used for autosave and 'quit.blend', where 
_not_ following symlinks is OK,
@@ -863,7 +865,7 @@ bool BKE_undo_save_file(const char *filename)
        if (file == -1) {
                fprintf(stderr, "Unable to save '%s': %s\n",
                        filename, errno ? strerror(errno) : "Unknown error 
opening file");
-               return 0;
+               return false;
        }
 
        for (chunk = uel->memfile.chunks.first; chunk; chunk = chunk->next) {
@@ -877,9 +879,9 @@ bool BKE_undo_save_file(const char *filename)
        if (chunk) {
                fprintf(stderr, "Unable to save '%s': %s\n",
                        filename, errno ? strerror(errno) : "Unknown error 
writing file");
-               return 0;
+               return false;
        }
-       return 1;
+       return true;
 }
 
 /* sets curscene */
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c 
b/source/blender/blenkernel/intern/cdderivedmesh.c
index cb57a39..4a25a92 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2433,10 +2433,10 @@ static bool poly_gset_compare_fn(const void *k1, const 
void *k2)
            (pk1->totloops == pk2->totloops))
        {
                /* Equality - note that this does not mean equality of polys */
-               return 0;
+               return false;
        }
        else {
-               return 1;
+               return true;
        }
 }
 
diff --git a/source/blender/blenkernel/intern/constraint.c 
b/source/blender/blenkernel/intern/constraint.c
index 10eb8b7..8fedf37 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4395,10 +4395,10 @@ bool BKE_constraint_remove(ListBase *list, bConstraint 
*con)
        if (con) {
                BKE_constraint_free_data(con);
                BLI_freelinkN(list, con);
-               return 1;
+               return true;
        }
        else
-               return 0;
+               return false;
 }
 
 /* ......... */
@@ -4662,15 +4662,15 @@ bool BKE_constraints_proxylocked_owner(Object *ob, 
bPoseChannel *pchan)
                        
                        /* On bone-level, check if bone is on proxy-protected 
layer */
                        if ((pchan->bone) && (pchan->bone->layer & 
arm->layer_protected))
-                               return 1;
+                               return true;
                }
                else {
                        /* FIXME: constraints on object-level are not handled 
well yet */
-                       return 1;
+                       return true;
                }
        }
        
-       return 0;
+       return false;
 }
 
 /* -------- Target-Matrix Stuff ------- */
diff --git a/source/blender/blenkernel/intern/customdata.c 
b/source/blender/blenkernel/intern/customdata.c
index 8f02ccd..5e86ca5 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1798,7 +1798,8 @@ bool CustomData_free_layer(CustomData *data, int type, 
int totelem, int index)
        const int n = index - CustomData_get_layer_index(data, type);
        int i;
        
-       if (index < 0) return 0;
+       if (index < 0)
+               return false;
 
        customData_free_layer__internal(&data->layers[index], totelem);
 
@@ -1828,14 +1829,15 @@ bool CustomData_free_layer(CustomData *data, int type, 
int totelem, int index)
 
        customData_update_offsets(data);
 
-       return 1;
+       return true;
 }
 
 bool CustomData_free_layer_active(CustomData *data, int type, int totelem)
 {
        int index = 0;
        index = CustomData_get_active_layer_index(data, type);
-       if (index == -1) return 0;
+       if (index == -1)
+               return false;
        return CustomData_free_layer(data, type, totelem, index);
 }
 
@@ -1942,7 +1944,8 @@ bool CustomData_is_referenced_layer(struct CustomData 
*data, int type)
 
        /* get the layer index of the first layer of type */
        layer_index = CustomData_get_active_layer_index(data, type);
-       if (layer_index == -1) return 0;
+       if (layer_index == -1)
+               return false;
 
        layer = &data->layers[layer_index];
 
@@ -2260,8 +2263,8 @@ bool CustomData_set_layer_name(const CustomData *data, 
int type, int n, const ch
        /* get the layer index of the first layer of type */
        int layer_index = CustomData_get_layer_index_n(data, type, n);
 
-       if (layer_index == -1) return false;
-       if (!name) return false;
+       if ((layer_index == -1) || !name)
+               return false;
        
        BLI_strncpy(data->layers[layer_index].name, name, 
sizeof(data->layers[layer_index].name));
        
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 06aa1e2..e3fa473 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -253,20 +253,20 @@ static int 
dynamicPaint_surfaceNumOfPoints(DynamicPaintSurface *surface)
 bool dynamicPaint_surfaceHasColorPreview(DynamicPaintSurface *surface)
 {
        if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
-               return 0;
+               return false;
        }
        else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
                if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
                    surface->type == MOD_DPAINT_SURFACE_T_WAVE)
                {
-                       return 0;
+                       return false;
                }
                else {
-                       return 1;
+                       return true;
                }
        }
        else {
-               return 1;
+               return true;
        }
 }
 
@@ -321,7 +321,7 @@ 

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to