[Fontconfig] [PATCH] Update stream position after seeking is done

Jiang Jiang gzjjgod at gmail.com
Tue Nov 29 02:56:05 PST 2011


From: Jiang Jiang <jiang.jiang at nokia.com>

In stream->read function there will be check like if (stream->pos !=
pos) then fseek(...), so if stream->pos is set to pos before read then
the seek may never happen.
---
 src/ftglue.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/ftglue.c b/src/ftglue.c
index d5af810..b9e2129 100644
--- a/src/ftglue.c
+++ b/src/ftglue.c
@@ -82,7 +82,6 @@ ftglue_stream_seek( FT_Stream   stream,
 {
   FT_Error  error = 0;
 
-  stream->pos = pos;
   if ( stream->read )
   {
     if ( stream->read( stream, pos, 0, 0 ) )
@@ -91,6 +90,7 @@ ftglue_stream_seek( FT_Stream   stream,
   else if ( pos > stream->size )
     error = FT_Err_Invalid_Stream_Operation;
 
+  stream->pos = pos;
   LOG(( "ftglue:stream:seek(%ld) -> %d\n", pos, error ));
   return error;
 }
-- 
1.7.4.1



More information about the Fontconfig mailing list