From 36e80e6481f7518e8005527d8965148039ba8dc2 Mon Sep 17 00:00:00 2001 From: scuri Date: Sat, 22 Aug 2009 04:31:03 +0000 Subject: *** empty log message *** --- src/im_attrib.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/im_attrib.cpp') diff --git a/src/im_attrib.cpp b/src/im_attrib.cpp index 90c007e..10d4599 100644 --- a/src/im_attrib.cpp +++ b/src/im_attrib.cpp @@ -2,7 +2,7 @@ * \brief Attributes Table * * See Copyright Notice in im_lib.h - * $Id: im_attrib.cpp,v 1.2 2009/08/19 18:39:43 scuri Exp $ + * $Id: im_attrib.cpp,v 1.3 2009/08/22 04:31:04 scuri Exp $ */ #include @@ -62,12 +62,15 @@ static char* utlStrDup(const char* str) imAttribNode::imAttribNode(const char* name, int _data_type, int _count, const void* _data, imAttribNode* _next) { + if (_data_type == 0 && _count == -1) /* BYTE meaning a string */ + _count = strlen((char*)_data)+1; + this->name = utlStrDup(name); this->data_type = _data_type; this->count = _count; this->next = _next; - int size = count * imDataTypeSize(_data_type); + int size = _count * imDataTypeSize(_data_type); this->data = malloc(size); if (_data) memcpy(this->data, _data, size); else memset(this->data, 0, size); @@ -152,9 +155,6 @@ void imAttribTableSet(imAttribTablePrivate* ptable, const char* name, int data_t int index = iHashIndex(name, ptable->hash_size); imAttribNode* first_node = ptable->hash_table[index]; - if (data_type == 0 && count == -1) /* BYTE */ - count = strlen((char*)data)+1; - // The name already exists ? imAttribNode* cur_node = first_node; imAttribNode* prev_node = NULL; -- cgit v1.2.3