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.
This commit is contained in:
Su Yu 2009-08-03 19:55:58 +02:00 committed by Werner Lemberg
parent 2b6a3f0be9
commit efaf5abcf8
3 changed files with 13 additions and 4 deletions

View File

@ -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 <mpsuzuki@hiroshima-u.ac.jp>
sfnt: Cast a charcode to 32-bit in cmap format 14 parser.

View File

@ -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;
}

View File

@ -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 );
}