diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 5 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 8 |
4 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 75616b9df78..12eb78e422b 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -319,7 +319,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type); struct ModifierData *modifier_new(int type); void modifier_free(struct ModifierData *md); -void modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md); +bool modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md); void modifier_copyData_generic(const struct ModifierData *md, struct ModifierData *target); void modifier_copyData(struct ModifierData *md, struct ModifierData *target); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 021e564ef95..42247d866e4 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -143,13 +143,14 @@ void modifier_free(ModifierData *md) MEM_freeN(md); } -void modifier_unique_name(ListBase *modifiers, ModifierData *md) +bool modifier_unique_name(ListBase *modifiers, ModifierData *md) { if (modifiers && md) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); - BLI_uniquename(modifiers, md, DATA_(mti->name), '.', offsetof(ModifierData, name), sizeof(md->name)); + return BLI_uniquename(modifiers, md, DATA_(mti->name), '.', offsetof(ModifierData, name), sizeof(md->name)); } + return false; } bool modifier_dependsOnTime(ModifierData *md) diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 7103f8a7597..d99df24aaf7 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -87,7 +87,7 @@ bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch) ATTR_NONNUL bool BLI_replace_extension(char *path, size_t maxlen, const char *ext) ATTR_NONNULL(); bool BLI_ensure_extension(char *path, size_t maxlen, const char *ext) ATTR_NONNULL(); bool BLI_ensure_filename(char *filepath, size_t maxlen, const char *filename) ATTR_NONNULL(); -void BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offs, int len); +bool BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offs, int len); bool BLI_uniquename_cb(bool (*unique_check)(void *arg, const char *name), void *arg, const char *defname, char delim, char *name, int name_len); void BLI_newname(char *name, int add); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index fb4c31d5cdf..72739018399 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -290,7 +290,7 @@ static bool uniquename_unique_check(void *arg, const char *name) /** * Ensures that the specified block has a unique name within the containing list, - * incrementing its numeric suffix as necessary. + * incrementing its numeric suffix as necessary. Returns true if name had to be adjusted. * * \param list List containing the block * \param vlink The block to check the name for @@ -299,7 +299,7 @@ static bool uniquename_unique_check(void *arg, const char *name) * \param name_offs Offset of name within block structure * \param name_len Maximum length of name area */ -void BLI_uniquename(ListBase *list, void *vlink, const char *defname, char delim, int name_offs, int name_len) +bool BLI_uniquename(ListBase *list, void *vlink, const char *defname, char delim, int name_offs, int name_len) { struct {ListBase *lb; void *vlink; int name_offs; } data; data.lb = list; @@ -310,9 +310,9 @@ void BLI_uniquename(ListBase *list, void *vlink, const char *defname, char delim /* See if we are given an empty string */ if (ELEM(NULL, vlink, defname)) - return; + return false; - BLI_uniquename_cb(uniquename_unique_check, &data, defname, delim, GIVE_STRADDR(vlink, name_offs), name_len); + return BLI_uniquename_cb(uniquename_unique_check, &data, defname, delim, GIVE_STRADDR(vlink, name_offs), name_len); } static int BLI_path_unc_prefix_len(const char *path); /* defined below in same file */ |