develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33638 - branches/pdd22io_part2/src/io

From:
allison
Date:
December 7, 2008 14:55
Subject:
[svn:parrot] r33638 - branches/pdd22io_part2/src/io
Message ID:
20081207225457.37985CB9AF@x12.develooper.com
Author: allison
Date: Sun Dec  7 14:54:56 2008
New Revision: 33638

Modified:
   branches/pdd22io_part2/src/io/buffer.c

Log:
[pdd22io] Neglected to set cached version of buffer flags when resetting buffer
to empty.


Modified: branches/pdd22io_part2/src/io/buffer.c
==============================================================================
--- branches/pdd22io_part2/src/io/buffer.c	(original)
+++ branches/pdd22io_part2/src/io/buffer.c	Sun Dec  7 14:54:56 2008
@@ -310,19 +310,20 @@
 
         /* buffer completed */
         if (current == avail) {
-            Parrot_io_set_buffer_flags(interp, filehandle,
-                    (buffer_flags & ~PIO_BF_READBUF));
+            buffer_flags &= ~PIO_BF_READBUF;
+            Parrot_io_set_buffer_flags(interp, filehandle, buffer_flags);
             /* Reset next and end */
             Parrot_io_set_buffer_end(interp, filehandle, NULL);
             Parrot_io_set_buffer_next(interp, filehandle, buffer_start);
         }
 
+        /* requested length satisfied */
         if (len == current) {
             s->strlen = s->bufused = len;
             return current;
         }
         else {
-            /* more data needed from downlayer */
+            /* more data needed */
             out_buf += current;
             len -= current;
         }
@@ -347,7 +348,9 @@
         }
 
         got = Parrot_io_fill_readbuf(interp, filehandle);
-        len = len < got ? len : got;
+        len = (len < got)
+            ? len
+            : (got > 0) ? got : 0;
     }
 
     /* read from the read_buffer */



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About