ReactOS 0.4.16-dev-297-gc569aee
ftstream.h File Reference
#include <ft2build.h>
Include dependency graph for ftstream.h:

Go to the source code of this file.

Classes

struct  FT_Frame_Field_
 

Macros

#define FT_FRAME_OP_SHIFT   2
 
#define FT_FRAME_OP_SIGNED   1
 
#define FT_FRAME_OP_LITTLE   2
 
#define FT_FRAME_OP_COMMAND(x)   ( x >> FT_FRAME_OP_SHIFT )
 
#define FT_MAKE_FRAME_OP(command, little, sign)    ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )
 
#define FT_FRAME_OP_END   0
 
#define FT_FRAME_OP_START   1 /* start a new frame */
 
#define FT_FRAME_OP_BYTE   2 /* read 1-byte value */
 
#define FT_FRAME_OP_SHORT   3 /* read 2-byte value */
 
#define FT_FRAME_OP_LONG   4 /* read 4-byte value */
 
#define FT_FRAME_OP_OFF3   5 /* read 3-byte value */
 
#define FT_FRAME_OP_BYTES   6 /* read a bytes sequence */
 
#define FT_FIELD_SIZE(f)    (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
 
#define FT_FIELD_SIZE_DELTA(f)    (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )
 
#define FT_FIELD_OFFSET(f)    (FT_UShort)( offsetof( FT_STRUCTURE, f ) )
 
#define FT_FRAME_FIELD(frame_op, field)
 
#define FT_MAKE_EMPTY_FIELD(frame_op)   { frame_op, 0, 0 }
 
#define FT_FRAME_START(size)   { ft_frame_start, 0, size }
 
#define FT_FRAME_END   { ft_frame_end, 0, 0 }
 
#define FT_FRAME_LONG(f)   FT_FRAME_FIELD( ft_frame_long_be, f )
 
#define FT_FRAME_ULONG(f)   FT_FRAME_FIELD( ft_frame_ulong_be, f )
 
#define FT_FRAME_SHORT(f)   FT_FRAME_FIELD( ft_frame_short_be, f )
 
#define FT_FRAME_USHORT(f)   FT_FRAME_FIELD( ft_frame_ushort_be, f )
 
#define FT_FRAME_OFF3(f)   FT_FRAME_FIELD( ft_frame_off3_be, f )
 
#define FT_FRAME_UOFF3(f)   FT_FRAME_FIELD( ft_frame_uoff3_be, f )
 
#define FT_FRAME_BYTE(f)   FT_FRAME_FIELD( ft_frame_byte, f )
 
#define FT_FRAME_CHAR(f)   FT_FRAME_FIELD( ft_frame_schar, f )
 
#define FT_FRAME_LONG_LE(f)   FT_FRAME_FIELD( ft_frame_long_le, f )
 
#define FT_FRAME_ULONG_LE(f)   FT_FRAME_FIELD( ft_frame_ulong_le, f )
 
#define FT_FRAME_SHORT_LE(f)   FT_FRAME_FIELD( ft_frame_short_le, f )
 
#define FT_FRAME_USHORT_LE(f)   FT_FRAME_FIELD( ft_frame_ushort_le, f )
 
#define FT_FRAME_OFF3_LE(f)   FT_FRAME_FIELD( ft_frame_off3_le, f )
 
#define FT_FRAME_UOFF3_LE(f)   FT_FRAME_FIELD( ft_frame_uoff3_le, f )
 
#define FT_FRAME_SKIP_LONG   { ft_frame_long_be, 0, 0 }
 
#define FT_FRAME_SKIP_SHORT   { ft_frame_short_be, 0, 0 }
 
#define FT_FRAME_SKIP_BYTE   { ft_frame_byte, 0, 0 }
 
#define FT_FRAME_BYTES(field, count)
 
#define FT_FRAME_SKIP_BYTES(count)   { ft_frame_skip, count, 0 }
 
#define FT_BYTE_(p, i)   ( ((const FT_Byte*)(p))[(i)] )
 
#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_BYTE_U16(p, i, s)   ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )
 
#define FT_BYTE_U32(p, i, s)   ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )
 
#define FT_PEEK_SHORT(p)
 
#define FT_PEEK_USHORT(p)
 
#define FT_PEEK_LONG(p)
 
#define FT_PEEK_ULONG(p)
 
#define FT_PEEK_OFF3(p)
 
#define FT_PEEK_UOFF3(p)
 
#define FT_PEEK_SHORT_LE(p)
 
#define FT_PEEK_USHORT_LE(p)
 
#define FT_PEEK_LONG_LE(p)
 
#define FT_PEEK_ULONG_LE(p)
 
#define FT_PEEK_OFF3_LE(p)
 
#define FT_PEEK_UOFF3_LE(p)
 
#define FT_NEXT_CHAR(buffer)    ( (signed char)*buffer++ )
 
#define FT_NEXT_BYTE(buffer)    ( (unsigned char)*buffer++ )
 
#define FT_NEXT_SHORT(buffer)    ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )
 
#define FT_NEXT_USHORT(buffer)    ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )
 
#define FT_NEXT_OFF3(buffer)    ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )
 
#define FT_NEXT_UOFF3(buffer)    ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )
 
#define FT_NEXT_LONG(buffer)    ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )
 
#define FT_NEXT_ULONG(buffer)    ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )
 
#define FT_NEXT_SHORT_LE(buffer)    ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )
 
#define FT_NEXT_USHORT_LE(buffer)    ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )
 
#define FT_NEXT_OFF3_LE(buffer)    ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )
 
#define FT_NEXT_UOFF3_LE(buffer)    ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )
 
#define FT_NEXT_LONG_LE(buffer)    ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )
 
#define FT_NEXT_ULONG_LE(buffer)    ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )
 
#define FT_GET_MACRO(func, type)   ( (type)func( stream ) )
 
#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_GetUShort, FT_Short )
 
#define FT_GET_USHORT()   FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )
 
#define FT_GET_OFF3()   FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )
 
#define FT_GET_UOFF3()   FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )
 
#define FT_GET_LONG()   FT_GET_MACRO( FT_Stream_GetULong, FT_Long )
 
#define FT_GET_ULONG()   FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
 
#define FT_GET_TAG4()   FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )
 
#define FT_GET_SHORT_LE()   FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )
 
#define FT_GET_USHORT_LE()   FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )
 
#define FT_GET_LONG_LE()   FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )
 
#define FT_GET_ULONG_LE()   FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )
 
#define FT_READ_MACRO(func, type, 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_ReadUShort, FT_Short, var )
 
#define FT_READ_USHORT(var)   FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )
 
#define FT_READ_OFF3(var)   FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )
 
#define FT_READ_UOFF3(var)   FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )
 
#define FT_READ_LONG(var)   FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )
 
#define FT_READ_ULONG(var)   FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )
 
#define FT_READ_SHORT_LE(var)   FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )
 
#define FT_READ_USHORT_LE(var)   FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )
 
#define FT_READ_LONG_LE(var)   FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )
 
#define FT_READ_ULONG_LE(var)   FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )
 
#define FT_STREAM_POS()    FT_Stream_Pos( stream )
 
#define FT_STREAM_SEEK(position)
 
#define FT_STREAM_SKIP(distance)
 
#define FT_STREAM_READ(buffer, count)
 
#define FT_STREAM_READ_AT(position, buffer, count)
 
#define FT_STREAM_READ_FIELDS(fields, object)    FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
 
#define FT_FRAME_ENTER(size)
 
#define FT_FRAME_EXIT()    FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
 
#define FT_FRAME_EXTRACT(size, bytes)
 
#define FT_FRAME_RELEASE(bytes)
 

Typedefs

typedef enum FT_Frame_Op_ FT_Frame_Op
 
typedef struct FT_Frame_Field_ FT_Frame_Field
 

Enumerations

enum  FT_Frame_Op_ {
  ft_frame_end = 0 , ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ) , ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ) , ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ) ,
  ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ) , ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ) , ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ) , ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ) ,
  ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ) , ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ) , ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ) , ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ) ,
  ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ) , ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ) , ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ) , ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ) ,
  ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ) , ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )
}
 

Functions

 FT_Stream_Open (FT_Stream stream, const char *filepathname)
 
 FT_Stream_New (FT_Library library, const FT_Open_Args *args, FT_Stream *astream)
 
 FT_Stream_Free (FT_Stream stream, FT_Int external)
 
 FT_Stream_OpenMemory (FT_Stream stream, const FT_Byte *base, FT_ULong size)
 
 FT_Stream_Close (FT_Stream stream)
 
 FT_Stream_Seek (FT_Stream stream, FT_ULong pos)
 
 FT_Stream_Skip (FT_Stream stream, FT_Long distance)
 
 FT_Stream_Pos (FT_Stream stream)
 
 FT_Stream_Read (FT_Stream stream, FT_Byte *buffer, FT_ULong count)
 
 FT_Stream_ReadAt (FT_Stream stream, FT_ULong pos, FT_Byte *buffer, FT_ULong count)
 
 FT_Stream_TryRead (FT_Stream stream, FT_Byte *buffer, FT_ULong count)
 
 FT_Stream_EnterFrame (FT_Stream stream, FT_ULong count)
 
 FT_Stream_ExitFrame (FT_Stream stream)
 
 FT_Stream_ExtractFrame (FT_Stream stream, FT_ULong count, FT_Byte **pbytes)
 
 FT_Stream_ReleaseFrame (FT_Stream stream, FT_Byte **pbytes)
 
 FT_Stream_GetChar (FT_Stream stream)
 
 FT_Stream_GetUShort (FT_Stream stream)
 
 FT_Stream_GetUOffset (FT_Stream stream)
 
 FT_Stream_GetULong (FT_Stream stream)
 
 FT_Stream_GetUShortLE (FT_Stream stream)
 
 FT_Stream_GetULongLE (FT_Stream stream)
 
 FT_Stream_ReadChar (FT_Stream stream, FT_Error *error)
 
 FT_Stream_ReadUShort (FT_Stream stream, FT_Error *error)
 
 FT_Stream_ReadUOffset (FT_Stream stream, FT_Error *error)
 
 FT_Stream_ReadULong (FT_Stream stream, FT_Error *error)
 
 FT_Stream_ReadUShortLE (FT_Stream stream, FT_Error *error)
 
 FT_Stream_ReadULongLE (FT_Stream stream, FT_Error *error)
 
 FT_Stream_ReadFields (FT_Stream stream, const FT_Frame_Field *fields, void *structure)
 

Macro Definition Documentation

◆ FT_BYTE_

#define FT_BYTE_ (   p,
  i 
)    ( ((const FT_Byte*)(p))[(i)] )

Definition at line 156 of file ftstream.h.

◆ FT_BYTE_U16

#define FT_BYTE_U16 (   p,
  i,
  s 
)    ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )

Definition at line 164 of file ftstream.h.

◆ FT_BYTE_U32

#define FT_BYTE_U32 (   p,
  i,
  s 
)    ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )

Definition at line 165 of file ftstream.h.

◆ FT_FIELD_OFFSET

#define FT_FIELD_OFFSET (   f)     (FT_UShort)( offsetof( FT_STRUCTURE, f ) )

Definition at line 105 of file ftstream.h.

◆ FT_FIELD_SIZE

#define FT_FIELD_SIZE (   f)     (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )

Definition at line 99 of file ftstream.h.

◆ FT_FIELD_SIZE_DELTA

#define FT_FIELD_SIZE_DELTA (   f)     (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )

Definition at line 102 of file ftstream.h.

◆ FT_FRAME_BYTE

#define FT_FRAME_BYTE (   f)    FT_FRAME_FIELD( ft_frame_byte, f )

Definition at line 126 of file ftstream.h.

◆ FT_FRAME_BYTES

#define FT_FRAME_BYTES (   field,
  count 
)
Value:
{ \
count, \
FT_FIELD_OFFSET( field ) \
}
@ ft_frame_bytes
Definition: ftstream.h:80
GLuint GLuint GLsizei count
Definition: gl.h:1545
Definition: parser.c:44

Definition at line 140 of file ftstream.h.

◆ FT_FRAME_CHAR

#define FT_FRAME_CHAR (   f)    FT_FRAME_FIELD( ft_frame_schar, f )

Definition at line 127 of file ftstream.h.

◆ FT_FRAME_END

#define FT_FRAME_END   { ft_frame_end, 0, 0 }

Definition at line 118 of file ftstream.h.

◆ FT_FRAME_ENTER

#define FT_FRAME_ENTER (   size)
Value:
(FT_ULong)(size) ) ) )
#define FT_SET_ERROR(expression)
Definition: ftmemory.h:42
#define FT_DEBUG_INNER(exp)
Definition: ftmemory.h:103
FT_Stream_EnterFrame(FT_Stream stream, FT_ULong count)
Definition: ftstream.c:234
unsigned long FT_ULong
Definition: fttypes.h:253
GLsizeiptr size
Definition: glext.h:5919
Definition: parse.h:23

Definition at line 512 of file ftstream.h.

◆ FT_FRAME_EXIT

#define FT_FRAME_EXIT ( )     FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )

Definition at line 517 of file ftstream.h.

◆ FT_FRAME_EXTRACT

#define FT_FRAME_EXTRACT (   size,
  bytes 
)
Value:
(FT_ULong)(size), \
(FT_Byte**)&(bytes) ) ) )
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
FT_Stream_ExtractFrame(FT_Stream stream, FT_ULong count, FT_Byte **pbytes)
Definition: ftstream.c:193
unsigned char FT_Byte
Definition: fttypes.h:154

Definition at line 520 of file ftstream.h.

◆ FT_FRAME_FIELD

#define FT_FRAME_FIELD (   frame_op,
  field 
)
Value:
{ \
frame_op, \
FT_FIELD_SIZE( field ), \
FT_FIELD_OFFSET( field ) \
}

Definition at line 108 of file ftstream.h.

◆ FT_FRAME_LONG

#define FT_FRAME_LONG (   f)    FT_FRAME_FIELD( ft_frame_long_be, f )

Definition at line 120 of file ftstream.h.

◆ FT_FRAME_LONG_LE

#define FT_FRAME_LONG_LE (   f)    FT_FRAME_FIELD( ft_frame_long_le, f )

Definition at line 129 of file ftstream.h.

◆ FT_FRAME_OFF3

#define FT_FRAME_OFF3 (   f)    FT_FRAME_FIELD( ft_frame_off3_be, f )

Definition at line 124 of file ftstream.h.

◆ FT_FRAME_OFF3_LE

#define FT_FRAME_OFF3_LE (   f)    FT_FRAME_FIELD( ft_frame_off3_le, f )

Definition at line 133 of file ftstream.h.

◆ FT_FRAME_OP_BYTE

#define FT_FRAME_OP_BYTE   2 /* read 1-byte value */

Definition at line 50 of file ftstream.h.

◆ FT_FRAME_OP_BYTES

#define FT_FRAME_OP_BYTES   6 /* read a bytes sequence */

Definition at line 54 of file ftstream.h.

◆ FT_FRAME_OP_COMMAND

#define FT_FRAME_OP_COMMAND (   x)    ( x >> FT_FRAME_OP_SHIFT )

Definition at line 43 of file ftstream.h.

◆ FT_FRAME_OP_END

#define FT_FRAME_OP_END   0

Definition at line 48 of file ftstream.h.

◆ FT_FRAME_OP_LITTLE

#define FT_FRAME_OP_LITTLE   2

Definition at line 42 of file ftstream.h.

◆ FT_FRAME_OP_LONG

#define FT_FRAME_OP_LONG   4 /* read 4-byte value */

Definition at line 52 of file ftstream.h.

◆ FT_FRAME_OP_OFF3

#define FT_FRAME_OP_OFF3   5 /* read 3-byte value */

Definition at line 53 of file ftstream.h.

◆ FT_FRAME_OP_SHIFT

#define FT_FRAME_OP_SHIFT   2

Definition at line 40 of file ftstream.h.

◆ FT_FRAME_OP_SHORT

#define FT_FRAME_OP_SHORT   3 /* read 2-byte value */

Definition at line 51 of file ftstream.h.

◆ FT_FRAME_OP_SIGNED

#define FT_FRAME_OP_SIGNED   1

Definition at line 41 of file ftstream.h.

◆ FT_FRAME_OP_START

#define FT_FRAME_OP_START   1 /* start a new frame */

Definition at line 49 of file ftstream.h.

◆ FT_FRAME_RELEASE

#define FT_FRAME_RELEASE (   bytes)
Value:
(FT_Byte**)&(bytes) ) )
FT_Stream_ReleaseFrame(FT_Stream stream, FT_Byte **pbytes)
Definition: ftstream.c:215

Definition at line 526 of file ftstream.h.

◆ FT_FRAME_SHORT

#define FT_FRAME_SHORT (   f)    FT_FRAME_FIELD( ft_frame_short_be, f )

Definition at line 122 of file ftstream.h.

◆ FT_FRAME_SHORT_LE

#define FT_FRAME_SHORT_LE (   f)    FT_FRAME_FIELD( ft_frame_short_le, f )

Definition at line 131 of file ftstream.h.

◆ FT_FRAME_SKIP_BYTE

#define FT_FRAME_SKIP_BYTE   { ft_frame_byte, 0, 0 }

Definition at line 138 of file ftstream.h.

◆ FT_FRAME_SKIP_BYTES

#define FT_FRAME_SKIP_BYTES (   count)    { ft_frame_skip, count, 0 }

Definition at line 147 of file ftstream.h.

◆ FT_FRAME_SKIP_LONG

#define FT_FRAME_SKIP_LONG   { ft_frame_long_be, 0, 0 }

Definition at line 136 of file ftstream.h.

◆ FT_FRAME_SKIP_SHORT

#define FT_FRAME_SKIP_SHORT   { ft_frame_short_be, 0, 0 }

Definition at line 137 of file ftstream.h.

◆ FT_FRAME_START

#define FT_FRAME_START (   size)    { ft_frame_start, 0, size }

Definition at line 117 of file ftstream.h.

◆ FT_FRAME_ULONG

#define FT_FRAME_ULONG (   f)    FT_FRAME_FIELD( ft_frame_ulong_be, f )

Definition at line 121 of file ftstream.h.

◆ FT_FRAME_ULONG_LE

#define FT_FRAME_ULONG_LE (   f)    FT_FRAME_FIELD( ft_frame_ulong_le, f )

Definition at line 130 of file ftstream.h.

◆ FT_FRAME_UOFF3

#define FT_FRAME_UOFF3 (   f)    FT_FRAME_FIELD( ft_frame_uoff3_be, f )

Definition at line 125 of file ftstream.h.

◆ FT_FRAME_UOFF3_LE

#define FT_FRAME_UOFF3_LE (   f)    FT_FRAME_FIELD( ft_frame_uoff3_le, f )

Definition at line 134 of file ftstream.h.

◆ FT_FRAME_USHORT

#define FT_FRAME_USHORT (   f)    FT_FRAME_FIELD( ft_frame_ushort_be, f )

Definition at line 123 of file ftstream.h.

◆ FT_FRAME_USHORT_LE

#define FT_FRAME_USHORT_LE (   f)    FT_FRAME_FIELD( ft_frame_ushort_le, f )

Definition at line 132 of file ftstream.h.

◆ FT_GET_BYTE

#define FT_GET_BYTE ( )    FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )

Definition at line 287 of file ftstream.h.

◆ FT_GET_CHAR

#define FT_GET_CHAR ( )    FT_GET_MACRO( FT_Stream_GetChar, FT_Char )

Definition at line 286 of file ftstream.h.

◆ FT_GET_LONG

#define FT_GET_LONG ( )    FT_GET_MACRO( FT_Stream_GetULong, FT_Long )

Definition at line 292 of file ftstream.h.

◆ FT_GET_LONG_LE

#define FT_GET_LONG_LE ( )    FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )

Definition at line 298 of file ftstream.h.

◆ FT_GET_MACRO

#define FT_GET_MACRO (   func,
  type 
)    ( (type)func( stream ) )

Definition at line 284 of file ftstream.h.

◆ FT_GET_OFF3

#define FT_GET_OFF3 ( )    FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )

Definition at line 290 of file ftstream.h.

◆ FT_GET_SHORT

#define FT_GET_SHORT ( )    FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )

Definition at line 288 of file ftstream.h.

◆ FT_GET_SHORT_LE

#define FT_GET_SHORT_LE ( )    FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )

Definition at line 296 of file ftstream.h.

◆ FT_GET_TAG4

#define FT_GET_TAG4 ( )    FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )

Definition at line 294 of file ftstream.h.

◆ FT_GET_ULONG

#define FT_GET_ULONG ( )    FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )

Definition at line 293 of file ftstream.h.

◆ FT_GET_ULONG_LE

#define FT_GET_ULONG_LE ( )    FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )

Definition at line 299 of file ftstream.h.

◆ FT_GET_UOFF3

#define FT_GET_UOFF3 ( )    FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )

Definition at line 291 of file ftstream.h.

◆ FT_GET_USHORT

#define FT_GET_USHORT ( )    FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )

Definition at line 289 of file ftstream.h.

◆ FT_GET_USHORT_LE

#define FT_GET_USHORT_LE ( )    FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )

Definition at line 297 of file ftstream.h.

◆ FT_INT16

#define FT_INT16 (   x)    ( (FT_Int16)(x) )

Definition at line 158 of file ftstream.h.

◆ FT_INT32

#define FT_INT32 (   x)    ( (FT_Int32)(x) )

Definition at line 160 of file ftstream.h.

◆ FT_MAKE_EMPTY_FIELD

#define FT_MAKE_EMPTY_FIELD (   frame_op)    { frame_op, 0, 0 }

Definition at line 115 of file ftstream.h.

◆ FT_MAKE_FRAME_OP

#define FT_MAKE_FRAME_OP (   command,
  little,
  sign 
)     ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )

Definition at line 45 of file ftstream.h.

◆ FT_NEXT_BYTE

#define FT_NEXT_BYTE (   buffer)     ( (unsigned char)*buffer++ )

Definition at line 220 of file ftstream.h.

◆ FT_NEXT_CHAR

#define FT_NEXT_CHAR (   buffer)     ( (signed char)*buffer++ )

Definition at line 217 of file ftstream.h.

◆ FT_NEXT_LONG

#define FT_NEXT_LONG (   buffer)     ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )

Definition at line 235 of file ftstream.h.

◆ FT_NEXT_LONG_LE

#define FT_NEXT_LONG_LE (   buffer)     ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )

Definition at line 254 of file ftstream.h.

◆ FT_NEXT_OFF3

#define FT_NEXT_OFF3 (   buffer)     ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )

Definition at line 229 of file ftstream.h.

◆ FT_NEXT_OFF3_LE

#define FT_NEXT_OFF3_LE (   buffer)     ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )

Definition at line 248 of file ftstream.h.

◆ FT_NEXT_SHORT

#define FT_NEXT_SHORT (   buffer)     ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )

Definition at line 223 of file ftstream.h.

◆ FT_NEXT_SHORT_LE

#define FT_NEXT_SHORT_LE (   buffer)     ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )

Definition at line 242 of file ftstream.h.

◆ FT_NEXT_ULONG

#define FT_NEXT_ULONG (   buffer)     ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )

Definition at line 238 of file ftstream.h.

◆ FT_NEXT_ULONG_LE

#define FT_NEXT_ULONG_LE (   buffer)     ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )

Definition at line 257 of file ftstream.h.

◆ FT_NEXT_UOFF3

#define FT_NEXT_UOFF3 (   buffer)     ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )

Definition at line 232 of file ftstream.h.

◆ FT_NEXT_UOFF3_LE

#define FT_NEXT_UOFF3_LE (   buffer)     ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )

Definition at line 251 of file ftstream.h.

◆ FT_NEXT_USHORT

#define FT_NEXT_USHORT (   buffer)     ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )

Definition at line 226 of file ftstream.h.

◆ FT_NEXT_USHORT_LE

#define FT_NEXT_USHORT_LE (   buffer)     ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )

Definition at line 245 of file ftstream.h.

◆ FT_PEEK_LONG

#define FT_PEEK_LONG (   p)
Value:
FT_INT32( 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_INT32(x)
Definition: ftstream.h:160
#define FT_BYTE_U32(p, i, s)
Definition: ftstream.h:165
GLfloat GLfloat p
Definition: glext.h:8902

Definition at line 174 of file ftstream.h.

◆ FT_PEEK_LONG_LE

#define FT_PEEK_LONG_LE (   p)
Value:
FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \
FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )

Definition at line 198 of file ftstream.h.

◆ FT_PEEK_OFF3

#define FT_PEEK_OFF3 (   p)
Value:
FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 2, 0 ) )

Definition at line 184 of file ftstream.h.

◆ FT_PEEK_OFF3_LE

#define FT_PEEK_OFF3_LE (   p)
Value:
FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )

Definition at line 208 of file ftstream.h.

◆ FT_PEEK_SHORT

#define FT_PEEK_SHORT (   p)
Value:
FT_INT16( FT_BYTE_U16( p, 0, 8 ) | \
FT_BYTE_U16( p, 1, 0 ) )
#define FT_INT16(x)
Definition: ftstream.h:158
#define FT_BYTE_U16(p, i, s)
Definition: ftstream.h:164

Definition at line 168 of file ftstream.h.

◆ FT_PEEK_SHORT_LE

#define FT_PEEK_SHORT_LE (   p)
Value:
FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \
FT_BYTE_U16( p, 0, 0 ) )

Definition at line 192 of file ftstream.h.

◆ FT_PEEK_ULONG

#define FT_PEEK_ULONG (   p)
Value:
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_UINT32(x)
Definition: ftstream.h:161

Definition at line 179 of file ftstream.h.

◆ FT_PEEK_ULONG_LE

#define FT_PEEK_ULONG_LE (   p)
Value:
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 ) )

Definition at line 203 of file ftstream.h.

◆ FT_PEEK_UOFF3

#define FT_PEEK_UOFF3 (   p)
Value:
FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 2, 0 ) )

Definition at line 188 of file ftstream.h.

◆ FT_PEEK_UOFF3_LE

#define FT_PEEK_UOFF3_LE (   p)
Value:
FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \
FT_BYTE_U32( p, 1, 8 ) | \
FT_BYTE_U32( p, 0, 0 ) )

Definition at line 212 of file ftstream.h.

◆ FT_PEEK_USHORT

#define FT_PEEK_USHORT (   p)
Value:
FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \
FT_BYTE_U16( p, 1, 0 ) )
#define FT_UINT16(x)
Definition: ftstream.h:159

Definition at line 171 of file ftstream.h.

◆ FT_PEEK_USHORT_LE

#define FT_PEEK_USHORT_LE (   p)
Value:
FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \
FT_BYTE_U16( p, 0, 0 ) )

Definition at line 195 of file ftstream.h.

◆ FT_READ_BYTE

#define FT_READ_BYTE (   var)    FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )

Definition at line 306 of file ftstream.h.

◆ FT_READ_CHAR

#define FT_READ_CHAR (   var)    FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )

Definition at line 307 of file ftstream.h.

◆ FT_READ_LONG

#define FT_READ_LONG (   var)    FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )

Definition at line 312 of file ftstream.h.

◆ FT_READ_LONG_LE

#define FT_READ_LONG_LE (   var)    FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )

Definition at line 317 of file ftstream.h.

◆ FT_READ_MACRO

#define FT_READ_MACRO (   func,
  type,
  var 
)
Value:
( var = (type)func( stream, &error ), \
return FT_Err_Ok
Definition: ftbbox.c:511
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
#define error(str)
Definition: mkdosfs.c:1605
const char * var
Definition: shader.c:5666

Definition at line 302 of file ftstream.h.

◆ FT_READ_OFF3

#define FT_READ_OFF3 (   var)    FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )

Definition at line 310 of file ftstream.h.

◆ FT_READ_SHORT

#define FT_READ_SHORT (   var)    FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )

Definition at line 308 of file ftstream.h.

◆ FT_READ_SHORT_LE

#define FT_READ_SHORT_LE (   var)    FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )

Definition at line 315 of file ftstream.h.

◆ FT_READ_ULONG

#define FT_READ_ULONG (   var)    FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )

Definition at line 313 of file ftstream.h.

◆ FT_READ_ULONG_LE

#define FT_READ_ULONG_LE (   var)    FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )

Definition at line 318 of file ftstream.h.

◆ FT_READ_UOFF3

#define FT_READ_UOFF3 (   var)    FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )

Definition at line 311 of file ftstream.h.

◆ FT_READ_USHORT

#define FT_READ_USHORT (   var)    FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )

Definition at line 309 of file ftstream.h.

◆ FT_READ_USHORT_LE

#define FT_READ_USHORT_LE (   var)    FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )

Definition at line 316 of file ftstream.h.

◆ FT_STREAM_POS

#define FT_STREAM_POS ( )     FT_Stream_Pos( stream )

Definition at line 486 of file ftstream.h.

◆ FT_STREAM_READ

#define FT_STREAM_READ (   buffer,
  count 
)
Value:
(FT_Byte*)(buffer), \
(FT_ULong)(count) ) )
FT_Stream_Read(FT_Stream stream, FT_Byte *buffer, FT_ULong count)
Definition: ftstream.c:110
GLuint buffer
Definition: glext.h:5915

Definition at line 497 of file ftstream.h.

◆ FT_STREAM_READ_AT

#define FT_STREAM_READ_AT (   position,
  buffer,
  count 
)
Value:
(FT_ULong)(position), \
(FT_Byte*)(buffer), \
(FT_ULong)(count) ) )
FT_Stream_ReadAt(FT_Stream stream, FT_ULong pos, FT_Byte *buffer, FT_ULong count)
Definition: ftstream.c:119

Definition at line 502 of file ftstream.h.

◆ FT_STREAM_READ_FIELDS

#define FT_STREAM_READ_FIELDS (   fields,
  object 
)     FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )

Definition at line 508 of file ftstream.h.

◆ FT_STREAM_SEEK

#define FT_STREAM_SEEK (   position)
Value:
(FT_ULong)(position) ) )
FT_Stream_Seek(FT_Stream stream, FT_ULong pos)
Definition: ftstream.c:57

Definition at line 489 of file ftstream.h.

◆ FT_STREAM_SKIP

#define FT_STREAM_SKIP (   distance)
Value:
FT_Stream_Skip(FT_Stream stream, FT_Long distance)
Definition: ftstream.c:92
signed long FT_Long
Definition: fttypes.h:242
GLsizei GLsizei GLfloat distance
Definition: glext.h:11755

Definition at line 493 of file ftstream.h.

◆ FT_UINT16

#define FT_UINT16 (   x)    ( (FT_UInt16)(x) )

Definition at line 159 of file ftstream.h.

◆ FT_UINT32

#define FT_UINT32 (   x)    ( (FT_UInt32)(x) )

Definition at line 161 of file ftstream.h.

Typedef Documentation

◆ FT_Frame_Field

◆ FT_Frame_Op

Enumeration Type Documentation

◆ FT_Frame_Op_

Enumerator
ft_frame_end 
ft_frame_start 
ft_frame_byte 
ft_frame_schar 
ft_frame_ushort_be 
ft_frame_short_be 
ft_frame_ushort_le 
ft_frame_short_le 
ft_frame_ulong_be 
ft_frame_long_be 
ft_frame_ulong_le 
ft_frame_long_le 
ft_frame_uoff3_be 
ft_frame_off3_be 
ft_frame_uoff3_le 
ft_frame_off3_le 
ft_frame_bytes 
ft_frame_skip 

Definition at line 57 of file ftstream.h.

58 {
59 ft_frame_end = 0,
61
64
69
74
79
82
#define FT_FRAME_OP_SHORT
Definition: ftstream.h:51
@ ft_frame_uoff3_be
Definition: ftstream.h:75
@ ft_frame_byte
Definition: ftstream.h:62
@ ft_frame_short_le
Definition: ftstream.h:68
@ ft_frame_off3_be
Definition: ftstream.h:76
@ ft_frame_long_le
Definition: ftstream.h:73
@ ft_frame_ulong_le
Definition: ftstream.h:72
@ ft_frame_ulong_be
Definition: ftstream.h:70
@ ft_frame_skip
Definition: ftstream.h:81
@ ft_frame_short_be
Definition: ftstream.h:66
@ ft_frame_end
Definition: ftstream.h:59
@ ft_frame_uoff3_le
Definition: ftstream.h:77
@ ft_frame_ushort_be
Definition: ftstream.h:65
@ ft_frame_start
Definition: ftstream.h:60
@ ft_frame_off3_le
Definition: ftstream.h:78
@ ft_frame_ushort_le
Definition: ftstream.h:67
@ ft_frame_long_be
Definition: ftstream.h:71
@ ft_frame_schar
Definition: ftstream.h:63
#define FT_FRAME_OP_BYTE
Definition: ftstream.h:50
#define FT_MAKE_FRAME_OP(command, little, sign)
Definition: ftstream.h:45
#define FT_FRAME_OP_LONG
Definition: ftstream.h:52
enum FT_Frame_Op_ FT_Frame_Op
#define FT_FRAME_OP_START
Definition: ftstream.h:49
#define FT_FRAME_OP_OFF3
Definition: ftstream.h:53
#define FT_FRAME_OP_BYTES
Definition: ftstream.h:54

Function Documentation

◆ FT_Stream_Close()

FT_Stream_Close ( FT_Stream  stream)

Definition at line 49 of file ftstream.c.

50 {
51 if ( stream && stream->close )
52 stream->close( stream );
53 }

Referenced by FT_Stream_Free(), main(), PCF_Face_Done(), and woff_open_font().

◆ FT_Stream_EnterFrame()

FT_Stream_EnterFrame ( FT_Stream  stream,
FT_ULong  count 
)

Definition at line 234 of file ftstream.c.

236 {
239
240
241 /* check for nested frame access */
242 FT_ASSERT( stream && stream->cursor == 0 );
243
244 if ( stream->read )
245 {
246 /* allocate the frame in memory */
247 FT_Memory memory = stream->memory;
248
249
250 /* simple sanity check */
251 if ( count > stream->size )
252 {
253 FT_ERROR(( "FT_Stream_EnterFrame:"
254 " frame size (%lu) larger than stream size (%lu)\n",
255 count, stream->size ));
256
257 error = FT_THROW( Invalid_Stream_Operation );
258 goto Exit;
259 }
260
261#ifdef FT_DEBUG_MEMORY
262 /* assume _ft_debug_file and _ft_debug_lineno are already set */
263 stream->base = (unsigned char*)ft_mem_qalloc( memory,
264 (FT_Long)count,
265 &error );
266 if ( error )
267 goto Exit;
268#else
269 if ( FT_QALLOC( stream->base, count ) )
270 goto Exit;
271#endif
272 /* read it */
273 read_bytes = stream->read( stream, stream->pos,
274 stream->base, count );
275 if ( read_bytes < count )
276 {
277 FT_ERROR(( "FT_Stream_EnterFrame:"
278 " invalid read; expected %lu bytes, got %lu\n",
279 count, read_bytes ));
280
281 FT_FREE( stream->base );
282 error = FT_THROW( Invalid_Stream_Operation );
283 }
284 stream->cursor = stream->base;
285 stream->limit = stream->cursor + count;
287 }
288 else
289 {
290 /* check current and new position */
291 if ( stream->pos >= stream->size ||
292 stream->size - stream->pos < count )
293 {
294 FT_ERROR(( "FT_Stream_EnterFrame:"
295 " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",
296 stream->pos, count, stream->size ));
297
298 error = FT_THROW( Invalid_Stream_Operation );
299 goto Exit;
300 }
301
302 /* set cursor */
303 stream->cursor = stream->base + stream->pos;
304 stream->limit = stream->cursor + count;
305 stream->pos += count;
306 }
307
308 Exit:
309 return error;
310 }
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
ft_mem_qalloc(FT_Memory memory, FT_Long size, FT_Error *p_error)
Definition: ftutil.c:66
#define FT_FREE(ptr)
Definition: ftmemory.h:329
#define FT_QALLOC(ptr, size)
Definition: ftmemory.h:316
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
int FT_Error
Definition: fttypes.h:300
static char memory[1024 *256]
Definition: process.c:116
static BOOL read_bytes(parse_buffer *buf, LPVOID data, DWORD size)
Definition: parsing.c:168
static void Exit(void)
Definition: sock.c:1330
ULARGE_INTEGER pos
Definition: request.c:4380
unsigned int size
Definition: parse.h:27

Referenced by FT_Access_Frame(), FT_Stream_ExtractFrame(), FT_Stream_ReadFields(), parse_afm(), pcf_get_bitmaps(), and pcf_get_encodings().

◆ FT_Stream_ExitFrame()

FT_Stream_ExitFrame ( FT_Stream  stream)

Definition at line 314 of file ftstream.c.

315 {
316 /* IMPORTANT: The assertion stream->cursor != 0 was removed, given */
317 /* that it is possible to access a frame of length 0 in */
318 /* some weird fonts (usually, when accessing an array of */
319 /* 0 records, like in some strange kern tables). */
320 /* */
321 /* In this case, the loader code handles the 0-length table */
322 /* gracefully; however, stream.cursor is really set to 0 by the */
323 /* FT_Stream_EnterFrame() call, and this is not an error. */
324 /* */
325 FT_ASSERT( stream );
326
327 if ( stream->read )
328 {
329 FT_Memory memory = stream->memory;
330
331#ifdef FT_DEBUG_MEMORY
332 ft_mem_free( memory, stream->base );
333 stream->base = NULL;
334#else
335 FT_FREE( stream->base );
336#endif
337 }
338 stream->cursor = NULL;
339 stream->limit = NULL;
340 }
#define NULL
Definition: types.h:112
ft_mem_free(FT_Memory memory, const void *P)
Definition: ftutil.c:170

Referenced by FT_Forget_Frame(), FT_Stream_ReadFields(), pcf_get_bitmaps(), and pcf_get_encodings().

◆ FT_Stream_ExtractFrame()

FT_Stream_ExtractFrame ( FT_Stream  stream,
FT_ULong  count,
FT_Byte **  pbytes 
)

Definition at line 193 of file ftstream.c.

196 {
198
199
201 if ( !error )
202 {
203 *pbytes = (FT_Byte*)stream->cursor;
204
205 /* equivalent to FT_Stream_ExitFrame(), with no memory block release */
206 stream->cursor = NULL;
207 stream->limit = NULL;
208 }
209
210 return error;
211 }
FT_Stream_EnterFrame(FT_Stream stream, FT_ULong count)
Definition: ftstream.c:234

Referenced by FT_Extract_Frame().

◆ FT_Stream_Free()

FT_Stream_Free ( FT_Stream  stream,
FT_Int  external 
)

Definition at line 246 of file ftobjs.c.

248 {
249 if ( stream )
250 {
251 FT_Memory memory = stream->memory;
252
253
255
256 if ( !external )
257 FT_FREE( stream );
258 }
259 }
FT_Stream_Close(FT_Stream stream)
Definition: ftstream.c:49

Referenced by destroy_face(), FT_Attach_Stream(), ft_open_face_internal(), and woff_open_font().

◆ FT_Stream_GetChar()

FT_Stream_GetChar ( FT_Stream  stream)

Definition at line 344 of file ftstream.c.

345 {
347
348
349 FT_ASSERT( stream && stream->cursor );
350
351 result = 0;
352 if ( stream->cursor < stream->limit )
353 result = (FT_Char)*stream->cursor++;
354
355 return result;
356 }
signed char FT_Char
Definition: fttypes.h:143
GLuint64EXT * result
Definition: glext.h:11304

◆ FT_Stream_GetULong()

FT_Stream_GetULong ( FT_Stream  stream)

Definition at line 416 of file ftstream.c.

417 {
418 FT_Byte* p;
420
421
422 FT_ASSERT( stream && stream->cursor );
423
424 result = 0;
425 p = stream->cursor;
426 if ( p + 3 < stream->limit )
428 stream->cursor = p;
429 return result;
430 }
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238

◆ FT_Stream_GetULongLE()

FT_Stream_GetULongLE ( FT_Stream  stream)

Definition at line 434 of file ftstream.c.

435 {
436 FT_Byte* p;
438
439
440 FT_ASSERT( stream && stream->cursor );
441
442 result = 0;
443 p = stream->cursor;
444 if ( p + 3 < stream->limit )
446 stream->cursor = p;
447 return result;
448 }
#define FT_NEXT_ULONG_LE(buffer)
Definition: ftstream.h:257

◆ FT_Stream_GetUOffset()

FT_Stream_GetUOffset ( FT_Stream  stream)

Definition at line 398 of file ftstream.c.

399 {
400 FT_Byte* p;
402
403
404 FT_ASSERT( stream && stream->cursor );
405
406 result = 0;
407 p = stream->cursor;
408 if ( p + 2 < stream->limit )
410 stream->cursor = p;
411 return result;
412 }
#define FT_NEXT_UOFF3(buffer)
Definition: ftstream.h:232

◆ FT_Stream_GetUShort()

FT_Stream_GetUShort ( FT_Stream  stream)

Definition at line 360 of file ftstream.c.

361 {
362 FT_Byte* p;
364
365
366 FT_ASSERT( stream && stream->cursor );
367
368 result = 0;
369 p = stream->cursor;
370 if ( p + 1 < stream->limit )
372 stream->cursor = p;
373
374 return result;
375 }
#define FT_NEXT_USHORT(buffer)
Definition: ftstream.h:226
unsigned short FT_UShort
Definition: fttypes.h:209

◆ FT_Stream_GetUShortLE()

FT_Stream_GetUShortLE ( FT_Stream  stream)

Definition at line 379 of file ftstream.c.

380 {
381 FT_Byte* p;
383
384
385 FT_ASSERT( stream && stream->cursor );
386
387 result = 0;
388 p = stream->cursor;
389 if ( p + 1 < stream->limit )
391 stream->cursor = p;
392
393 return result;
394 }
#define FT_NEXT_USHORT_LE(buffer)
Definition: ftstream.h:245

◆ FT_Stream_New()

FT_Stream_New ( FT_Library  library,
const FT_Open_Args args,
FT_Stream astream 
)

Definition at line 178 of file ftobjs.c.

181 {
185
186
187 *astream = NULL;
188
189 if ( !library )
190 return FT_THROW( Invalid_Library_Handle );
191
192 if ( !args )
193 return FT_THROW( Invalid_Argument );
194
196
197 if ( FT_NEW( stream ) )
198 goto Exit;
199
200 stream->memory = memory;
201
202 if ( args->flags & FT_OPEN_MEMORY )
203 {
204 /* create a memory-based stream */
206 (const FT_Byte*)args->memory_base,
207 (FT_ULong)args->memory_size );
208 }
209
210#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
211
212 else if ( args->flags & FT_OPEN_PATHNAME )
213 {
214 /* create a normal system stream */
215 error = FT_Stream_Open( stream, args->pathname );
216 stream->pathname.pointer = args->pathname;
217 }
218 else if ( ( args->flags & FT_OPEN_STREAM ) && args->stream )
219 {
220 /* use an existing, user-provided stream */
221
222 /* in this case, we do not need to allocate a new stream object */
223 /* since the caller is responsible for closing it himself */
224 FT_FREE( stream );
225 stream = args->stream;
226 }
227
228#endif
229
230 else
231 error = FT_THROW( Invalid_Argument );
232
233 if ( error )
234 FT_FREE( stream );
235 else
236 stream->memory = memory; /* just to be certain */
237
238 *astream = stream;
239
240 Exit:
241 return error;
242 }
FT_Library library
Definition: cffdrivr.c:654
#define FT_OPEN_PATHNAME
Definition: freetype.h:2036
#define FT_OPEN_MEMORY
Definition: freetype.h:2034
#define FT_OPEN_STREAM
Definition: freetype.h:2035
#define FT_NEW(ptr)
Definition: ftmemory.h:331
FT_Stream_Open(FT_Stream stream, const char *filepathname)
Definition: ftsystem.c:224
FT_Stream_OpenMemory(FT_Stream stream, const FT_Byte *base, FT_ULong size)
Definition: ftstream.c:35
FT_Memory memory
Definition: ftobjs.h:918
Definition: match.c:390

Referenced by FT_Attach_Stream(), and ft_open_face_internal().

◆ FT_Stream_Open()

FT_Stream_Open ( FT_Stream  stream,
const char filepathname 
)

Definition at line 224 of file ftsystem.c.

226 {
227 FT_FILE* file;
228
229
230 if ( !stream )
231 return FT_THROW( Invalid_Stream_Handle );
232
233 stream->descriptor.pointer = NULL;
234 stream->pathname.pointer = (char*)filepathname;
235 stream->base = NULL;
236 stream->pos = 0;
237 stream->read = NULL;
238 stream->close = NULL;
239
240 file = ft_fopen( filepathname, "rb" );
241 if ( !file )
242 {
243 FT_ERROR(( "FT_Stream_Open:"
244 " could not open `%s'\n", filepathname ));
245
246 return FT_THROW( Cannot_Open_Resource );
247 }
248
249 ft_fseek( file, 0, SEEK_END );
250 stream->size = (unsigned long)ft_ftell( file );
251 if ( !stream->size )
252 {
253 FT_ERROR(( "FT_Stream_Open:" ));
254 FT_ERROR(( " opened `%s' but zero-sized\n", filepathname ));
255 ft_fclose( file );
256 return FT_THROW( Cannot_Open_Stream );
257 }
258 ft_fseek( file, 0, SEEK_SET );
259
260 stream->descriptor.pointer = file;
263
264 FT_TRACE1(( "FT_Stream_Open:" ));
265 FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
266 filepathname, stream->size ));
267
268 return FT_Err_Ok;
269 }
#define SEEK_END
Definition: cabinet.c:29
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
#define FT_FILE
Definition: ftstdlib.h:104
#define ft_fseek
Definition: ftstdlib.h:108
#define ft_fclose
Definition: ftstdlib.h:105
#define ft_ftell
Definition: ftstdlib.h:109
#define ft_fopen
Definition: ftstdlib.h:106
ft_ansi_stream_close(FT_Stream stream)
Definition: ftsystem.c:168
ft_ansi_stream_io(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count)
Definition: ftsystem.c:201
#define SEEK_SET
Definition: jmemansi.c:26
#define long
Definition: qsort.c:33
Definition: fci.c:127

Referenced by FT_Stream_New(), and main().

◆ FT_Stream_OpenMemory()

FT_Stream_OpenMemory ( FT_Stream  stream,
const FT_Byte base,
FT_ULong  size 
)

Definition at line 35 of file ftstream.c.

38 {
39 stream->base = (FT_Byte*) base;
40 stream->size = size;
41 stream->pos = 0;
42 stream->cursor = NULL;
43 stream->read = NULL;
44 stream->close = NULL;
45 }

Referenced by cid_face_open(), FT_New_Memory_Stream(), FT_Stream_New(), load_truetype_glyph(), and woff_open_font().

◆ FT_Stream_Pos()

FT_Stream_Pos ( FT_Stream  stream)

Definition at line 103 of file ftstream.c.

104 {
105 return stream->pos;
106 }

◆ FT_Stream_Read()

FT_Stream_Read ( FT_Stream  stream,
FT_Byte buffer,
FT_ULong  count 
)

Definition at line 110 of file ftstream.c.

113 {
115 }
FT_Stream_ReadAt(FT_Stream stream, FT_ULong pos, FT_Byte *buffer, FT_ULong count)
Definition: ftstream.c:119

Referenced by FT_Raccess_Get_HeaderInfo(), FT_Read_Stream(), and pcf_get_properties().

◆ FT_Stream_ReadAt()

FT_Stream_ReadAt ( FT_Stream  stream,
FT_ULong  pos,
FT_Byte buffer,
FT_ULong  count 
)

Definition at line 119 of file ftstream.c.

123 {
126
127
128 if ( pos >= stream->size )
129 {
130 FT_ERROR(( "FT_Stream_ReadAt:"
131 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
132 pos, stream->size ));
133
134 return FT_THROW( Invalid_Stream_Operation );
135 }
136
137 if ( stream->read )
138 read_bytes = stream->read( stream, pos, buffer, count );
139 else
140 {
142 if ( read_bytes > count )
144
146 }
147
149
150 if ( read_bytes < count )
151 {
152 FT_ERROR(( "FT_Stream_ReadAt:"
153 " invalid read; expected %lu bytes, got %lu\n",
154 count, read_bytes ));
155
156 error = FT_THROW( Invalid_Stream_Operation );
157 }
158
159 return error;
160 }
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:228

Referenced by FT_Read_Stream_At(), and FT_Stream_Read().

◆ FT_Stream_ReadChar()

FT_Stream_ReadChar ( FT_Stream  stream,
FT_Error error 
)

Definition at line 452 of file ftstream.c.

454 {
455 FT_Byte result = 0;
456
457
458 FT_ASSERT( stream );
459
460 *error = FT_Err_Ok;
461
462 if ( stream->read )
463 {
464 if ( stream->read( stream, stream->pos, &result, 1L ) != 1L )
465 goto Fail;
466 }
467 else
468 {
469 if ( stream->pos < stream->size )
470 result = stream->base[stream->pos];
471 else
472 goto Fail;
473 }
474 stream->pos++;
475
476 return (FT_Char)result;
477
478 Fail:
479 *error = FT_THROW( Invalid_Stream_Operation );
480 FT_ERROR(( "FT_Stream_ReadChar:"
481 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
482 stream->pos, stream->size ));
483
484 return 0;
485 }
int Fail
Definition: ehthrow.cxx:24

◆ FT_Stream_ReadFields()

FT_Stream_ReadFields ( FT_Stream  stream,
const FT_Frame_Field fields,
void structure 
)

Definition at line 714 of file ftstream.c.

717 {
719 FT_Bool frame_accessed = 0;
721
722
723 if ( !fields )
724 return FT_THROW( Invalid_Argument );
725
726 if ( !stream )
727 return FT_THROW( Invalid_Stream_Handle );
728
729 cursor = stream->cursor;
730
732 do
733 {
735 FT_Int sign_shift;
736 FT_Byte* p;
737
738
739 switch ( fields->value )
740 {
741 case ft_frame_start: /* access a new frame */
743 if ( error )
744 goto Exit;
745
746 frame_accessed = 1;
747 cursor = stream->cursor;
748 fields++;
749 continue; /* loop! */
750
751 case ft_frame_bytes: /* read a byte sequence */
752 case ft_frame_skip: /* skip some bytes */
753 {
754 FT_UInt len = fields->size;
755
756
757 if ( cursor + len > stream->limit )
758 {
759 error = FT_THROW( Invalid_Stream_Operation );
760 goto Exit;
761 }
762
763 if ( fields->value == ft_frame_bytes )
764 {
765 p = (FT_Byte*)structure + fields->offset;
766 FT_MEM_COPY( p, cursor, len );
767 }
768 cursor += len;
769 fields++;
770 continue;
771 }
772
773 case ft_frame_byte:
774 case ft_frame_schar: /* read a single byte */
776 sign_shift = 24;
777 break;
778
780 case ft_frame_ushort_be: /* read a 2-byte big-endian short */
782 sign_shift = 16;
783 break;
784
786 case ft_frame_ushort_le: /* read a 2-byte little-endian short */
788 sign_shift = 16;
789 break;
790
791 case ft_frame_long_be:
792 case ft_frame_ulong_be: /* read a 4-byte big-endian long */
794 sign_shift = 0;
795 break;
796
797 case ft_frame_long_le:
798 case ft_frame_ulong_le: /* read a 4-byte little-endian long */
800 sign_shift = 0;
801 break;
802
803 case ft_frame_off3_be:
804 case ft_frame_uoff3_be: /* read a 3-byte big-endian long */
806 sign_shift = 8;
807 break;
808
809 case ft_frame_off3_le:
810 case ft_frame_uoff3_le: /* read a 3-byte little-endian long */
812 sign_shift = 8;
813 break;
814
815 default:
816 /* otherwise, exit the loop */
817 stream->cursor = cursor;
818 goto Exit;
819 }
820
821 /* now, compute the signed value is necessary */
822 if ( fields->value & FT_FRAME_OP_SIGNED )
823 value = (FT_ULong)( (FT_Int32)( value << sign_shift ) >> sign_shift );
824
825 /* finally, store the value in the object */
826
827 p = (FT_Byte*)structure + fields->offset;
828 switch ( fields->size )
829 {
830 case ( 8 / FT_CHAR_BIT ):
831 *(FT_Byte*)p = (FT_Byte)value;
832 break;
833
834 case ( 16 / FT_CHAR_BIT ):
836 break;
837
838 case ( 32 / FT_CHAR_BIT ):
839 *(FT_UInt32*)p = (FT_UInt32)value;
840 break;
841
842 default: /* for 64-bit systems */
843 *(FT_ULong*)p = (FT_ULong)value;
844 }
845
846 /* go to next field */
847 fields++;
848 }
849 while ( 1 );
850
851 Exit:
852 /* close the frame if it was opened by this read */
853 if ( frame_accessed )
855
856 return error;
857 }
switch(r->id)
Definition: btrfs.c:3046
#define FT_CHAR_BIT
Definition: ftconfig.h:70
FT_Stream_ExitFrame(FT_Stream stream)
Definition: ftstream.c:314
#define FT_FRAME_OP_SIGNED
Definition: ftstream.h:41
#define FT_NEXT_UOFF3_LE(buffer)
Definition: ftstream.h:251
#define FT_NEXT_BYTE(buffer)
Definition: ftstream.h:220
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
GLenum GLsizei len
Definition: glext.h:6722
const char cursor[]
Definition: icontest.c:13
const char * fields[10]
Definition: parser.c:313
Definition: pdh_main.c:94

◆ FT_Stream_ReadULong()

FT_Stream_ReadULong ( FT_Stream  stream,
FT_Error error 
)

Definition at line 624 of file ftstream.c.

626 {
627 FT_Byte reads[4];
628 FT_Byte* p = 0;
629 FT_ULong result = 0;
630
631
632 FT_ASSERT( stream );
633
634 *error = FT_Err_Ok;
635
636 if ( stream->pos + 3 < stream->size )
637 {
638 if ( stream->read )
639 {
640 if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )
641 goto Fail;
642
643 p = reads;
644 }
645 else
646 p = stream->base + stream->pos;
647
648 if ( p )
650 }
651 else
652 goto Fail;
653
654 stream->pos += 4;
655
656 return result;
657
658 Fail:
659 *error = FT_THROW( Invalid_Stream_Operation );
660 FT_ERROR(( "FT_Stream_ReadULong:"
661 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
662 stream->pos, stream->size ));
663
664 return 0;
665 }

◆ FT_Stream_ReadULongLE()

FT_Stream_ReadULongLE ( FT_Stream  stream,
FT_Error error 
)

Definition at line 669 of file ftstream.c.

671 {
672 FT_Byte reads[4];
673 FT_Byte* p = 0;
674 FT_ULong result = 0;
675
676
677 FT_ASSERT( stream );
678
679 *error = FT_Err_Ok;
680
681 if ( stream->pos + 3 < stream->size )
682 {
683 if ( stream->read )
684 {
685 if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )
686 goto Fail;
687
688 p = reads;
689 }
690 else
691 p = stream->base + stream->pos;
692
693 if ( p )
695 }
696 else
697 goto Fail;
698
699 stream->pos += 4;
700
701 return result;
702
703 Fail:
704 *error = FT_THROW( Invalid_Stream_Operation );
705 FT_ERROR(( "FT_Stream_ReadULongLE:"
706 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
707 stream->pos, stream->size ));
708
709 return 0;
710 }

◆ FT_Stream_ReadUOffset()

FT_Stream_ReadUOffset ( FT_Stream  stream,
FT_Error error 
)

Definition at line 579 of file ftstream.c.

581 {
582 FT_Byte reads[3];
583 FT_Byte* p = 0;
584 FT_ULong result = 0;
585
586
587 FT_ASSERT( stream );
588
589 *error = FT_Err_Ok;
590
591 if ( stream->pos + 2 < stream->size )
592 {
593 if ( stream->read )
594 {
595 if (stream->read( stream, stream->pos, reads, 3L ) != 3L )
596 goto Fail;
597
598 p = reads;
599 }
600 else
601 p = stream->base + stream->pos;
602
603 if ( p )
605 }
606 else
607 goto Fail;
608
609 stream->pos += 3;
610
611 return result;
612
613 Fail:
614 *error = FT_THROW( Invalid_Stream_Operation );
615 FT_ERROR(( "FT_Stream_ReadUOffset:"
616 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
617 stream->pos, stream->size ));
618
619 return 0;
620 }

◆ FT_Stream_ReadUShort()

FT_Stream_ReadUShort ( FT_Stream  stream,
FT_Error error 
)

Definition at line 489 of file ftstream.c.

491 {
492 FT_Byte reads[2];
493 FT_Byte* p = 0;
494 FT_UShort result = 0;
495
496
497 FT_ASSERT( stream );
498
499 *error = FT_Err_Ok;
500
501 if ( stream->pos + 1 < stream->size )
502 {
503 if ( stream->read )
504 {
505 if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )
506 goto Fail;
507
508 p = reads;
509 }
510 else
511 p = stream->base + stream->pos;
512
513 if ( p )
515 }
516 else
517 goto Fail;
518
519 stream->pos += 2;
520
521 return result;
522
523 Fail:
524 *error = FT_THROW( Invalid_Stream_Operation );
525 FT_ERROR(( "FT_Stream_ReadUShort:"
526 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
527 stream->pos, stream->size ));
528
529 return 0;
530 }

◆ FT_Stream_ReadUShortLE()

FT_Stream_ReadUShortLE ( FT_Stream  stream,
FT_Error error 
)

Definition at line 534 of file ftstream.c.

536 {
537 FT_Byte reads[2];
538 FT_Byte* p = 0;
539 FT_UShort result = 0;
540
541
542 FT_ASSERT( stream );
543
544 *error = FT_Err_Ok;
545
546 if ( stream->pos + 1 < stream->size )
547 {
548 if ( stream->read )
549 {
550 if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )
551 goto Fail;
552
553 p = reads;
554 }
555 else
556 p = stream->base + stream->pos;
557
558 if ( p )
560 }
561 else
562 goto Fail;
563
564 stream->pos += 2;
565
566 return result;
567
568 Fail:
569 *error = FT_THROW( Invalid_Stream_Operation );
570 FT_ERROR(( "FT_Stream_ReadUShortLE:"
571 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
572 stream->pos, stream->size ));
573
574 return 0;
575 }

◆ FT_Stream_ReleaseFrame()

FT_Stream_ReleaseFrame ( FT_Stream  stream,
FT_Byte **  pbytes 
)

Definition at line 215 of file ftstream.c.

217 {
218 if ( stream && stream->read )
219 {
220 FT_Memory memory = stream->memory;
221
222#ifdef FT_DEBUG_MEMORY
223 ft_mem_free( memory, *pbytes );
224 *pbytes = NULL;
225#else
226 FT_FREE( *pbytes );
227#endif
228 }
229 *pbytes = NULL;
230 }

Referenced by FT_Release_Frame().

◆ FT_Stream_Seek()

FT_Stream_Seek ( FT_Stream  stream,
FT_ULong  pos 
)

Definition at line 57 of file ftstream.c.

59 {
61
62
63 if ( stream->read )
64 {
65 if ( stream->read( stream, pos, 0, 0 ) )
66 {
67 FT_ERROR(( "FT_Stream_Seek:"
68 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
69 pos, stream->size ));
70
71 error = FT_THROW( Invalid_Stream_Operation );
72 }
73 }
74 /* note that seeking to the first position after the file is valid */
75 else if ( pos > stream->size )
76 {
77 FT_ERROR(( "FT_Stream_Seek:"
78 " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
79 pos, stream->size ));
80
81 error = FT_THROW( Invalid_Stream_Operation );
82 }
83
84 if ( !error )
85 stream->pos = pos;
86
87 return error;
88 }

Referenced by ft_lzwstate_io(), ft_open_face_internal(), FT_Raccess_Get_DataOffsets(), FT_Raccess_Get_HeaderInfo(), FT_Seek_Stream(), and FT_Stream_Skip().

◆ FT_Stream_Skip()

FT_Stream_Skip ( FT_Stream  stream,
FT_Long  distance 
)

Definition at line 92 of file ftstream.c.

94 {
95 if ( distance < 0 )
96 return FT_THROW( Invalid_Stream_Operation );
97
99 }
FT_Stream_Seek(FT_Stream stream, FT_ULong pos)
Definition: ftstream.c:57

Referenced by FT_Skip_Stream().

◆ FT_Stream_TryRead()

FT_Stream_TryRead ( FT_Stream  stream,
FT_Byte buffer,
FT_ULong  count 
)

Definition at line 164 of file ftstream.c.

167 {
169
170
171 if ( stream->pos >= stream->size )
172 goto Exit;
173
174 if ( stream->read )
176 else
177 {
179 if ( read_bytes > count )
181
183 }
184
186
187 Exit:
188 return read_bytes;
189 }

Referenced by _bdf_readstream(), ft_lzwstate_io(), and ft_lzwstate_refill().