OSSP CVS Repository

ossp - Difference in ossp-pkg/sio/sio.c versions 1.17 and 1.18
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/sio/sio.c 1.17 -> 1.18

--- sio.c        2002/11/29 13:04:15     1.17
+++ sio.c        2002/11/29 15:33:20     1.18
@@ -558,7 +558,8 @@
     if (n == 0) {
 
         rc = sio_strategy(sio, h);
-        if (rc != SIO_OK) return SIO_RC(rc);
+        if (rc != SIO_OK)
+            return SIO_RC(rc);
 
         n = al_bytes(src);
         if (n == 0)
@@ -566,22 +567,24 @@
 
     }
 
-    if (label == NULL) {
-        datastart = 0;
-        datasize  = n;
-    } else if (al_spanlabel(src, 0, n, label, &datastart, &datasize) != AL_OK) {
-        datastart = 0;
-        datasize  = 0;
-    }
+    while (n > 0) {
+        if (label == NULL) {
+            datastart = 0;
+            datasize  = n;
+        } else if (al_spanlabel(src, 0, n, label, &datastart, &datasize) != AL_OK)
+            break;
+
+        /*
+         * clamp to requested size
+         */
+        if (datasize > n)
+            datasize = n;
 
-    /*
-     * clamp to requested size
-     */
-    if (datasize > n)
-        datasize = n;
+        /* XXX - error handling ? */
+        (void) al_splice(src, datastart, datasize, NULL, al);
 
-    /* XXX - error handling ? */
-    (void) al_splice(src, datastart, datasize, NULL, al);
+        n -= datasize;
+    }
 
     return SIO_OK;
 }
@@ -676,16 +679,22 @@
     if (arc != AL_OK) return SIO_RC(SIO_ERR_INT);
 
     rc = sio_input(sio, al, n, SIO_LABEL_DATA(sio));
-    if (rc == SIO_OK && al_bytes(al) > 0)
-        al_flatten(al, 0, n, AL_FORWARD, NULL, dst, actualp);
-    else {
-        rc = sio_input(sio, al, n, SIO_LABEL_ERROR(sio));
-        if (rc == SIO_OK && al_bytes(al) > 0)
-            sio->error_flag = 1;
+    if (rc == SIO_OK) {
+        if (al_bytes(al) > 0)
+            al_flatten(al, 0, n, AL_FORWARD, NULL, dst, actualp);
         else {
-            rc = sio_input(sio, al, n, SIO_LABEL_EOF(sio));
-            if (rc == SIO_OK && al_bytes(al) > 0)
-                sio->eof_flag = 1;
+            rc = sio_input(sio, al, n, SIO_LABEL_ERROR(sio));
+            if (rc == SIO_OK) {
+                if (al_bytes(al) > 0)
+                    sio->error_flag = 1;
+                else {
+                    rc = sio_input(sio, al, n, SIO_LABEL_EOF(sio));
+                    if (rc == SIO_OK) {
+                        if (al_bytes(al) > 0)
+                            sio->eof_flag = 1;
+                    }
+                }
+            }
         }
     }
 

CVSTrac 2.0.1