diff --git a/ChangeLog b/ChangeLog index 6b11600fe..745be62f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-08-03 suyu0925@gmail.com + + Don't call `ft_fseek' every time when executing `ft_fread'. + + * src/base/ftstream.c (FT_Stream_Seek), src/base/ftsystem.c + (ft_ansi_stream_io): Implement it. + 2009-07-31 suzuki toshiya sfnt: Cast a charcode to 32-bit in cmap format 14 parser. diff --git a/src/base/ftstream.c b/src/base/ftstream.c index d2d1749fd..b638599db 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -60,8 +60,6 @@ FT_Error error = FT_Err_Ok; - stream->pos = pos; - if ( stream->read ) { if ( stream->read( stream, pos, 0, 0 ) ) @@ -83,6 +81,9 @@ error = FT_Err_Invalid_Stream_Operation; } + if ( !error ) + stream->pos = pos; + return error; } diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 251e59b84..4d06d6db5 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* ANSI-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2006, 2008 by */ +/* Copyright 1996-2001, 2002, 2006, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -205,7 +205,8 @@ file = STREAM_FILE( stream ); - ft_fseek( file, offset, SEEK_SET ); + if ( stream->pos != offset ) + ft_fseek( file, offset, SEEK_SET ); return (unsigned long)ft_fread( buffer, 1, count, file ); }