Commit fdc225b153d5ad0ebcacfee96692fa61e603272d

David Turner 2000-01-17T11:21:49

fixed another small bug in the FT_Read_xxxx functions (they didn't updated the stream position in the case of disk-based streams. This went un-noticed under Linux which uses memory-mapped files by default)

diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index c6131d5..0a40fb3 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -285,10 +285,11 @@
     else
     {
       if (stream->pos < stream->size)
-        result = stream->base[stream->pos++];
+        result = stream->base[stream->pos];
       else
         goto Fail;
     }
+    stream->pos++;
     return result;
 
   Fail:
@@ -327,13 +328,11 @@
       }
 
       if (p)
-      {
-        result       = NEXT_Short(p);
-        stream->pos += 2;
-      }
+        result = NEXT_Short(p);
     }
     else goto Fail;
 
+    stream->pos += 2;
     return result;
 
   Fail:
@@ -372,13 +371,11 @@
       }
 
       if (p)
-      {
-        result       = NEXT_Offset(p);
-        stream->pos += 3;
-      }
+        result = NEXT_Offset(p);
     }
     else goto Fail;
 
+    stream->pos += 3;
     return result;
 
   Fail:
@@ -417,13 +414,11 @@
       }
 
       if (p)
-      {
-        result       = NEXT_Long(p);
-        stream->pos += 4;
-      }
+        result = NEXT_Long(p);
     }
     else goto Fail;
 
+    stream->pos += 4;
     return result;
 
   Fail: