From a890c29cb06f990ac19ada14eae0f9513bb9ed88 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 22 Mar 2002 12:55:23 +0000 Subject: [PATCH] * include/freetype/internal/ftstream.h, src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c, src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c, src/sfnt/ttpost.c, src/sfnt/ttsbit.c, src/truetype/ttgload.c, src/truetype/ttpload.c, src/winfonts/winfnt.c: changed the definitions of stream macros. Examples: NEXT_Byte => FT_NEXT_BYTE NEXT_Short => FT_NEXT_SHORT NEXT_UShortLE => FT_NEXT_USHORT_LE READ_Short => FT_READ_SHORT GET_Long => FT_GET_LONG etc.. also introduced the FT_PEEK_XXXX functions.. --- ChangeLog | 21 +++ include/freetype/internal/ftstream.h | 209 ++++++++++++++------------- src/base/ftstream.c | 34 ++--- src/cff/cffload.c | 38 ++--- src/pcf/pcfread.c | 62 ++++---- src/sfnt/ttcmap.c | 68 ++++----- src/sfnt/ttcmap0.c | 10 +- src/sfnt/ttload.c | 62 ++++---- src/sfnt/ttpost.c | 8 +- src/sfnt/ttsbit.c | 36 ++--- src/truetype/ttgload.c | 54 +++---- src/truetype/ttpload.c | 6 +- src/winfonts/winfnt.c | 16 +- 13 files changed, 326 insertions(+), 298 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7f105d44..eeef68d09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2002-03-22 David Turner + + * include/freetype/internal/ftstream.h, + src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c, + src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c, + src/sfnt/ttpost.c, src/sfnt/ttsbit.c, + src/truetype/ttgload.c, src/truetype/ttpload.c, + src/winfonts/winfnt.c: + + changed the definitions of stream macros. Examples: + + NEXT_Byte => FT_NEXT_BYTE + NEXT_Short => FT_NEXT_SHORT + NEXT_UShortLE => FT_NEXT_USHORT_LE + READ_Short => FT_READ_SHORT + GET_Long => FT_GET_LONG + etc.. + + also introduced the FT_PEEK_XXXX functions.. + + 2002-03-21 David Turner * src/base/ftobjs.c, src/pcf/pcfdriver.c, src/pcf/pcfread.c: updated diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h index fcef640e6..a9c4450a3 100644 --- a/include/freetype/internal/ftstream.h +++ b/include/freetype/internal/ftstream.h @@ -153,110 +153,117 @@ FT_BEGIN_HEADER /* type `char*' or equivalent (1-byte elements). */ /* */ -#define FT_GET_SHORT_BE( p ) \ - ((FT_Int16)( ( (FT_Int16)(FT_Char)(p)[0] << 8 ) | \ - (FT_Int16)(FT_Byte)(p)[1] ) ) +#define FT_BYTE_(p,i) (((const FT_Byte*)(p))[(i)]) +#define FT_INT8_(p,i) (((const FT_Char*)(p))[(i)]) -#define FT_GET_USHORT_BE( p ) \ - ((FT_Int16)( ( (FT_UInt16)(FT_Byte)(p)[0] << 8 ) | \ - (FT_UInt16)(FT_Byte)(p)[1] ) ) +#define FT_INT16(x) ((FT_Int16)(x)) +#define FT_UINT16(x) ((FT_UInt16)(x)) +#define FT_INT32(x) ((FT_Int32)(x)) +#define FT_UINT32(x) ((FT_UInt32)(x)) -#define FT_GET_OFF3_BE( p ) \ - ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[0] << 16 ) | \ - ( (FT_Int32)(FT_Byte)(p)[1] << 8 ) | \ - (FT_Int32)(FT_Byte)(p)[2] ) ) +#define FT_BYTE_I16(p,i,s) (FT_INT16( FT_BYTE_(p,i)) << (s)) +#define FT_BYTE_U16(p,i,s) (FT_UINT16(FT_BYTE_(p,i)) << (s)) +#define FT_BYTE_I32(p,i,s) (FT_INT32( FT_BYTE_(p,i)) << (s)) +#define FT_BYTE_U32(p,i,s) (FT_UINT32(FT_BYTE_(p,i)) << (s)) -#define FT_GET_UOFF3_BE( p ) \ - ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[0] << 16 ) | \ - ( (FT_UInt32)(FT_Byte)(p)[1] << 8 ) | \ - (FT_UInt32)(FT_Byte)(p)[2] ) ) +#define FT_INT8_I16(p,i,s) (FT_INT16( FT_INT8_(p,i)) << (s)) +#define FT_INT8_U16(p,i,s) (FT_UINT16(FT_INT8_(p,i)) << (s)) +#define FT_INT8_I32(p,i,s) (FT_INT32( FT_INT8_(p,i)) << (s)) +#define FT_INT8_U32(p,i,s) (FT_UINT32(FT_INT8_(p,i)) << (s)) -#define FT_GET_LONG_BE( p ) \ - ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[0] << 24 ) | \ - ( (FT_Int32)(FT_Byte)(p)[1] << 16 ) | \ - ( (FT_Int32)(FT_Byte)(p)[2] << 8 ) | \ - (FT_Int32)(FT_Byte)(p)[3] ) ) +#define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16(p,0,8) | \ + FT_BYTE_I16(p,1,0) ) -#define FT_GET_ULONG_BE( p ) \ - ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[0] << 24 ) | \ - ( (FT_UInt32)(FT_Byte)(p)[1] << 16 ) | \ - ( (FT_UInt32)(FT_Byte)(p)[2] << 8 ) | \ - (FT_UInt32)(FT_Byte)(p)[3] ) ) +#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16(p,0,8) | \ + FT_BYTE_U16(p,1,0) ) -#define FT_GET_SHORT_LE( p ) \ - ((FT_Int16)( ( (FT_Int16)(FT_Char)(p)[1] << 8 ) | \ - (FT_Int16)(FT_Byte)(p)[0] ) ) +#define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32(p,0,24) | \ + FT_BYTE_I32(p,1,16) | \ + FT_BYTE_I32(p,2, 8) | \ + FT_BYTE_I32(p,3, 0) ) -#define FT_GET_USHORT_LE( p ) \ - ((FT_Int16)( ( (FT_UInt16)(FT_Byte)(p)[1] << 8 ) | \ - (FT_UInt16)(FT_Byte)(p)[0] ) ) +#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32(p,0,24) | \ + FT_BYTE_U32(p,1,16) | \ + FT_BYTE_U32(p,2, 8) | \ + FT_BYTE_U32(p,3, 0) ) -#define FT_GET_OFF3_LE( p ) \ - ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[2] << 16 ) | \ - ( (FT_Int32)(FT_Byte)(p)[1] << 8 ) | \ - (FT_Int32)(FT_Byte)(p)[0] ) ) +#define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32(p,0,16) | \ + FT_BYTE_I32(p,1, 8) | \ + FT_BYTE_I32(p,2, 0) ) -#define FT_GET_UOFF3_LE( p ) \ - ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[2] << 16 ) | \ - ( (FT_UInt32)(FT_Byte)(p)[1] << 8 ) | \ - (FT_UInt32)(FT_Byte)(p)[0] ) ) - -#define FT_GET_LONG_LE( p ) \ - ( (FT_Int32) ( ( (FT_Int32)(FT_Char)(p)[3] << 24 ) | \ - ( (FT_Int32)(FT_Byte)(p)[2] << 16 ) | \ - ( (FT_Int32)(FT_Byte)(p)[1] << 8 ) | \ - (FT_Int32)(FT_Byte)(p)[0] ) ) - -#define FT_GET_ULONG_LE( p ) \ - ( (FT_Int32) ( ( (FT_UInt32)(FT_Byte)(p)[3] << 24 ) | \ - ( (FT_UInt32)(FT_Byte)(p)[2] << 16 ) | \ - ( (FT_UInt32)(FT_Byte)(p)[1] << 8 ) | \ - (FT_UInt32)(FT_Byte)(p)[0] ) ) +#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32(p,0,16) | \ + FT_BYTE_U32(p,1, 8) | \ + FT_BYTE_U32(p,2, 0) ) -#define NEXT_Char( buffer ) \ +#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16(p,1,8) | \ + FT_BYTE_I16(p,0,0) ) + +#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16(p,1,8) | \ + FT_BYTE_U16(p,0,0) ) + +#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32(p,3,24) | \ + FT_BYTE_I32(p,2,16) | \ + FT_BYTE_I32(p,1, 8) | \ + FT_BYTE_I32(p,0, 0) ) + +#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32(p,3,24) | \ + FT_BYTE_U32(p,2,16) | \ + FT_BYTE_U32(p,1, 8) | \ + FT_BYTE_U32(p,0, 0) ) + +#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32(p,2,16) | \ + FT_BYTE_I32(p,1, 8) | \ + FT_BYTE_I32(p,0, 0) ) + +#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32(p,2,16) | \ + FT_BYTE_U32(p,1, 8) | \ + FT_BYTE_U32(p,0, 0) ) + + +#define FT_NEXT_CHAR( buffer ) \ ( (signed char)*buffer++ ) -#define NEXT_Byte( buffer ) \ +#define FT_NEXT_BYTE( buffer ) \ ( (unsigned char)*buffer++ ) -#define NEXT_Short( buffer ) \ - ( (short)( buffer += 2, FT_GET_SHORT_BE( buffer - 2 ) ) ) +#define FT_NEXT_SHORT( buffer ) \ + ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) ) -#define NEXT_UShort( buffer ) \ - ( (unsigned short)( buffer += 2, FT_GET_USHORT_BE( buffer - 2 ) ) ) +#define FT_NEXT_USHORT( buffer ) \ + ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) ) -#define NEXT_Offset( buffer ) \ - ( (long)( buffer += 3, FT_GET_OFF3_BE( buffer - 3 ) ) ) +#define FT_NEXT_OFF3( buffer ) \ + ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) ) -#define NEXT_UOffset( buffer ) \ - ( (unsigned long)( buffer += 3, FT_GET_UOFF3_BE( buffer - 3 ) ) ) +#define FT_NEXT_UOFF3( buffer ) \ + ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) ) -#define NEXT_Long( buffer ) \ - ( (long)( buffer += 4, FT_GET_LONG_BE( buffer - 4 ) ) ) +#define FT_NEXT_LONG( buffer ) \ + ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) ) -#define NEXT_ULong( buffer ) \ - ( (unsigned long)( buffer += 4, FT_GET_ULONG_BE( buffer - 4 ) ) ) +#define FT_NEXT_ULONG( buffer ) \ + ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) ) -#define NEXT_ShortLE( buffer ) \ - ( (short)( buffer += 2, FT_GET_SHORT_LE( buffer - 2 ) ) ) +#define FT_NEXT_SHORT_LE( buffer ) \ + ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) ) -#define NEXT_UShortLE( buffer ) \ - ( (unsigned short)( buffer += 2, FT_GET_USHORT_LE( buffer - 2 ) ) ) +#define FT_NEXT_USHORT_LE( buffer ) \ + ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) ) -#define NEXT_OffsetLE( buffer ) \ - ( (long)( buffer += 3, FT_GET_OFF3_LE( buffer - 3 ) ) ) +#define FT_NEXT_OFF3_LE( buffer ) \ + ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) ) -#define NEXT_UOffsetLE( buffer ) \ - ( (unsigned long)( buffer += 3, FT_GET_UOFF3_LE( buffer - 3 ) ) ) +#define FT_NEXT_UOFF3_LE( buffer ) \ + ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) ) -#define NEXT_LongLE( buffer ) \ - ( (long)( buffer += 4, FT_GET_LONG_LE( buffer - 4 ) ) ) +#define FT_NEXT_LONG_LE( buffer ) \ + ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) ) -#define NEXT_ULongLE( buffer ) \ - ( (unsigned long)( buffer += 4, FT_GET_ULONG_LE( buffer - 4 ) ) ) +#define FT_NEXT_ULONG_LE( buffer ) \ + ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) ) /*************************************************************************/ @@ -265,38 +272,38 @@ FT_BEGIN_HEADER /* */ #define FT_GET_MACRO( func, type ) ( (type)func( stream ) ) -#define GET_Char() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) -#define GET_Byte() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) -#define GET_Short() FT_GET_MACRO( FT_Stream_GetShort, FT_Short ) -#define GET_UShort() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort ) -#define GET_Offset() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long ) -#define GET_UOffset() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong ) -#define GET_Long() FT_GET_MACRO( FT_Stream_GetLong, FT_Long ) -#define GET_ULong() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) -#define GET_Tag4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) +#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) +#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) +#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short ) +#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort ) +#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long ) +#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong ) +#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long ) +#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) +#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) -#define GET_ShortLE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short ) -#define GET_UShortLE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort ) -#define GET_LongLE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long ) -#define GET_ULongLE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong ) +#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short ) +#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort ) +#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long ) +#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong ) #define FT_READ_MACRO( func, type, var ) \ ( var = (type)func( stream, &error ), \ error != FT_Err_Ok ) -#define READ_Byte( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var ) -#define READ_Char( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var ) -#define READ_Short( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var ) -#define READ_UShort( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var ) -#define READ_Offset( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var ) -#define READ_UOffset( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var ) -#define READ_Long( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var ) -#define READ_ULong( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var ) +#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var ) +#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var ) +#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var ) +#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var ) +#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var ) +#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var ) +#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var ) +#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var ) -#define READ_ShortLE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var ) -#define READ_UShortLE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var ) -#define READ_LongLE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var ) -#define READ_ULongLE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var ) +#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var ) +#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var ) +#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var ) +#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var ) diff --git a/src/base/ftstream.c b/src/base/ftstream.c index c1fa989b2..7fafbcf83 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -307,7 +307,7 @@ result = 0; p = stream->cursor; if ( p + 1 < stream->limit ) - result = NEXT_Short( p ); + result = FT_NEXT_SHORT( p ); stream->cursor = p; return result; @@ -326,7 +326,7 @@ result = 0; p = stream->cursor; if ( p + 1 < stream->limit ) - result = NEXT_ShortLE( p ); + result = FT_NEXT_SHORT_LE( p ); stream->cursor = p; return result; @@ -345,7 +345,7 @@ result = 0; p = stream->cursor; if ( p + 2 < stream->limit ) - result = NEXT_Offset( p ); + result = FT_NEXT_OFF3( p ); stream->cursor = p; return result; } @@ -363,7 +363,7 @@ result = 0; p = stream->cursor; if ( p + 3 < stream->limit ) - result = NEXT_Long( p ); + result = FT_NEXT_LONG( p ); stream->cursor = p; return result; } @@ -381,7 +381,7 @@ result = 0; p = stream->cursor; if ( p + 3 < stream->limit ) - result = NEXT_LongLE( p ); + result = FT_NEXT_LONG_LE( p ); stream->cursor = p; return result; } @@ -451,7 +451,7 @@ } if ( p ) - result = NEXT_Short( p ); + result = FT_NEXT_SHORT( p ); } else goto Fail; @@ -498,7 +498,7 @@ } if ( p ) - result = NEXT_ShortLE( p ); + result = FT_NEXT_SHORT_LE( p ); } else goto Fail; @@ -545,7 +545,7 @@ } if ( p ) - result = NEXT_Offset( p ); + result = FT_NEXT_OFF3( p ); } else goto Fail; @@ -591,7 +591,7 @@ } if ( p ) - result = NEXT_Long( p ); + result = FT_NEXT_LONG( p ); } else goto Fail; @@ -637,7 +637,7 @@ } if ( p ) - result = NEXT_LongLE( p ); + result = FT_NEXT_LONG_LE( p ); } else goto Fail; @@ -713,43 +713,43 @@ case ft_frame_byte: case ft_frame_schar: /* read a single byte */ - value = NEXT_Byte(cursor); + value = FT_NEXT_BYTE(cursor); sign_shift = 24; break; case ft_frame_short_be: case ft_frame_ushort_be: /* read a 2-byte big-endian short */ - value = NEXT_UShort(cursor); + value = FT_NEXT_USHORT(cursor); sign_shift = 16; break; case ft_frame_short_le: case ft_frame_ushort_le: /* read a 2-byte little-endian short */ - value = NEXT_UShortLE(cursor); + value = FT_NEXT_USHORT_LE(cursor); sign_shift = 16; break; case ft_frame_long_be: case ft_frame_ulong_be: /* read a 4-byte big-endian long */ - value = NEXT_ULong(cursor); + value = FT_NEXT_ULONG(cursor); sign_shift = 0; break; case ft_frame_long_le: case ft_frame_ulong_le: /* read a 4-byte little-endian long */ - value = NEXT_ULongLE(cursor); + value = FT_NEXT_ULONG_LE(cursor); sign_shift = 0; break; case ft_frame_off3_be: case ft_frame_uoff3_be: /* read a 3-byte big-endian long */ - value = NEXT_UOffset(cursor); + value = FT_NEXT_UOFF3(cursor); sign_shift = 8; break; case ft_frame_off3_le: case ft_frame_uoff3_le: /* read a 3-byte little-endian long */ - value = NEXT_UOffsetLE(cursor); + value = FT_NEXT_UOFF3_LE(cursor); sign_shift = 8; break; diff --git a/src/cff/cffload.c b/src/cff/cffload.c index df0ca3b05..057348f88 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1094,7 +1094,7 @@ MEM_Set( idx, 0, sizeof ( *idx ) ); idx->stream = stream; - if ( !READ_UShort( count ) && + if ( !FT_READ_USHORT( count ) && count > 0 ) { FT_Byte* p; @@ -1105,7 +1105,7 @@ /* there is at least one element; read the offset size, */ /* then access the offset table to compute the index's total size */ - if ( READ_Byte( offsize ) ) + if ( FT_READ_BYTE( offsize ) ) goto Exit; idx->stream = stream; @@ -1381,7 +1381,7 @@ /* read format */ - if ( FT_STREAM_SEEK( offset ) || READ_Byte( format ) ) + if ( FT_STREAM_SEEK( offset ) || FT_READ_BYTE( format ) ) goto Exit; select->format = format; @@ -1394,7 +1394,7 @@ goto Load_Data; case 3: /* format 3, a tad more complex */ - if ( READ_UShort( num_ranges ) ) + if ( FT_READ_USHORT( num_ranges ) ) goto Exit; select->data_size = num_ranges * 3 + 2; @@ -1442,14 +1442,14 @@ FT_UInt first, limit; - first = NEXT_UShort( p ); + first = FT_NEXT_USHORT( p ); do { if ( glyph_index < first ) break; fd2 = *p++; - limit = NEXT_UShort( p ); + limit = FT_NEXT_USHORT( p ); if ( glyph_index < limit ) { @@ -1529,7 +1529,7 @@ /* Get the format of the table. */ if ( FT_STREAM_SEEK( charset->offset ) || - READ_Byte( charset->format ) ) + FT_READ_BYTE( charset->format ) ) goto Exit; /* If the the offset is greater than 2, we have to parse the */ @@ -1551,7 +1551,7 @@ case 0: for ( j = 1; j < num_glyphs; j++ ) { - if ( READ_UShort( glyph_sid ) ) + if ( FT_READ_USHORT( glyph_sid ) ) goto Exit; charset->sids[j] = glyph_sid; @@ -1571,18 +1571,18 @@ { /* Read the first glyph sid of the range. */ - if ( READ_UShort( glyph_sid ) ) + if ( FT_READ_USHORT( glyph_sid ) ) goto Exit; /* Read the number of glyphs in the range. */ if ( charset->format == 2 ) { - if ( READ_UShort( nleft ) ) + if ( FT_READ_USHORT( nleft ) ) goto Exit; } else { - if ( READ_Byte( nleft ) ) + if ( FT_READ_BYTE( nleft ) ) goto Exit; } @@ -1747,8 +1747,8 @@ /* we need to parse the table to determine its size */ if ( FT_STREAM_SEEK( encoding->offset ) || - READ_Byte( encoding->format ) || - READ_Byte( count ) ) + FT_READ_BYTE( encoding->format ) || + FT_READ_BYTE( count ) ) goto Exit; switch ( encoding->format & 0x7F ) @@ -1756,7 +1756,7 @@ case 0: for ( j = 1; j <= count; j++ ) { - if ( READ_Byte( glyph_code ) ) + if ( FT_READ_BYTE( glyph_code ) ) goto Exit; /* Make sure j is not too big. */ @@ -1783,11 +1783,11 @@ for ( j = 0; j < count; j++, i += nleft ) { /* Read the first glyph code of the range. */ - if ( READ_Byte( glyph_code ) ) + if ( FT_READ_BYTE( glyph_code ) ) goto Exit; /* Read the number of codes in the range. */ - if ( READ_Byte( nleft ) ) + if ( FT_READ_BYTE( nleft ) ) goto Exit; /* Increment nleft, so we read `nleft + 1' codes/sids. */ @@ -1823,17 +1823,17 @@ /* count supplements */ - if ( READ_Byte( count ) ) + if ( FT_READ_BYTE( count ) ) goto Exit; for ( j = 0; j < count; j++ ) { /* Read supplemental glyph code. */ - if ( READ_Byte( glyph_code ) ) + if ( FT_READ_BYTE( glyph_code ) ) goto Exit; /* Read the SID associated with this glyph code. */ - if ( READ_UShort( glyph_sid ) ) + if ( FT_READ_USHORT( glyph_sid ) ) goto Exit; /* Assign code to SID mapping. */ diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index 582b1a546..91032ee1a 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -366,7 +366,7 @@ THE SOFTWARE. if ( error ) goto Bail; - if ( READ_ULongLE( format ) ) + if ( FT_READ_ULONG_LE( format ) ) goto Bail; FT_TRACE4(( "get_prop: format = %ld\n", format )); @@ -375,9 +375,9 @@ THE SOFTWARE. goto Bail; if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)READ_ULong( nprops ); + (void)FT_READ_ULONG( nprops ); else - (void)READ_ULongLE( nprops ); + (void)FT_READ_ULONG_LE( nprops ); if ( error ) goto Bail; @@ -412,9 +412,9 @@ THE SOFTWARE. } if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)READ_ULong( string_size ); + (void)FT_READ_ULONG( string_size ); else - (void)READ_ULongLE( string_size ); + (void)FT_READ_ULONG_LE( string_size ); if ( error ) goto Bail; @@ -491,7 +491,7 @@ THE SOFTWARE. if ( error ) return error; - error = READ_ULongLE( format ); + error = FT_READ_ULONG_LE( format ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ) @@ -500,16 +500,16 @@ THE SOFTWARE. if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)READ_ULong( nmetrics ); + (void)FT_READ_ULONG( nmetrics ); else - (void)READ_ULongLE( nmetrics ); + (void)FT_READ_ULONG_LE( nmetrics ); } else { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)READ_UShort( nmetrics ); + (void)FT_READ_USHORT( nmetrics ); else - (void)READ_UShortLE( nmetrics ); + (void)FT_READ_USHORT_LE( nmetrics ); } if ( error || nmetrics == -1 ) return PCF_Err_Invalid_File_Format; @@ -572,11 +572,11 @@ THE SOFTWARE. if ( error ) return error; - format = GET_ULongLE(); + format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - nbitmaps = GET_ULong(); + nbitmaps = FT_GET_ULONG(); else - nbitmaps = GET_ULongLE(); + nbitmaps = FT_GET_ULONG_LE(); FT_Stream_ExitFrame( stream ); @@ -592,9 +592,9 @@ THE SOFTWARE. for ( i = 0; i < nbitmaps; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)READ_Long( offsets[i] ); + (void)FT_READ_LONG( offsets[i] ); else - (void)READ_LongLE( offsets[i] ); + (void)FT_READ_LONG_LE( offsets[i] ); FT_TRACE4(( "bitmap %d is at offset %ld\n", i, offsets[i] )); } @@ -604,9 +604,9 @@ THE SOFTWARE. for ( i = 0; i < GLYPHPADOPTIONS; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - (void)READ_Long( bitmapSizes[i] ); + (void)FT_READ_LONG( bitmapSizes[i] ); else - (void)READ_LongLE( bitmapSizes[i] ); + (void)FT_READ_LONG_LE( bitmapSizes[i] ); if ( error ) goto Bail; @@ -664,23 +664,23 @@ THE SOFTWARE. if ( error ) return error; - format = GET_ULongLE(); + format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { - firstCol = GET_Short(); - lastCol = GET_Short(); - firstRow = GET_Short(); - lastRow = GET_Short(); - face->defaultChar = GET_Short(); + firstCol = FT_GET_SHORT(); + lastCol = FT_GET_SHORT(); + firstRow = FT_GET_SHORT(); + lastRow = FT_GET_SHORT(); + face->defaultChar = FT_GET_SHORT(); } else { - firstCol = GET_ShortLE(); - lastCol = GET_ShortLE(); - firstRow = GET_ShortLE(); - lastRow = GET_ShortLE(); - face->defaultChar = GET_ShortLE(); + firstCol = FT_GET_SHORT_LE(); + lastCol = FT_GET_SHORT_LE(); + firstRow = FT_GET_SHORT_LE(); + lastRow = FT_GET_SHORT_LE(); + face->defaultChar = FT_GET_SHORT_LE(); } FT_Stream_ExitFrame( stream ); @@ -703,9 +703,9 @@ THE SOFTWARE. for ( i = 0, j = 0 ; i < nencoding; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - encodingOffset = GET_Short(); + encodingOffset = FT_GET_SHORT(); else - encodingOffset = GET_ShortLE(); + encodingOffset = FT_GET_SHORT_LE(); if ( encodingOffset != -1 ) { @@ -808,7 +808,7 @@ THE SOFTWARE. if ( error ) goto Bail; - error = READ_ULongLE( format ); + error = FT_READ_ULONG_LE( format ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && !PCF_FORMAT_MATCH( format, PCF_ACCEL_W_INKBOUNDS ) ) diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 665b2ddad..6512e065a 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -143,7 +143,7 @@ case 0: cmap0 = &cmap->c.cmap0; - if ( READ_UShort( cmap0->language ) || + if ( FT_READ_USHORT( cmap0->language ) || ALLOC( cmap0->glyphIdArray, 256L ) || FT_STREAM_READ( cmap0->glyphIdArray, 256L ) ) goto Fail; @@ -162,11 +162,11 @@ FT_FRAME_ENTER( 2L + 512L ) ) goto Fail; - cmap2->language = GET_UShort(); + cmap2->language = FT_GET_USHORT(); for ( i = 0; i < 256; i++ ) { - u = (FT_UShort)( GET_UShort() / 8 ); + u = (FT_UShort)( FT_GET_USHORT() / 8 ); cmap2->subHeaderKeys[i] = u; if ( num_SH < u ) @@ -193,12 +193,12 @@ for ( i = 0; i <= num_SH; i++ ) { - cmap2sub->firstCode = GET_UShort(); - cmap2sub->entryCount = GET_UShort(); - cmap2sub->idDelta = GET_Short(); + cmap2sub->firstCode = FT_GET_USHORT(); + cmap2sub->entryCount = FT_GET_USHORT(); + cmap2sub->idDelta = FT_GET_SHORT(); /* we apply the location offset immediately */ cmap2sub->idRangeOffset = (FT_UShort)( - GET_UShort() - ( num_SH - i ) * 8 - 2 ); + FT_GET_USHORT() - ( num_SH - i ) * 8 - 2 ); cmap2sub++; } @@ -216,7 +216,7 @@ } for ( i = 0; i < l; i++ ) - cmap2->glyphIdArray[i] = GET_UShort(); + cmap2->glyphIdArray[i] = FT_GET_USHORT(); FT_FRAME_EXIT(); @@ -232,11 +232,11 @@ if ( FT_FRAME_ENTER( 10L ) ) goto Fail; - cmap4->language = GET_UShort(); - cmap4->segCountX2 = GET_UShort(); - cmap4->searchRange = GET_UShort(); - cmap4->entrySelector = GET_UShort(); - cmap4->rangeShift = GET_UShort(); + cmap4->language = FT_GET_USHORT(); + cmap4->segCountX2 = FT_GET_USHORT(); + cmap4->searchRange = FT_GET_USHORT(); + cmap4->entrySelector = FT_GET_USHORT(); + cmap4->rangeShift = FT_GET_USHORT(); num_Seg = (FT_UShort)( cmap4->segCountX2 / 2 ); @@ -253,18 +253,18 @@ segments = cmap4->segments; for ( i = 0; i < num_Seg; i++ ) - segments[i].endCount = GET_UShort(); + segments[i].endCount = FT_GET_USHORT(); - (void)GET_UShort(); + (void)FT_GET_USHORT(); for ( i = 0; i < num_Seg; i++ ) - segments[i].startCount = GET_UShort(); + segments[i].startCount = FT_GET_USHORT(); for ( i = 0; i < num_Seg; i++ ) - segments[i].idDelta = GET_Short(); + segments[i].idDelta = FT_GET_SHORT(); for ( i = 0; i < num_Seg; i++ ) - segments[i].idRangeOffset = GET_UShort(); + segments[i].idRangeOffset = FT_GET_USHORT(); FT_FRAME_EXIT(); @@ -281,7 +281,7 @@ } for ( i = 0; i < l; i++ ) - cmap4->glyphIdArray[i] = GET_UShort(); + cmap4->glyphIdArray[i] = FT_GET_USHORT(); FT_FRAME_EXIT(); @@ -297,9 +297,9 @@ if ( FT_FRAME_ENTER( 6L ) ) goto Fail; - cmap6->language = GET_UShort(); - cmap6->firstCode = GET_UShort(); - cmap6->entryCount = GET_UShort(); + cmap6->language = FT_GET_USHORT(); + cmap6->firstCode = FT_GET_USHORT(); + cmap6->entryCount = FT_GET_USHORT(); FT_FRAME_EXIT(); @@ -310,7 +310,7 @@ goto Fail; for ( i = 0; i < l; i++ ) - cmap6->glyphIdArray[i] = GET_UShort(); + cmap6->glyphIdArray[i] = FT_GET_USHORT(); FT_FRAME_EXIT(); cmap->get_index = code_to_index6; @@ -324,8 +324,8 @@ if ( FT_FRAME_ENTER( 8L ) ) goto Fail; - cmap->length = GET_ULong(); - cmap8_12->language = GET_ULong(); + cmap->length = FT_GET_ULONG(); + cmap8_12->language = FT_GET_ULONG(); FT_FRAME_EXIT(); @@ -333,7 +333,7 @@ if ( FT_STREAM_SKIP( 8192L ) ) goto Fail; - if ( READ_ULong( cmap8_12->nGroups ) ) + if ( FT_READ_ULONG( cmap8_12->nGroups ) ) goto Fail; n = cmap8_12->nGroups; @@ -346,9 +346,9 @@ for ( j = 0; j < n; j++ ) { - groups[j].startCharCode = GET_ULong(); - groups[j].endCharCode = GET_ULong(); - groups[j].startGlyphID = GET_ULong(); + groups[j].startCharCode = FT_GET_ULONG(); + groups[j].endCharCode = FT_GET_ULONG(); + groups[j].startGlyphID = FT_GET_ULONG(); } FT_FRAME_EXIT(); @@ -365,10 +365,10 @@ if ( FT_FRAME_ENTER( 16L ) ) goto Fail; - cmap->length = GET_ULong(); - cmap10->language = GET_ULong(); - cmap10->startCharCode = GET_ULong(); - cmap10->numChars = GET_ULong(); + cmap->length = FT_GET_ULONG(); + cmap10->language = FT_GET_ULONG(); + cmap10->startCharCode = FT_GET_ULONG(); + cmap10->numChars = FT_GET_ULONG(); FT_FRAME_EXIT(); @@ -379,7 +379,7 @@ goto Fail; for ( j = 0; j < n; j++ ) - cmap10->glyphs[j] = GET_UShort(); + cmap10->glyphs[j] = FT_GET_USHORT(); FT_FRAME_EXIT(); cmap->get_index = code_to_index10; diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c index 52fbb93cc..778453d11 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap0.c @@ -1586,19 +1586,19 @@ return FT_Err_Invalid_Table; /* only recognize format 0 */ - if ( NEXT_UShort(p) != 0 ) + if ( FT_NEXT_USHORT(p) != 0 ) return FT_Err_Invalid_Table; - num_cmaps = NEXT_UShort(p); + num_cmaps = FT_NEXT_USHORT(p); for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- ) { FT_CharMapRec charmap; FT_UInt32 offset; - charmap.platform_id = NEXT_UShort(p); - charmap.encoding_id = NEXT_UShort(p); - offset = NEXT_ULong(p); + charmap.platform_id = FT_NEXT_USHORT(p); + charmap.encoding_id = FT_NEXT_USHORT(p); + offset = FT_NEXT_ULONG(p); if ( offset && table + offset + 2 < limit ) { diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 0b729e730..c47a67766 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -205,7 +205,7 @@ /* first of all, read the first 4 bytes. If it is `ttcf', then the */ /* file is a TrueType collection, otherwise it can be any other */ /* kind of font. */ - if ( READ_ULong( format_tag ) ) + if ( FT_READ_ULONG( format_tag ) ) goto Exit; if ( format_tag == TTAG_ttcf ) @@ -228,7 +228,7 @@ goto Exit; for ( n = 0; n < face->ttc_header.count; n++ ) - face->ttc_header.offsets[n] = GET_ULong(); + face->ttc_header.offsets[n] = FT_GET_ULONG(); FT_FRAME_EXIT(); @@ -241,7 +241,7 @@ /* seek to the appropriate TrueType file, then read tag */ if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) || - READ_Long( format_tag ) ) + FT_READ_LONG( format_tag ) ) goto Exit; } @@ -325,10 +325,10 @@ for ( ; entry < limit; entry++ ) { /* loop through the tables and get all entries */ - entry->Tag = GET_Tag4(); - entry->CheckSum = GET_ULong(); - entry->Offset = GET_Long(); - entry->Length = GET_Long(); + entry->Tag = FT_GET_TAG4(); + entry->CheckSum = FT_GET_ULONG(); + entry->Offset = FT_GET_LONG(); + entry->Length = FT_GET_LONG(); FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n", (FT_Char)( entry->Tag >> 24 ), @@ -763,8 +763,8 @@ for ( ; cur < limit; cur++ ) { - cur->advance = GET_UShort(); - cur->bearing = GET_Short(); + cur->advance = FT_GET_USHORT(); + cur->bearing = FT_GET_SHORT(); } } @@ -775,7 +775,7 @@ for ( ; cur < limit; cur++ ) - *cur = GET_Short(); + *cur = FT_GET_SHORT(); /* we fill up the missing left side bearings with the */ /* last valid value. Since this will occur for buggy CJK */ @@ -1195,9 +1195,9 @@ cmap = &charmap->cmap; cmap->loaded = FALSE; - cmap->platformID = GET_UShort(); - cmap->platformEncodingID = GET_UShort(); - cmap->offset = (FT_ULong)GET_Long(); + cmap->platformID = FT_GET_USHORT(); + cmap->platformEncodingID = FT_GET_USHORT(); + cmap->offset = (FT_ULong)FT_GET_LONG(); } FT_FRAME_EXIT(); @@ -1526,8 +1526,8 @@ if ( FT_FRAME_ENTER( 4L ) ) goto Exit; - face->gasp.version = GET_UShort(); - face->gasp.numRanges = GET_UShort(); + face->gasp.version = FT_GET_USHORT(); + face->gasp.numRanges = FT_GET_USHORT(); FT_FRAME_EXIT(); @@ -1542,8 +1542,8 @@ for ( j = 0; j < num_ranges; j++ ) { - gaspranges[j].maxPPEM = GET_UShort(); - gaspranges[j].gaspFlag = GET_UShort(); + gaspranges[j].maxPPEM = FT_GET_USHORT(); + gaspranges[j].gaspFlag = FT_GET_USHORT(); FT_TRACE3(( " [max:%d flag:%d]", gaspranges[j].maxPPEM, @@ -1600,8 +1600,8 @@ if ( FT_FRAME_ENTER( 4L ) ) goto Exit; - (void)GET_UShort(); /* version */ - num_tables = GET_UShort(); + (void)FT_GET_USHORT(); /* version */ + num_tables = FT_GET_USHORT(); FT_FRAME_EXIT(); @@ -1614,9 +1614,9 @@ if ( FT_FRAME_ENTER( 6L ) ) goto Exit; - (void)GET_UShort(); /* version */ - length = GET_UShort() - 6; /* substract header length */ - coverage = GET_UShort(); + (void)FT_GET_USHORT(); /* version */ + length = FT_GET_USHORT() - 6; /* substract header length */ + coverage = FT_GET_USHORT(); FT_FRAME_EXIT(); @@ -1631,7 +1631,7 @@ if ( FT_FRAME_ENTER( 8L ) ) goto Exit; - num_pairs = GET_UShort(); + num_pairs = FT_GET_USHORT(); /* skip the rest */ @@ -1646,9 +1646,9 @@ limit = pair + num_pairs; for ( ; pair < limit; pair++ ) { - pair->left = GET_UShort(); - pair->right = GET_UShort(); - pair->value = GET_UShort(); + pair->left = FT_GET_USHORT(); + pair->right = FT_GET_USHORT(); + pair->value = FT_GET_USHORT(); } FT_FRAME_EXIT(); @@ -1753,9 +1753,9 @@ if ( FT_FRAME_ENTER( 8L ) ) goto Exit; - hdmx->version = GET_UShort(); - hdmx->num_records = GET_Short(); - record_size = GET_Long(); + hdmx->version = FT_GET_USHORT(); + hdmx->num_records = FT_GET_SHORT(); + record_size = FT_GET_LONG(); FT_FRAME_EXIT(); @@ -1777,8 +1777,8 @@ for ( ; cur < limit; cur++ ) { /* read record */ - if ( READ_Byte( cur->ppem ) || - READ_Byte( cur->max_width ) ) + if ( FT_READ_BYTE( cur->ppem ) || + FT_READ_BYTE( cur->max_width ) ) goto Exit; if ( ALLOC( cur->widths, num_glyphs ) || diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 7a5a49ae4..5219b5de6 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -165,7 +165,7 @@ FT_Char** name_strings = 0; - if ( READ_UShort( num_glyphs ) ) + if ( FT_READ_USHORT( num_glyphs ) ) goto Exit; /* UNDOCUMENTED! The number of glyphs in this table can be smaller */ @@ -190,7 +190,7 @@ goto Fail; for ( n = 0; n < num_glyphs; n++ ) - glyph_indices[n] = GET_UShort(); + glyph_indices[n] = FT_GET_USHORT(); FT_FRAME_EXIT(); } @@ -230,7 +230,7 @@ FT_UInt len; - if ( READ_Byte ( len ) || + if ( FT_READ_BYTE ( len ) || ALLOC_ARRAY( name_strings[n], len + 1, FT_Char ) || FT_STREAM_READ ( name_strings[n], len ) ) goto Fail1; @@ -282,7 +282,7 @@ /* UNDOCUMENTED! This value appears only in the Apple TT specs. */ - if ( READ_UShort( num_glyphs ) ) + if ( FT_READ_USHORT( num_glyphs ) ) goto Exit; /* check the number of glyphs */ diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index babff52c0..fcb1d9e14 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -228,7 +228,7 @@ FT_Error error; - if ( READ_ULong( range->image_size ) ) + if ( FT_READ_ULONG( range->image_size ) ) return error; return FT_STREAM_READ_FIELDS( sbit_metrics_fields, &range->metrics ); @@ -263,7 +263,7 @@ FT_Memory memory = stream->memory; - if ( READ_ULong( count ) ) + if ( FT_READ_ULONG( count ) ) goto Exit; range->num_glyphs = count; @@ -286,11 +286,11 @@ for ( n = 0; n < count; n++ ) { - range->glyph_codes[n] = GET_UShort(); + range->glyph_codes[n] = FT_GET_USHORT(); if ( load_offsets ) range->glyph_offsets[n] = (FT_ULong)range->image_offset + - GET_UShort(); + FT_GET_USHORT(); } FT_FRAME_EXIT(); @@ -347,8 +347,8 @@ for ( n = 0; n < num_glyphs; n++ ) range->glyph_offsets[n] = (FT_ULong)( range->image_offset + - ( large ? GET_ULong() - : GET_UShort() ) ); + ( large ? FT_GET_ULONG() + : FT_GET_USHORT() ) ); FT_FRAME_EXIT(); } break; @@ -463,8 +463,8 @@ if ( FT_FRAME_ENTER( 8L ) ) goto Exit; - version = GET_Long(); - num_strikes = GET_ULong(); + version = FT_GET_LONG(); + num_strikes = FT_GET_ULONG(); FT_FRAME_EXIT(); @@ -533,10 +533,10 @@ range = strike->sbit_ranges; while ( count2 > 0 ) { - range->first_glyph = GET_UShort(); - range->last_glyph = GET_UShort(); + range->first_glyph = FT_GET_USHORT(); + range->last_glyph = FT_GET_USHORT(); range->table_offset = table_base + strike->ranges_offset - + GET_ULong(); + + FT_GET_ULONG(); count2--; range++; } @@ -553,9 +553,9 @@ FT_FRAME_ENTER( 8L ) ) goto Exit; - range->index_format = GET_UShort(); - range->image_format = GET_UShort(); - range->image_offset = GET_ULong(); + range->index_format = FT_GET_USHORT(); + range->image_format = FT_GET_USHORT(); + range->image_offset = FT_GET_ULONG(); FT_FRAME_EXIT(); @@ -1303,7 +1303,7 @@ FT_UShort num_components, count; - if ( READ_UShort( num_components ) || + if ( FT_READ_USHORT( num_components ) || ALLOC_ARRAY( components, num_components, TT_SBit_ComponentRec ) ) goto Exit; @@ -1314,9 +1314,9 @@ for ( comp = components; count > 0; count--, comp++ ) { - comp->glyph_code = GET_UShort(); - comp->x_offset = GET_Char(); - comp->y_offset = GET_Char(); + comp->glyph_code = FT_GET_USHORT(); + comp->x_offset = FT_GET_CHAR(); + comp->y_offset = FT_GET_CHAR(); } FT_FRAME_EXIT(); diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 9855b1148..17610091d 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -244,12 +244,12 @@ if ( byte_len < 0 ) return TT_Err_Invalid_Outline; - loader->n_contours = GET_Short(); + loader->n_contours = FT_GET_SHORT(); - loader->bbox.xMin = GET_Short(); - loader->bbox.yMin = GET_Short(); - loader->bbox.xMax = GET_Short(); - loader->bbox.yMax = GET_Short(); + loader->bbox.xMin = FT_GET_SHORT(); + loader->bbox.yMin = FT_GET_SHORT(); + loader->bbox.xMax = FT_GET_SHORT(); + loader->bbox.yMax = FT_GET_SHORT(); FT_TRACE5(( " # of contours: %d\n", loader->n_contours )); FT_TRACE5(( " xMin: %4d xMax: %4d\n", loader->bbox.xMin, @@ -289,7 +289,7 @@ goto Invalid_Outline; for ( ; cur < limit; cur++ ) - cur[0] = GET_UShort(); + cur[0] = FT_GET_USHORT(); n_points = 0; if ( n_contours > 0 ) @@ -311,7 +311,7 @@ slot->control_len = 0; slot->control_data = 0; - n_ins = GET_UShort(); + n_ins = FT_GET_USHORT(); FT_TRACE5(( " Instructions size: %d\n", n_ins )); @@ -358,13 +358,13 @@ if ( --byte_len < 0 ) goto Invalid_Outline; - *flag++ = c = GET_Byte(); + *flag++ = c = FT_GET_BYTE(); if ( c & 8 ) { if ( --byte_len < 0 ) goto Invalid_Outline; - count = GET_Byte(); + count = FT_GET_BYTE(); if ( flag + count > limit ) goto Invalid_Outline; @@ -407,12 +407,12 @@ if ( *flag & 2 ) { - y = GET_Byte(); + y = FT_GET_BYTE(); if ( ( *flag & 16 ) == 0 ) y = -y; } else if ( ( *flag & 16 ) == 0 ) - y = GET_Short(); + y = FT_GET_SHORT(); x += y; vec->x = x; @@ -435,12 +435,12 @@ if ( *flag & 4 ) { - y = GET_Byte(); + y = FT_GET_BYTE(); if ( ( *flag & 32 ) == 0 ) y = -y; } else if ( ( *flag & 32 ) == 0 ) - y = GET_Short(); + y = FT_GET_SHORT(); x += y; vec->y = x; @@ -497,8 +497,8 @@ subglyph->arg1 = subglyph->arg2 = 0; - subglyph->flags = GET_UShort(); - subglyph->index = GET_UShort(); + subglyph->flags = FT_GET_USHORT(); + subglyph->index = FT_GET_USHORT(); /* check space */ byte_len -= 2; @@ -517,13 +517,13 @@ /* read arguments */ if ( subglyph->flags & ARGS_ARE_WORDS ) { - subglyph->arg1 = GET_Short(); - subglyph->arg2 = GET_Short(); + subglyph->arg1 = FT_GET_SHORT(); + subglyph->arg2 = FT_GET_SHORT(); } else { - subglyph->arg1 = GET_Char(); - subglyph->arg2 = GET_Char(); + subglyph->arg1 = FT_GET_CHAR(); + subglyph->arg2 = FT_GET_CHAR(); } /* read transform */ @@ -532,20 +532,20 @@ if ( subglyph->flags & WE_HAVE_A_SCALE ) { - xx = (FT_Fixed)GET_Short() << 2; + xx = (FT_Fixed)FT_GET_SHORT() << 2; yy = xx; } else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE ) { - xx = (FT_Fixed)GET_Short() << 2; - yy = (FT_Fixed)GET_Short() << 2; + xx = (FT_Fixed)FT_GET_SHORT() << 2; + yy = (FT_Fixed)FT_GET_SHORT() << 2; } else if ( subglyph->flags & WE_HAVE_A_2X2 ) { - xx = (FT_Fixed)GET_Short() << 2; - xy = (FT_Fixed)GET_Short() << 2; - yx = (FT_Fixed)GET_Short() << 2; - yy = (FT_Fixed)GET_Short() << 2; + xx = (FT_Fixed)FT_GET_SHORT() << 2; + xy = (FT_Fixed)FT_GET_SHORT() << 2; + yx = (FT_Fixed)FT_GET_SHORT() << 2; + yy = (FT_Fixed)FT_GET_SHORT() << 2; } subglyph->transform.xx = xx; @@ -1109,7 +1109,7 @@ /* read size of instructions */ if ( FT_STREAM_SEEK( ins_pos ) || - READ_UShort( n_ins ) ) + FT_READ_USHORT( n_ins ) ) goto Fail; FT_TRACE5(( " Instructions size = %d\n", n_ins )); diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index 180735bdf..6cdbd2dc6 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -94,7 +94,7 @@ for ( ; loc < limit; loc++ ) - *loc = GET_Long(); + *loc = FT_GET_LONG(); } FT_FRAME_EXIT(); @@ -118,7 +118,7 @@ for ( ; loc < limit; loc++ ) - *loc = (FT_Long)( (FT_ULong)GET_UShort() * 2 ); + *loc = (FT_Long)( (FT_ULong)FT_GET_USHORT() * 2 ); } FT_FRAME_EXIT(); } @@ -186,7 +186,7 @@ for ( ; cur < limit; cur++ ) - *cur = GET_Short(); + *cur = FT_GET_SHORT(); } FT_FRAME_EXIT(); diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index b84e1709e..b05a55dcf 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -228,18 +228,18 @@ ne_header.resource_tab_offset ) ) goto Exit; - size_shift = GET_UShortLE(); + size_shift = FT_GET_USHORT_LE(); for (;;) { FT_UShort type_id, count; - type_id = GET_UShortLE(); + type_id = FT_GET_USHORT_LE(); if ( !type_id ) break; - count = GET_UShortLE(); + count = FT_GET_USHORT_LE(); if ( type_id == 0x8008 ) { @@ -277,8 +277,8 @@ for ( ; cur < limit; cur++ ) { - cur->offset = (FT_ULong)GET_UShortLE() << size_shift; - cur->fnt_size = (FT_ULong)GET_UShortLE() << size_shift; + cur->offset = (FT_ULong)FT_GET_USHORT_LE() << size_shift; + cur->fnt_size = (FT_ULong)FT_GET_USHORT_LE() << size_shift; cur->size_shift = size_shift; stream->cursor += 8; } @@ -655,12 +655,12 @@ /* jump to glyph entry */ p = font->fnt_frame + 118 + len * glyph_index; - bitmap->width = NEXT_ShortLE(p); + bitmap->width = FT_NEXT_SHORT_LE(p); if ( new_format ) - offset = NEXT_ULongLE(p); + offset = FT_NEXT_ULONG_LE(p); else - offset = NEXT_UShortLE(p); + offset = FT_NEXT_USHORT_LE(p); /* jump to glyph data */ p = font->fnt_frame + /* font->header.bits_offset */ + offset;