Author: fejj
Date: 2008-02-02 15:54:18 -0500 (Sat, 02 Feb 2008)
New Revision: 94654
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/pipeline.cpp
Log:
(FileSource::Peek): Slightly better fix.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2008-02-02 20:07:43 UTC (rev 94653)
+++ trunk/moon/src/ChangeLog 2008-02-02 20:54:18 UTC (rev 94654)
@@ -2,6 +2,7 @@
* pipeline.cpp (FileSource::Peek): Only memmove() if we have data
to move.
+ (FileSource::Peek): Slightly better fix.
2008-02-01 Jeffrey Stedfast <[EMAIL PROTECTED]>
Modified: trunk/moon/src/pipeline.cpp
===================================================================
--- trunk/moon/src/pipeline.cpp 2008-02-02 20:07:43 UTC (rev 94653)
+++ trunk/moon/src/pipeline.cpp 2008-02-02 20:54:18 UTC (rev 94654)
@@ -2304,14 +2304,24 @@
if (buflen < n) {
/* need to buffer more data */
- need = n - buflen;
if (bufptr > buffer) {
used = (bufptr + buflen) - buffer;
avail = sizeof (buffer) - used;
- shift = need - avail;
+ need = n - buflen;
- memmove (buffer, buffer + shift, used - shift);
- bufptr -= shift;
+ if (avail < need) {
+ /* make room for 'need' more bytes */
+ shift = need - avail;
+ memmove (buffer, buffer + shift, used - shift);
+ bufptr -= shift;
+ } else {
+ /* request 'avail' more bytes so we
+ * can hopefully fill our buffer */
+ need = avail;
+ }
+ } else {
+ /* nothing in our buffer, fill 'er up */
+ need = sizeof (buffer);
}
do {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches