Lines Matching defs:bytes
61 #define GET_CHILD_MAX_COUNT(node) (short)((int)(node)->bytes / sizeof(cfg_node))
63 #define GET_NODE_COUNT(bytes) (bytes / sizeof(cfg_node))
80 short bytes;
99 const char* value, short bytes, short type);
102 static short find_next_node(const cfg_node* p, short start, char* name, int* bytes);
112 BTIF_TRACE_DEBUG4("%s, p->name:%s, child/value:%p, bytes:%d",
113 title, p->name, p->child, p->bytes);
179 int btif_config_get(const char* section, const char* key, const char* name, char* value, int* bytes, int* type)
182 asrt(section && *section && key && *key && name && *name && bytes && type);
183 //debug("section:%s, key:%s, name:%s, value:%p, bytes:%d, type:%d",
184 // section, key, name, value, *bytes, *type);
185 if(section && *section && key && *key && name && *name && bytes && type)
192 if(*type == node->type && value && *bytes >= node->used)
199 *bytes = node->used;
205 if(value && *bytes < node->used)
206 BTIF_TRACE_ERROR3("value:%s, not enough size: %d bytes, need %d bytes",
207 name, node->used, *bytes);
215 int btif_config_set(const char* section, const char* key, const char* name, const char* value, int bytes, int type)
219 asrt(bytes < MAX_NODE_BYTES);
220 if(section && *section && key && *key && name && *name && bytes < MAX_NODE_BYTES)
223 ret = set_node(section, key, name, value, (short)bytes, (short)type);
254 short btif_config_next_key(short pos, const char* section, char * name, int* bytes)
262 next = find_next_node(section_node, pos, name, bytes);
267 short btif_config_next_value(short pos, const char* section, const char* key, char* name, int* bytes)
279 next = find_next_node(key_node, pos, name, bytes);
340 int new_bytes = p->bytes + grow;
341 //debug("in, bytes:%d, new bytes:%d, grow:%d", p->bytes, new_bytes, grow);
347 short old_bytes = p->bytes;
350 p->bytes = old_bytes + grow;
355 else BTIF_TRACE_ERROR3("realloc failed, old_bytes:%d, grow:%d, total:%d", p->bytes, grow, p->bytes + grow);
374 p->used = p->bytes = p->flag = p->type = 0;
417 //debug("in, p->name:%s, p->bytes:%d, adding child:%s", p->name, p->bytes, name);
437 const char* value, short bytes, short type)
454 if(value_node->bytes < bytes)
458 value_node->value = (char*)malloc(bytes);
460 value_node->bytes = bytes;
464 value_node->bytes = 0;
468 if(value_node->value && value != NULL && bytes > 0)
469 memcpy(value_node->value, value, bytes);
471 value_node->used = bytes;
512 static short find_next_node(const cfg_node* p, short start, char* name, int* bytes)
528 if(name && bytes && *bytes >= name_bytes)
533 *bytes = name_bytes;
535 else if(bytes)
537 //debug("not enough room to copy the name, size in:%d, size needed:%d", *bytes, name_bytes);
538 *bytes = name_bytes;