ae68a7
--- freetype-2.4.11/src/base/ftstream.c
ae68a7
+++ freetype-2.4.11/src/base/ftstream.c
ae68a7
@@ -373,6 +373,25 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Short )
ae68a7
+  FT_Stream_GetShort( FT_Stream  stream )
ae68a7
+  {
ae68a7
+    FT_Byte*  p;
ae68a7
+    FT_Short  result;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream && stream->cursor );
ae68a7
+
ae68a7
+    result         = 0;
ae68a7
+    p              = stream->cursor;
ae68a7
+    if ( p + 1 < stream->limit )
ae68a7
+      result       = FT_NEXT_SHORT( p );
ae68a7
+    stream->cursor = p;
ae68a7
+
ae68a7
+    return result;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_UShort )
ae68a7
   FT_Stream_GetUShortLE( FT_Stream  stream )
ae68a7
   {
ae68a7
@@ -392,6 +411,25 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Short )
ae68a7
+  FT_Stream_GetShortLE( FT_Stream  stream )
ae68a7
+  {
ae68a7
+    FT_Byte*  p;
ae68a7
+    FT_Short  result;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream && stream->cursor );
ae68a7
+
ae68a7
+    result         = 0;
ae68a7
+    p              = stream->cursor;
ae68a7
+    if ( p + 1 < stream->limit )
ae68a7
+      result       = FT_NEXT_SHORT_LE( p );
ae68a7
+    stream->cursor = p;
ae68a7
+
ae68a7
+    return result;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_ULong )
ae68a7
   FT_Stream_GetUOffset( FT_Stream  stream )
ae68a7
   {
ae68a7
@@ -410,6 +448,24 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Long )
ae68a7
+  FT_Stream_GetOffset( FT_Stream  stream )
ae68a7
+  {
ae68a7
+    FT_Byte*  p;
ae68a7
+    FT_Long   result;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream && stream->cursor );
ae68a7
+
ae68a7
+    result         = 0;
ae68a7
+    p              = stream->cursor;
ae68a7
+    if ( p + 2 < stream->limit )
ae68a7
+      result       = FT_NEXT_OFF3( p );
ae68a7
+    stream->cursor = p;
ae68a7
+    return result;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_ULong )
ae68a7
   FT_Stream_GetULong( FT_Stream  stream )
ae68a7
   {
ae68a7
@@ -428,6 +484,24 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Long )
ae68a7
+  FT_Stream_GetLong( FT_Stream  stream )
ae68a7
+  {
ae68a7
+    FT_Byte*  p;
ae68a7
+    FT_Long   result;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream && stream->cursor );
ae68a7
+
ae68a7
+    result         = 0;
ae68a7
+    p              = stream->cursor;
ae68a7
+    if ( p + 3 < stream->limit )
ae68a7
+      result       = FT_NEXT_LONG( p );
ae68a7
+    stream->cursor = p;
ae68a7
+    return result;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_ULong )
ae68a7
   FT_Stream_GetULongLE( FT_Stream  stream )
ae68a7
   {
ae68a7
@@ -446,6 +520,24 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Long )
ae68a7
+  FT_Stream_GetLongLE( FT_Stream  stream )
ae68a7
+  {
ae68a7
+    FT_Byte*  p;
ae68a7
+    FT_Long   result;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream && stream->cursor );
ae68a7
+
ae68a7
+    result         = 0;
ae68a7
+    p              = stream->cursor;
ae68a7
+    if ( p + 3 < stream->limit )
ae68a7
+      result       = FT_NEXT_LONG_LE( p );
ae68a7
+    stream->cursor = p;
ae68a7
+    return result;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_Char )
ae68a7
   FT_Stream_ReadChar( FT_Stream  stream,
ae68a7
                       FT_Error*  error )
ae68a7
@@ -530,6 +622,53 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Short )
ae68a7
+  FT_Stream_ReadShort( FT_Stream  stream,
ae68a7
+                       FT_Error*  error )
ae68a7
+  {
ae68a7
+    FT_Byte   reads[2];
ae68a7
+    FT_Byte*  p = 0;
ae68a7
+    FT_Short  result = 0;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream );
ae68a7
+
ae68a7
+    *error = FT_Err_Ok;
ae68a7
+
ae68a7
+    if ( stream->pos + 1 < stream->size )
ae68a7
+    {
ae68a7
+      if ( stream->read )
ae68a7
+      {
ae68a7
+        if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )
ae68a7
+          goto Fail;
ae68a7
+
ae68a7
+        p = reads;
ae68a7
+      }
ae68a7
+      else
ae68a7
+      {
ae68a7
+        p = stream->base + stream->pos;
ae68a7
+      }
ae68a7
+
ae68a7
+      if ( p )
ae68a7
+        result = FT_NEXT_SHORT( p );
ae68a7
+    }
ae68a7
+    else
ae68a7
+      goto Fail;
ae68a7
+
ae68a7
+    stream->pos += 2;
ae68a7
+
ae68a7
+    return result;
ae68a7
+
ae68a7
+  Fail:
ae68a7
+    *error = FT_Err_Invalid_Stream_Operation;
ae68a7
+    FT_ERROR(( "FT_Stream_ReadShort:"
ae68a7
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
ae68a7
+               stream->pos, stream->size ));
ae68a7
+
ae68a7
+    return 0;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_UShort )
ae68a7
   FT_Stream_ReadUShortLE( FT_Stream  stream,
ae68a7
                           FT_Error*  error )
ae68a7
@@ -577,6 +716,53 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Short )
ae68a7
+  FT_Stream_ReadShortLE( FT_Stream  stream,
ae68a7
+                         FT_Error*  error )
ae68a7
+  {
ae68a7
+    FT_Byte   reads[2];
ae68a7
+    FT_Byte*  p = 0;
ae68a7
+    FT_Short  result = 0;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream );
ae68a7
+
ae68a7
+    *error = FT_Err_Ok;
ae68a7
+
ae68a7
+    if ( stream->pos + 1 < stream->size )
ae68a7
+    {
ae68a7
+      if ( stream->read )
ae68a7
+      {
ae68a7
+        if ( stream->read( stream, stream->pos, reads, 2L ) != 2L )
ae68a7
+          goto Fail;
ae68a7
+
ae68a7
+        p = reads;
ae68a7
+      }
ae68a7
+      else
ae68a7
+      {
ae68a7
+        p = stream->base + stream->pos;
ae68a7
+      }
ae68a7
+
ae68a7
+      if ( p )
ae68a7
+        result = FT_NEXT_SHORT_LE( p );
ae68a7
+    }
ae68a7
+    else
ae68a7
+      goto Fail;
ae68a7
+
ae68a7
+    stream->pos += 2;
ae68a7
+
ae68a7
+    return result;
ae68a7
+
ae68a7
+  Fail:
ae68a7
+    *error = FT_Err_Invalid_Stream_Operation;
ae68a7
+    FT_ERROR(( "FT_Stream_ReadShortLE:"
ae68a7
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
ae68a7
+               stream->pos, stream->size ));
ae68a7
+
ae68a7
+    return 0;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_ULong )
ae68a7
   FT_Stream_ReadUOffset( FT_Stream  stream,
ae68a7
                          FT_Error*  error )
ae68a7
@@ -624,6 +810,53 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Long )
ae68a7
+  FT_Stream_ReadOffset( FT_Stream  stream,
ae68a7
+                        FT_Error*  error )
ae68a7
+  {
ae68a7
+    FT_Byte   reads[3];
ae68a7
+    FT_Byte*  p = 0;
ae68a7
+    FT_Long   result = 0;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream );
ae68a7
+
ae68a7
+    *error = FT_Err_Ok;
ae68a7
+
ae68a7
+    if ( stream->pos + 2 < stream->size )
ae68a7
+    {
ae68a7
+      if ( stream->read )
ae68a7
+      {
ae68a7
+        if (stream->read( stream, stream->pos, reads, 3L ) != 3L )
ae68a7
+          goto Fail;
ae68a7
+
ae68a7
+        p = reads;
ae68a7
+      }
ae68a7
+      else
ae68a7
+      {
ae68a7
+        p = stream->base + stream->pos;
ae68a7
+      }
ae68a7
+
ae68a7
+      if ( p )
ae68a7
+        result = FT_NEXT_OFF3( p );
ae68a7
+    }
ae68a7
+    else
ae68a7
+      goto Fail;
ae68a7
+
ae68a7
+    stream->pos += 3;
ae68a7
+
ae68a7
+    return result;
ae68a7
+
ae68a7
+  Fail:
ae68a7
+    *error = FT_Err_Invalid_Stream_Operation;
ae68a7
+    FT_ERROR(( "FT_Stream_ReadOffset:"
ae68a7
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
ae68a7
+               stream->pos, stream->size ));
ae68a7
+
ae68a7
+    return 0;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_ULong )
ae68a7
   FT_Stream_ReadULong( FT_Stream  stream,
ae68a7
                        FT_Error*  error )
ae68a7
@@ -671,6 +904,53 @@
ae68a7
   }
ae68a7
 
ae68a7
 
ae68a7
+  FT_BASE_DEF( FT_Long )
ae68a7
+  FT_Stream_ReadLong( FT_Stream  stream,
ae68a7
+                      FT_Error*  error )
ae68a7
+  {
ae68a7
+    FT_Byte   reads[4];
ae68a7
+    FT_Byte*  p = 0;
ae68a7
+    FT_Long   result = 0;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream );
ae68a7
+
ae68a7
+    *error = FT_Err_Ok;
ae68a7
+
ae68a7
+    if ( stream->pos + 3 < stream->size )
ae68a7
+    {
ae68a7
+      if ( stream->read )
ae68a7
+      {
ae68a7
+        if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )
ae68a7
+          goto Fail;
ae68a7
+
ae68a7
+        p = reads;
ae68a7
+      }
ae68a7
+      else
ae68a7
+      {
ae68a7
+        p = stream->base + stream->pos;
ae68a7
+      }
ae68a7
+
ae68a7
+      if ( p )
ae68a7
+        result = FT_NEXT_LONG( p );
ae68a7
+    }
ae68a7
+    else
ae68a7
+      goto Fail;
ae68a7
+
ae68a7
+    stream->pos += 4;
ae68a7
+
ae68a7
+    return result;
ae68a7
+
ae68a7
+  Fail:
ae68a7
+    *error = FT_Err_Invalid_Stream_Operation;
ae68a7
+    FT_ERROR(( "FT_Stream_ReadLong:"
ae68a7
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
ae68a7
+               stream->pos, stream->size ));
ae68a7
+
ae68a7
+    return 0;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
   FT_BASE_DEF( FT_ULong )
ae68a7
   FT_Stream_ReadULongLE( FT_Stream  stream,
ae68a7
                          FT_Error*  error )
ae68a7
@@ -714,6 +994,53 @@
ae68a7
                " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
ae68a7
                stream->pos, stream->size ));
ae68a7
 
ae68a7
+    return 0;
ae68a7
+  }
ae68a7
+
ae68a7
+
ae68a7
+  FT_BASE_DEF( FT_Long )
ae68a7
+  FT_Stream_ReadLongLE( FT_Stream  stream,
ae68a7
+                        FT_Error*  error )
ae68a7
+  {
ae68a7
+    FT_Byte   reads[4];
ae68a7
+    FT_Byte*  p = 0;
ae68a7
+    FT_Long   result = 0;
ae68a7
+
ae68a7
+
ae68a7
+    FT_ASSERT( stream );
ae68a7
+
ae68a7
+    *error = FT_Err_Ok;
ae68a7
+
ae68a7
+    if ( stream->pos + 3 < stream->size )
ae68a7
+    {
ae68a7
+      if ( stream->read )
ae68a7
+      {
ae68a7
+        if ( stream->read( stream, stream->pos, reads, 4L ) != 4L )
ae68a7
+          goto Fail;
ae68a7
+
ae68a7
+        p = reads;
ae68a7
+      }
ae68a7
+      else
ae68a7
+      {
ae68a7
+        p = stream->base + stream->pos;
ae68a7
+      }
ae68a7
+
ae68a7
+      if ( p )
ae68a7
+        result = FT_NEXT_LONG_LE( p );
ae68a7
+    }
ae68a7
+    else
ae68a7
+      goto Fail;
ae68a7
+
ae68a7
+    stream->pos += 4;
ae68a7
+
ae68a7
+    return result;
ae68a7
+
ae68a7
+  Fail:
ae68a7
+    *error = FT_Err_Invalid_Stream_Operation;
ae68a7
+    FT_ERROR(( "FT_Stream_ReadLongLE:"
ae68a7
+               " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
ae68a7
+               stream->pos, stream->size ));
ae68a7
+
ae68a7
     return 0;
ae68a7
   }
ae68a7