|
|
|
@ -95,11 +95,11 @@ |
|
|
|
|
if ( distance < 0 ) |
|
|
|
|
return FT_THROW( Invalid_Stream_Operation ); |
|
|
|
|
|
|
|
|
|
return FT_Stream_Seek( stream, (FT_ULong)( stream->pos + distance ) ); |
|
|
|
|
return FT_Stream_Seek( stream, stream->pos + (FT_ULong)distance ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_BASE_DEF( FT_Long ) |
|
|
|
|
FT_BASE_DEF( FT_ULong ) |
|
|
|
|
FT_Stream_Pos( FT_Stream stream ) |
|
|
|
|
{ |
|
|
|
|
return stream->pos; |
|
|
|
@ -260,7 +260,9 @@ |
|
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_MEMORY |
|
|
|
|
/* assume _ft_debug_file and _ft_debug_lineno are already set */ |
|
|
|
|
stream->base = (unsigned char*)ft_mem_qalloc( memory, count, &error ); |
|
|
|
|
stream->base = (unsigned char*)ft_mem_qalloc( memory, |
|
|
|
|
(FT_Long)count, |
|
|
|
|
&error ); |
|
|
|
|
if ( error ) |
|
|
|
|
goto Exit; |
|
|
|
|
#else |
|
|
|
@ -348,7 +350,7 @@ |
|
|
|
|
|
|
|
|
|
result = 0; |
|
|
|
|
if ( stream->cursor < stream->limit ) |
|
|
|
|
result = *stream->cursor++; |
|
|
|
|
result = (FT_Char)*stream->cursor++; |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -357,8 +359,8 @@ |
|
|
|
|
FT_BASE_DEF( FT_UShort ) |
|
|
|
|
FT_Stream_GetUShort( FT_Stream stream ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_Short result; |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_UShort result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream && stream->cursor ); |
|
|
|
@ -376,8 +378,8 @@ |
|
|
|
|
FT_BASE_DEF( FT_UShort ) |
|
|
|
|
FT_Stream_GetUShortLE( FT_Stream stream ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_Short result; |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_UShort result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream && stream->cursor ); |
|
|
|
@ -396,7 +398,7 @@ |
|
|
|
|
FT_Stream_GetUOffset( FT_Stream stream ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_Long result; |
|
|
|
|
FT_ULong result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream && stream->cursor ); |
|
|
|
@ -414,7 +416,7 @@ |
|
|
|
|
FT_Stream_GetULong( FT_Stream stream ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_Long result; |
|
|
|
|
FT_ULong result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream && stream->cursor ); |
|
|
|
@ -432,7 +434,7 @@ |
|
|
|
|
FT_Stream_GetULongLE( FT_Stream stream ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte* p; |
|
|
|
|
FT_Long result; |
|
|
|
|
FT_ULong result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream && stream->cursor ); |
|
|
|
@ -471,7 +473,7 @@ |
|
|
|
|
} |
|
|
|
|
stream->pos++; |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
return (FT_Char)result; |
|
|
|
|
|
|
|
|
|
Fail: |
|
|
|
|
*error = FT_THROW( Invalid_Stream_Operation ); |
|
|
|
@ -485,11 +487,11 @@ |
|
|
|
|
|
|
|
|
|
FT_BASE_DEF( FT_UShort ) |
|
|
|
|
FT_Stream_ReadUShort( FT_Stream stream, |
|
|
|
|
FT_Error* error ) |
|
|
|
|
FT_Error* error ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte reads[2]; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_Short result = 0; |
|
|
|
|
FT_Byte reads[2]; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_UShort result = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream ); |
|
|
|
@ -506,9 +508,7 @@ |
|
|
|
|
p = reads; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
p = stream->base + stream->pos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( p ) |
|
|
|
|
result = FT_NEXT_USHORT( p ); |
|
|
|
@ -532,11 +532,11 @@ |
|
|
|
|
|
|
|
|
|
FT_BASE_DEF( FT_UShort ) |
|
|
|
|
FT_Stream_ReadUShortLE( FT_Stream stream, |
|
|
|
|
FT_Error* error ) |
|
|
|
|
FT_Error* error ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte reads[2]; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_Short result = 0; |
|
|
|
|
FT_Byte reads[2]; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_UShort result = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream ); |
|
|
|
@ -553,9 +553,7 @@ |
|
|
|
|
p = reads; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
p = stream->base + stream->pos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( p ) |
|
|
|
|
result = FT_NEXT_USHORT_LE( p ); |
|
|
|
@ -579,11 +577,11 @@ |
|
|
|
|
|
|
|
|
|
FT_BASE_DEF( FT_ULong ) |
|
|
|
|
FT_Stream_ReadUOffset( FT_Stream stream, |
|
|
|
|
FT_Error* error ) |
|
|
|
|
FT_Error* error ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte reads[3]; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_Long result = 0; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_ULong result = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream ); |
|
|
|
@ -600,9 +598,7 @@ |
|
|
|
|
p = reads; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
p = stream->base + stream->pos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( p ) |
|
|
|
|
result = FT_NEXT_UOFF3( p ); |
|
|
|
@ -626,11 +622,11 @@ |
|
|
|
|
|
|
|
|
|
FT_BASE_DEF( FT_ULong ) |
|
|
|
|
FT_Stream_ReadULong( FT_Stream stream, |
|
|
|
|
FT_Error* error ) |
|
|
|
|
FT_Error* error ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte reads[4]; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_Long result = 0; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_ULong result = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream ); |
|
|
|
@ -647,9 +643,7 @@ |
|
|
|
|
p = reads; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
p = stream->base + stream->pos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( p ) |
|
|
|
|
result = FT_NEXT_ULONG( p ); |
|
|
|
@ -673,11 +667,11 @@ |
|
|
|
|
|
|
|
|
|
FT_BASE_DEF( FT_ULong ) |
|
|
|
|
FT_Stream_ReadULongLE( FT_Stream stream, |
|
|
|
|
FT_Error* error ) |
|
|
|
|
FT_Error* error ) |
|
|
|
|
{ |
|
|
|
|
FT_Byte reads[4]; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_Long result = 0; |
|
|
|
|
FT_Byte* p = 0; |
|
|
|
|
FT_ULong result = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( stream ); |
|
|
|
@ -694,9 +688,7 @@ |
|
|
|
|
p = reads; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
p = stream->base + stream->pos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( p ) |
|
|
|
|
result = FT_NEXT_ULONG_LE( p ); |
|
|
|
|