Author: fejj
Date: 2008-02-02 09:10:10 -0500 (Sat, 02 Feb 2008)
New Revision: 94628
Modified:
trunk/moon/src/ChangeLog
trunk/moon/src/pipeline.cpp
Log:
2008-02-02 Jeffrey Stedfast <[EMAIL PROTECTED]>
* pipeline.cpp (FileSource::Peek): Only memmove() if we have data
to move.
Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog 2008-02-02 14:06:31 UTC (rev 94627)
+++ trunk/moon/src/ChangeLog 2008-02-02 14:10:10 UTC (rev 94628)
@@ -1,3 +1,8 @@
+2008-02-02 Jeffrey Stedfast <[EMAIL PROTECTED]>
+
+ * pipeline.cpp (FileSource::Peek): Only memmove() if we have data
+ to move.
+
2008-02-01 Jeffrey Stedfast <[EMAIL PROTECTED]>
* pipeline.cpp (Mp3Demuxer::GetPositionOfPts): Reimplemented to
Modified: trunk/moon/src/pipeline.cpp
===================================================================
--- trunk/moon/src/pipeline.cpp 2008-02-02 14:06:31 UTC (rev 94627)
+++ trunk/moon/src/pipeline.cpp 2008-02-02 14:10:10 UTC (rev 94628)
@@ -2304,14 +2304,16 @@
if (buflen < n) {
/* need to buffer more data */
- used = (bufptr + buflen) - buffer;
- avail = sizeof (buffer) - used;
need = n - buflen;
+ if (bufptr > buffer) {
+ used = (bufptr + buflen) - buffer;
+ avail = sizeof (buffer) - used;
+ shift = need - avail;
+
+ memmove (buffer, buffer + shift, used - shift);
+ bufptr -= shift;
+ }
- shift = need - avail;
- memmove (buffer, buffer + shift, used - shift);
- bufptr -= shift;
-
do {
if ((r = noint_read (fd, bufptr + buflen, need)) == 0) {
eof = true;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches