diff -r 7b3a3130be44 -r 64ded9f6a6c6 ucx/properties.c --- a/ucx/properties.c Mon Jan 06 22:22:55 2025 +0100 +++ b/ucx/properties.c Tue Feb 25 21:11:00 2025 +0100 @@ -32,10 +32,10 @@ const CxPropertiesConfig cx_properties_config_default = { '=', - //'\\', '#', '\0', - '\0' + '\0', + '\\', }; void cxPropertiesInit( @@ -226,8 +226,6 @@ return CX_PROPERTIES_INVALID_EMPTY_KEY; } } - // unreachable - either we returned or skipped a blank line - assert(false); } // when we come to this point, all data must have been read @@ -254,7 +252,7 @@ CxPropertiesSink cxPropertiesMapSink(CxMap *map) { CxPropertiesSink sink; sink.sink = map; - sink.data = cxDefaultAllocator; + sink.data = (void*) cxDefaultAllocator; sink.sink_func = cx_properties_sink_map; return sink; } @@ -282,7 +280,7 @@ ) { target->ptr = src->data_ptr; target->length = fread(src->data_ptr, 1, src->data_size, src->src); - return ferror(src->src); + return ferror((FILE*)src->src); } static int cx_properties_read_init_file( @@ -362,6 +360,7 @@ // transfer the data from the source to the sink CxPropertiesStatus status; + CxPropertiesStatus kv_status = CX_PROPERTIES_NO_DATA; bool found = false; while (true) { // read input @@ -373,14 +372,23 @@ // no more data - break if (input.length == 0) { - status = found ? CX_PROPERTIES_NO_ERROR : CX_PROPERTIES_NO_DATA; + if (found) { + // something was found, check the last kv_status + if (kv_status == CX_PROPERTIES_INCOMPLETE_DATA) { + status = CX_PROPERTIES_INCOMPLETE_DATA; + } else { + status = CX_PROPERTIES_NO_ERROR; + } + } else { + // nothing found + status = CX_PROPERTIES_NO_DATA; + } break; } // set the input buffer and read the k/v-pairs cxPropertiesFill(prop, input); - CxPropertiesStatus kv_status; do { cxstring key, value; kv_status = cxPropertiesNext(prop, &key, &value);