shithub: freetype+ttf2subf

Download patch

ref: b287c80b6a7d669a3c31aed7aeb6f8900e75a068
parent: c98aa9b78ace3caa6eeeee9603e4c74c3885ffd4
author: Werner Lemberg <[email protected]>
date: Sun Aug 26 02:39:43 EDT 2018

Various minor clean-ups.

* src/base/ftapi.c: Remove.  Unused.
* src/base/Jamfile (_sources): Updated.

* src/base/ftstream.c (FT_Stream_ReleaseFrame): Remove redundant
code.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,14 @@
-2018-05-25  Nikhil Ramakrishnan  <[email protected]>
+2018-08-26  Werner Lemberg  <[email protected]>
+
+	Various minor clean-ups.
+
+	* src/base/ftapi.c: Remove.  Unused.
+	* src/base/Jamfile (_sources): Updated.
+
+	* src/base/ftstream.c (FT_Stream_ReleaseFrame): Remove redundant
+	code.
+
+2018-08-25  Nikhil Ramakrishnan  <[email protected]>
 
 	Convert documentation markup to Markdown.
 
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -96,13 +96,13 @@
   /* The structure type must be set in the FT_STRUCTURE macro before       */
   /* calling the FT_FRAME_START() macro.                                   */
   /*                                                                       */
-#define FT_FIELD_SIZE( f ) \
+#define FT_FIELD_SIZE( f )                          \
           (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
 
-#define FT_FIELD_SIZE_DELTA( f ) \
+#define FT_FIELD_SIZE_DELTA( f )                       \
           (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )
 
-#define FT_FIELD_OFFSET( f ) \
+#define FT_FIELD_OFFSET( f )                         \
           (FT_UShort)( offsetof( FT_STRUCTURE, f ) )
 
 #define FT_FRAME_FIELD( frame_op, field ) \
@@ -406,12 +406,14 @@
 
   /* Enter a frame of `count' consecutive bytes in a stream.  Returns an */
   /* error if the frame could not be read/accessed.  The caller can use  */
-  /* the `FT_Stream_Get_XXX' functions to retrieve frame data without    */
+  /* the `FT_Stream_GetXXX' functions to retrieve frame data without     */
   /* error checks.                                                       */
   /*                                                                     */
   /* You must _always_ call `FT_Stream_ExitFrame' once you have entered  */
   /* a stream frame!                                                     */
   /*                                                                     */
+  /* Nested frames are not permitted.                                    */
+  /*                                                                     */
   FT_BASE( FT_Error )
   FT_Stream_EnterFrame( FT_Stream  stream,
                         FT_ULong   count );
@@ -420,15 +422,18 @@
   FT_BASE( void )
   FT_Stream_ExitFrame( FT_Stream  stream );
 
+
   /* Extract a stream frame.  If the stream is disk-based, a heap block */
   /* is allocated and the frame bytes are read into it.  If the stream  */
-  /* is memory-based, this function simply set a pointer to the data.   */
+  /* is memory-based, this function simply sets a pointer to the data.  */
   /*                                                                    */
   /* Useful to optimize access to memory-based streams transparently.   */
   /*                                                                    */
-  /* All extracted frames must be `freed' with a call to the function   */
-  /* FT_Stream_ReleaseFrame().                                          */
+  /* `FT_Stream_GetXXX' functions can't be used.                        */
   /*                                                                    */
+  /* An extracted frame must be `freed' with a call to the function     */
+  /* `FT_Stream_ReleaseFrame'.                                          */
+  /*                                                                    */
   FT_BASE( FT_Error )
   FT_Stream_ExtractFrame( FT_Stream  stream,
                           FT_ULong   count,
@@ -438,6 +443,7 @@
   FT_BASE( void )
   FT_Stream_ReleaseFrame( FT_Stream  stream,
                           FT_Byte**  pbytes );
+
 
   /* read a byte from an entered frame */
   FT_BASE( FT_Char )
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -48,8 +48,7 @@
 # Add the optional/replaceable files.
 #
 {
-  local  _sources = ftapi
-                    ftbbox
+  local  _sources = ftbbox
                     ftbdf
                     ftbitmap
                     ftcid
--- a/src/base/ftapi.c
+++ /dev/null
@@ -1,121 +1,0 @@
-/****************************************************************************
- *
- * ftapi.c
- *
- *   The FreeType compatibility functions (body).
- *
- * Copyright 2002-2018 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
- *
- * This file is part of the FreeType project, and may only be used,
- * modified, and distributed under the terms of the FreeType project
- * license, LICENSE.TXT.  By continuing to use, modify, or distribute
- * this file you indicate that you have read the license and
- * understand and accept it fully.
- *
- */
-
-
-#include <ft2build.h>
-#include FT_LIST_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TABLES_H
-#include FT_OUTLINE_H
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****                                                                 ****/
-  /****                 C O M P A T I B I L I T Y                       ****/
-  /****                                                                 ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /* backward compatibility API */
-
-  FT_BASE_DEF( void )
-  FT_New_Memory_Stream( FT_Library  library,
-                        FT_Byte*    base,
-                        FT_ULong    size,
-                        FT_Stream   stream )
-  {
-    FT_UNUSED( library );
-
-    FT_Stream_OpenMemory( stream, base, size );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_Seek_Stream( FT_Stream  stream,
-                  FT_ULong   pos )
-  {
-    return FT_Stream_Seek( stream, pos );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_Skip_Stream( FT_Stream  stream,
-                  FT_Long    distance )
-  {
-    return FT_Stream_Skip( stream, distance );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_Read_Stream( FT_Stream  stream,
-                  FT_Byte*   buffer,
-                  FT_ULong   count )
-  {
-    return FT_Stream_Read( stream, buffer, count );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_Read_Stream_At( FT_Stream  stream,
-                     FT_ULong   pos,
-                     FT_Byte*   buffer,
-                     FT_ULong   count )
-  {
-    return FT_Stream_ReadAt( stream, pos, buffer, count );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_Extract_Frame( FT_Stream  stream,
-                    FT_ULong   count,
-                    FT_Byte**  pbytes )
-  {
-    return FT_Stream_ExtractFrame( stream, count, pbytes );
-  }
-
-
-  FT_BASE_DEF( void )
-  FT_Release_Frame( FT_Stream  stream,
-                    FT_Byte**  pbytes )
-  {
-    FT_Stream_ReleaseFrame( stream, pbytes );
-  }
-
-  FT_BASE_DEF( FT_Error )
-  FT_Access_Frame( FT_Stream  stream,
-                   FT_ULong   count )
-  {
-    return FT_Stream_EnterFrame( stream, count );
-  }
-
-
-  FT_BASE_DEF( void )
-  FT_Forget_Frame( FT_Stream  stream )
-  {
-    FT_Stream_ExitFrame( stream );
-  }
-
-
-/* END */
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -76,7 +76,7 @@
     /* do lazy copying whenever possible */
     if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
     {
-      glyph->bitmap = slot->bitmap;
+      glyph->bitmap          = slot->bitmap;
       slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
     }
     else
@@ -400,8 +400,8 @@
   FT_Get_Glyph( FT_GlyphSlot  slot,
                 FT_Glyph     *aglyph )
   {
-    FT_Error    error;
-    FT_Glyph    glyph;
+    FT_Error  error;
+    FT_Glyph  glyph;
 
 
     if ( !slot )
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -222,11 +222,11 @@
 
 #ifdef FT_DEBUG_MEMORY
       ft_mem_free( memory, *pbytes );
-      *pbytes = NULL;
 #else
       FT_FREE( *pbytes );
 #endif
     }
+
     *pbytes = NULL;
   }
 
@@ -282,6 +282,7 @@
         FT_FREE( stream->base );
         error = FT_THROW( Invalid_Stream_Operation );
       }
+
       stream->cursor = stream->base;
       stream->limit  = stream->cursor + count;
       stream->pos   += read_bytes;
@@ -329,6 +330,7 @@
     {
       FT_Memory  memory = stream->memory;
 
+
 #ifdef FT_DEBUG_MEMORY
       ft_mem_free( memory, stream->base );
       stream->base = NULL;
@@ -336,6 +338,7 @@
       FT_FREE( stream->base );
 #endif
     }
+
     stream->cursor = NULL;
     stream->limit  = NULL;
   }