diff options
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index a0df73d6c42..b3119f317a5 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -1,4 +1,4 @@ -/** +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -266,7 +266,7 @@ void IDP_FreeArray(IDProperty *prop) return newp; } -IDProperty *IDP_CopyArray(IDProperty *prop) +static IDProperty *IDP_CopyArray(IDProperty *prop) { IDProperty *newp = idp_generic_copy(prop); @@ -328,7 +328,7 @@ IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) return prop; } -IDProperty *IDP_CopyString(IDProperty *prop) +static IDProperty *IDP_CopyString(IDProperty *prop) { IDProperty *newp = idp_generic_copy(prop); @@ -341,7 +341,7 @@ IDProperty *IDP_CopyString(IDProperty *prop) } -void IDP_AssignString(IDProperty *prop, char *st, int maxlen) +void IDP_AssignString(IDProperty *prop, const char *st, int maxlen) { int stlen; @@ -356,7 +356,7 @@ void IDP_AssignString(IDProperty *prop, char *st, int maxlen) BLI_strncpy(prop->data.pointer, st, stlen); } -void IDP_ConcatStringC(IDProperty *prop, char *st) +void IDP_ConcatStringC(IDProperty *prop, const char *st) { int newlen; @@ -402,7 +402,7 @@ void IDP_UnlinkID(IDProperty *prop) /*-------- Group Functions -------*/ /*checks if a property with the same name as prop exists, and if so replaces it.*/ -IDProperty *IDP_CopyGroup(IDProperty *prop) +static IDProperty *IDP_CopyGroup(IDProperty *prop) { IDProperty *newp = idp_generic_copy(prop), *link; newp->len = prop->len; @@ -421,9 +421,7 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) IDProperty *loop, *prop; for (prop=src->data.group.first; prop; prop=prop->next) { for (loop=dest->data.group.first; loop; loop=loop->next) { - if (BSTR_EQ(loop->name, prop->name)) { - int copy_done= 0; - + if (strcmp(loop->name, prop->name)==0) { if(prop->type==loop->type) { switch (prop->type) { @@ -431,11 +429,9 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) case IDP_FLOAT: case IDP_DOUBLE: loop->data= prop->data; - copy_done= 1; break; case IDP_GROUP: IDP_SyncGroupValues(loop, prop); - copy_done= 1; break; default: { @@ -444,7 +440,6 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) BLI_insertlinkafter(&dest->data.group, loop, copy); BLI_remlink(&dest->data.group, tmp); - loop = copy; IDP_FreeProperty(tmp); MEM_freeN(tmp); @@ -540,6 +535,12 @@ IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name) return (IDProperty *)BLI_findstring(&prop->data.group, name, offsetof(IDProperty, name)); } +IDProperty *IDP_GetPropertyTypeFromGroup(IDProperty *prop, const char *name, const char type) +{ + IDProperty *idprop= IDP_GetPropertyFromGroup(prop, name); + return (idprop && idprop->type == type) ? idprop : NULL; +} + typedef struct IDPIter { void *next; IDProperty *parent; @@ -702,7 +703,6 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) case IDP_STRING: { char *st = val.str; - int stlen; prop = MEM_callocN(sizeof(IDProperty), "IDProperty string"); if (st == NULL) { @@ -710,10 +710,10 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) prop->totallen = DEFAULT_ALLOC_FOR_NULL_STRINGS; prop->len = 1; /*NULL string, has len of 1 to account for null byte.*/ } else { - stlen = strlen(st) + 1; - prop->data.pointer = MEM_callocN(stlen, "id property string 2"); + int stlen = strlen(st) + 1; + prop->data.pointer = MEM_mallocN(stlen, "id property string 2"); prop->len = prop->totallen = stlen; - strcpy(prop->data.pointer, st); + memcpy(prop->data.pointer, st, stlen); } break; } |