ui/common/properties.c

changeset 994
c9395b30e5c8
parent 993
8ebf55d78341
equal deleted inserted replaced
993:8ebf55d78341 994:c9395b30e5c8
177 } 177 }
178 if(status > CX_PROPERTIES_OK) { 178 if(status > CX_PROPERTIES_OK) {
179 break; 179 break;
180 } 180 }
181 } 181 }
182 return status == CX_PROPERTIES_NO_ERROR ? 0 : 1; 182 return status <= CX_PROPERTIES_NO_DATA ? 0 : 1;
183 } 183 }
184 184
185 void uic_load_app_properties() { 185 void uic_load_app_properties() {
186 application_properties = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 128); 186 application_properties = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 128);
187 application_properties->collection.simple_destructor = free; 187 application_properties->collection.simple_destructor = free;
198 cxstring value; 198 cxstring value;
199 while((status = cxPropertiesNext(&prop, &key, &value)) == CX_PROPERTIES_NO_ERROR) { 199 while((status = cxPropertiesNext(&prop, &key, &value)) == CX_PROPERTIES_NO_ERROR) {
200 cxMapPut(application_properties, key, cx_strdup(value).ptr); 200 cxMapPut(application_properties, key, cx_strdup(value).ptr);
201 } 201 }
202 202
203 if(status != CX_PROPERTIES_NO_ERROR) { 203 if(status > CX_PROPERTIES_NO_DATA) {
204 fprintf(stderr, "Error: cannot load properties: %d\n", (int)status); 204 fprintf(stderr, "Error: cannot load properties: %d\n", (int)status);
205 } else { 205 } else {
206 cxMapRehash(application_properties); 206 cxMapRehash(application_properties);
207 } 207 }
208 } 208 }
288 } 288 }
289 289
290 int ret = 0; 290 int ret = 0;
291 CxMapIterator i = cxMapIterator(application_properties); 291 CxMapIterator i = cxMapIterator(application_properties);
292 cx_foreach(CxMapEntry *, entry, i) { 292 cx_foreach(CxMapEntry *, entry, i) {
293 fprintf(file, "%.*s: %s\n", (int)entry->key->len, entry->key->data, entry->value); 293 fprintf(file, "%.*s = %s\n", (int)entry->key->len, entry->key->data, entry->value);
294 } 294 }
295 295
296 cxMapRehash(application_properties); 296 cxMapRehash(application_properties);
297 297
298 fclose(file); 298 fclose(file);

mercurial