freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master b287c80: Various minor clean-ups.


From: Werner LEMBERG
Subject: [freetype2] master b287c80: Various minor clean-ups.
Date: Sun, 26 Aug 2018 00:40:52 -0400 (EDT)

branch: master
commit b287c80b6a7d669a3c31aed7aeb6f8900e75a068
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    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.
---
 ChangeLog                            |  12 +++-
 include/freetype/internal/ftstream.h |  20 ++++--
 src/base/Jamfile                     |   3 +-
 src/base/ftapi.c                     | 121 -----------------------------------
 src/base/ftglyph.c                   |   6 +-
 src/base/ftstream.c                  |   5 +-
 6 files changed, 32 insertions(+), 135 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 68f3fed..0aa2a2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,14 @@
-2018-05-25  Nikhil Ramakrishnan  <address@hidden>
+2018-08-26  Werner Lemberg  <address@hidden>
+
+       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  <address@hidden>
 
        Convert documentation markup to Markdown.
 
diff --git a/include/freetype/internal/ftstream.h 
b/include/freetype/internal/ftstream.h
index 7d44e4b..4b45f9a 100644
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -96,13 +96,13 @@ FT_BEGIN_HEADER
   /* 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 @@ FT_BEGIN_HEADER
 
   /* 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,14 +422,17 @@ FT_BEGIN_HEADER
   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,
@@ -439,6 +444,7 @@ FT_BEGIN_HEADER
   FT_Stream_ReleaseFrame( FT_Stream  stream,
                           FT_Byte**  pbytes );
 
+
   /* read a byte from an entered frame */
   FT_BASE( FT_Char )
   FT_Stream_GetChar( FT_Stream  stream );
diff --git a/src/base/Jamfile b/src/base/Jamfile
index 5bee6e2..a1c5fe2 100644
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -48,8 +48,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) base ;
 # Add the optional/replaceable files.
 #
 {
-  local  _sources = ftapi
-                    ftbbox
+  local  _sources = ftbbox
                     ftbdf
                     ftbitmap
                     ftcid
diff --git a/src/base/ftapi.c b/src/base/ftapi.c
deleted file mode 100644
index 2e6f942..0000000
--- a/src/base/ftapi.c
+++ /dev/null
@@ -1,121 +0,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 */
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index a752dbd..27402ec 100644
--- 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 )
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index 8a7affa..ab9546c 100644
--- 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;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]