From 0d5b028d43c328f528c8aeb6738f19e442c77eba Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Mar 2013 19:27:51 +0000 Subject: patch [#34103] use boolean in path functions and add comments. path_util_1.patch from Lawrence D'Oliveiro (ldo) --- source/blender/blenkernel/intern/customdata.c | 10 +++++----- source/blender/blenkernel/intern/deform.c | 8 ++++---- source/blender/blenkernel/intern/dynamicpaint.c | 14 +++++++------- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenkernel/intern/packedFile.c | 2 +- source/blender/blenkernel/intern/pbvh_bmesh.c | 1 + 6 files changed, 19 insertions(+), 18 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 580a69466c9..787c854d280 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2861,7 +2861,7 @@ static int CustomData_is_property_layer(int type) return 0; } -static int cd_layer_find_dupe(CustomData *data, const char *name, int type, int index) +static bool cd_layer_find_dupe(CustomData *data, const char *name, int type, int index) { int i; /* see if there is a duplicate */ @@ -2871,21 +2871,21 @@ static int cd_layer_find_dupe(CustomData *data, const char *name, int type, int if (CustomData_is_property_layer(type)) { if (CustomData_is_property_layer(layer->type) && strcmp(layer->name, name) == 0) { - return 1; + return true; } } else { if (i != index && layer->type == type && strcmp(layer->name, name) == 0) { - return 1; + return true; } } } } - return 0; + return false; } -static int customdata_unique_check(void *arg, const char *name) +static bool customdata_unique_check(void *arg, const char *name) { struct {CustomData *data; int type; int index; } *data_arg = arg; return cd_layer_find_dupe(data_arg->data, name, data_arg->type, data_arg->index); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 439180e8d76..2ba71ecd9b5 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -432,22 +432,22 @@ int defgroup_flip_index(Object *ob, int index, int use_default) return (flip_index == -1 && use_default) ? index : flip_index; } -static int defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *ob) +static bool defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *ob) { bDeformGroup *curdef; for (curdef = ob->defbase.first; curdef; curdef = curdef->next) { if (dg != curdef) { if (!strcmp(curdef->name, name)) { - return 1; + return true; } } } - return 0; + return false; } -static int defgroup_unique_check(void *arg, const char *name) +static bool defgroup_unique_check(void *arg, const char *name) { struct {Object *ob; void *dg; } *data = arg; return defgroup_find_name_dupe(name, data->dg, data->ob); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 685d66195c7..a01b08a3c63 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -340,7 +340,7 @@ int dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object * return 0; } -static int surface_duplicateOutputExists(void *arg, const char *name) +static bool surface_duplicateOutputExists(void *arg, const char *name) { DynamicPaintSurface *t_surface = (DynamicPaintSurface *)arg; DynamicPaintSurface *surface = t_surface->canvas->surfaces.first; @@ -349,11 +349,11 @@ static int surface_duplicateOutputExists(void *arg, const char *name) if (surface != t_surface && surface->type == t_surface->type && surface->format == t_surface->format) { - if (surface->output_name[0] != '\0' && !BLI_path_cmp(name, surface->output_name)) return 1; - if (surface->output_name2[0] != '\0' && !BLI_path_cmp(name, surface->output_name2)) return 1; + if (surface->output_name[0] != '\0' && !BLI_path_cmp(name, surface->output_name)) return true; + if (surface->output_name2[0] != '\0' && !BLI_path_cmp(name, surface->output_name2)) return true; } } - return 0; + return false; } static void surface_setUniqueOutputName(DynamicPaintSurface *surface, char *basename, int output) @@ -367,15 +367,15 @@ static void surface_setUniqueOutputName(DynamicPaintSurface *surface, char *base } -static int surface_duplicateNameExists(void *arg, const char *name) +static bool surface_duplicateNameExists(void *arg, const char *name) { DynamicPaintSurface *t_surface = (DynamicPaintSurface *)arg; DynamicPaintSurface *surface = t_surface->canvas->surfaces.first; for (; surface; surface = surface->next) { - if (surface != t_surface && !strcmp(name, surface->name)) return 1; + if (surface != t_surface && !strcmp(name, surface->name)) return true; } - return 0; + return false; } void dynamicPaintSurface_setUniqueName(DynamicPaintSurface *surface, const char *basename) diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 143f2186020..c7c83b7d0a5 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1262,7 +1262,7 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip) /* Sanity Validation ------------------------------------ */ -static int nla_editbone_name_check(void *arg, const char *name) +static bool nla_editbone_name_check(void *arg, const char *name) { return BLI_ghash_haskey((GHash *)arg, (void *)name); } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 288e4ccde5d..d4d4e07b929 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -591,7 +591,7 @@ void packLibraries(Main *bmain, ReportList *reports) /* test for relativenss */ for (lib = bmain->library.first; lib; lib = lib->id.next) - if (0 == BLI_path_is_rel(lib->name)) + if (!BLI_path_is_rel(lib->name)) break; if (lib) { diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 386a8b27870..4ebebbed52d 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -20,6 +20,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include "BLI_buffer.h" #include "BLI_ghash.h" #include "BLI_heap.h" -- cgit v1.2.3