src/properties.c

changeset 1124
fcd5d86c472f
parent 1120
608bdcc8f9ad
equal deleted inserted replaced
1123:2b83302d595a 1124:fcd5d86c472f
358 } 358 }
359 } 359 }
360 360
361 // transfer the data from the source to the sink 361 // transfer the data from the source to the sink
362 CxPropertiesStatus status; 362 CxPropertiesStatus status;
363 CxPropertiesStatus kv_status = CX_PROPERTIES_NO_DATA;
363 bool found = false; 364 bool found = false;
364 while (true) { 365 while (true) {
365 // read input 366 // read input
366 cxstring input; 367 cxstring input;
367 if (source.read_func(prop, &source, &input)) { 368 if (source.read_func(prop, &source, &input)) {
369 break; 370 break;
370 } 371 }
371 372
372 // no more data - break 373 // no more data - break
373 if (input.length == 0) { 374 if (input.length == 0) {
374 status = found ? CX_PROPERTIES_NO_ERROR : CX_PROPERTIES_NO_DATA; 375 if (found) {
376 // something was found, check the last kv_status
377 if (kv_status == CX_PROPERTIES_INCOMPLETE_DATA) {
378 status = CX_PROPERTIES_INCOMPLETE_DATA;
379 } else {
380 status = CX_PROPERTIES_NO_ERROR;
381 }
382 } else {
383 // nothing found
384 status = CX_PROPERTIES_NO_DATA;
385 }
375 break; 386 break;
376 } 387 }
377 388
378 // set the input buffer and read the k/v-pairs 389 // set the input buffer and read the k/v-pairs
379 cxPropertiesFill(prop, input); 390 cxPropertiesFill(prop, input);
380 391
381 CxPropertiesStatus kv_status;
382 do { 392 do {
383 cxstring key, value; 393 cxstring key, value;
384 kv_status = cxPropertiesNext(prop, &key, &value); 394 kv_status = cxPropertiesNext(prop, &key, &value);
385 if (kv_status == CX_PROPERTIES_NO_ERROR) { 395 if (kv_status == CX_PROPERTIES_NO_ERROR) {
386 found = true; 396 found = true;

mercurial