src/properties.c

changeset 1124
fcd5d86c472f
parent 1120
608bdcc8f9ad
--- a/src/properties.c	Sun Jan 12 13:04:32 2025 +0100
+++ b/src/properties.c	Sun Jan 12 13:25:50 2025 +0100
@@ -360,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
@@ -371,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);

mercurial