Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ace0c7d5943399be8235d684d03fb2e5 > files > 11

freetype-2.2.1-28.el5_7.1.src.rpm

--- freetype-2.2.1/src/base/ftstream.c	2010-08-26 16:44:56.000000000 +0200
+++ freetype-2.2.1/src/base/ftstream.c	2010-08-26 16:47:41.000000000 +0200
@@ -60,26 +60,30 @@
     FT_Error  error = FT_Err_Ok;
 
 
-    stream->pos = pos;
+    /* note that seeking to the first position after the file is valid */
+    if ( pos > stream->size )
+    {
+      FT_ERROR(( "FT_Stream_Seek:"
+                 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+                 pos, stream->size ));
 
-    if ( stream->read )
+      error = FT_Err_Invalid_Stream_Operation;
+    }
+
+    if ( !error && stream->read )
     {
       if ( stream->read( stream, pos, 0, 0 ) )
       {
-        FT_ERROR(( "FT_Stream_Seek: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
+        FT_ERROR(( "FT_Stream_Seek:"
+                   " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                    pos, stream->size ));
 
         error = FT_Err_Invalid_Stream_Operation;
       }
     }
-    /* note that seeking to the first position after the file is valid */
-    else if ( pos > stream->size )
-    {
-      FT_ERROR(( "FT_Stream_Seek: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
-                 pos, stream->size ));
 
-      error = FT_Err_Invalid_Stream_Operation;
-    }
+    if ( !error )
+      stream->pos = pos;
 
     return error;
   }