Formatting, copyright years.

This commit is contained in:
Werner Lemberg 2006-02-25 16:52:16 +00:00
parent de271ab8f0
commit 7f049f4221
11 changed files with 291 additions and 277 deletions

View File

@ -1,23 +1,38 @@
2006-02-25 David Turner <david@freetype.org> 2006-02-25 David Turner <david@freetype.org>
* include/freetype/config/ftoption.h, src/autofit/afcjk.c, Fix compiler warnings as well as C++ compilation problems.
src/base/ftobjs.c, src/base/ftutil.c, src/cff/cffobjs.c, Add missing prototypes.
src/psaux/afmparse.c, src/sfnt/ttbdf.c, src/tools/apinames.c,
src/truetype/ttdriver.c:
solved compiler warnings as well as C++ compilation problems * src/autofit/afcjk.c, src/base/ftobjs.c, src/base/ftutil.c,
src/bdf/bdfdrivr.c, src/cff/cffcmap.c, src/cff/cffobjs.c,
src/psaux/afmparse.c,, src/psaux/t1cmap.c, src/smooth/ftgrays.c
src/tools/apinames.c, src/truetype/ttdriver.c: Add various casts,
initialize variables, and decorate functions with FT_CALLBACK_DEF,
etc., to fix compiler warnings (and C++ compiling errors).
* builds/unix/ftsystem.c, include/freetype/config/ftheader.h, * src/cache/ftcbasic.c: Fix `-Wmissing-prototypes' warnings with
include/freetype/internal/services/svotval.h, gcc.
include/freetype/internal/services/svpfr.h,
src/base/ftsystem.c, src/bdf/bdfdrivr.c, src/cache/ftcbasic.c,
src/cff/cffcmap.c, src/gzip/ftgzip.c, src/lzw/ftlzw.c,
src/lzw/ftlzw2.c, src/psaux/t1cmap.c, src/sfnt/ttbdf.c,
src/smooth/ftgrays.c:
solved -Wmissing-prototypes warnings with GCC * builds/unix/ftsystem.c: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_STREAM_H.
* src/base/ftsystem.c: Include FT_INTERNAL_STREAM_H.
* include/freetype/config/ftheader.h (FT_PFR_H): New macro.
* include/freetype/config/ftoption.h (FT_STRICT_ALIASING): Don't
define for C++.
* include/freetype/internal/services/svotval.h: Don't include
FT_OPENTYPE_VALIDATE_H but FT_INTERNAL_VALIDATE_H.
* include/freetype/internal/services/svpfr.h: Include FT_PFR_H.
* src/gzip/ftgzip.c: Include FT_GZIP_H.
* src/lzw/ftlzw.c, src/lzw/ftlzw2.c: Include FT_LZW_H.
* src/sfnt/ttbdf.c (tt_face_load_bdf_props): Rearrange code.
2006-02-24 Chia-I Wu <b90201047@ntu.edu.tw> 2006-02-24 Chia-I Wu <b90201047@ntu.edu.tw>

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Unix-specific FreeType low-level system interface (body). */ /* Unix-specific FreeType low-level system interface (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2004, 2005 by */ /* Copyright 1996-2001, 2002, 2004, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */

View File

@ -602,6 +602,7 @@
*/ */
#define FT_GX_VALIDATE_H <freetype/ftgxval.h> #define FT_GX_VALIDATE_H <freetype/ftgxval.h>
/************************************************************************* /*************************************************************************
* *
* @macro: * @macro:
@ -615,7 +616,6 @@
#define FT_PFR_H <freetype/ftpfr.h> #define FT_PFR_H <freetype/ftpfr.h>
/* */ /* */
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h> #define FT_TRIGONOMETRY_H <freetype/fttrigon.h>

View File

@ -587,8 +587,8 @@ FT_BEGIN_HEADER
* releases from emitting zillions of `strict aliasing' warning messages * releases from emitting zillions of `strict aliasing' warning messages
* each time a memory-management function is called. * each time a memory-management function is called.
* *
* note that it shouldn't be activated when compiling the library * Note that it shouldn't be activated when building the library with
* as C++ * a C++ compiler.
*/ */
#ifndef __cplusplus #ifndef __cplusplus
#define FT_STRICT_ALIASING #define FT_STRICT_ALIASING
@ -601,10 +601,9 @@ FT_BEGIN_HEADER
* a few obsolete functions to avoid linking problems on typical Unix * a few obsolete functions to avoid linking problems on typical Unix
* distributions. * distributions.
* *
* if you're on an embedded system, or if you're building a new * For embedded systems or building a new distribution from scratch, it
* distribution from scratch, it is recommended to disable the macro * is recommended to disable the macro since it reduces the library's code
* since it will reduce the library's code size and activate a few * size and activates a few memory-saving optimizations as well.
* memory-saving optimizations as well.
*/ */
#define FT_CONFIG_OPTION_OLD_INTERNALS #define FT_CONFIG_OPTION_OLD_INTERNALS

View File

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType OpenType validation service (specification). */ /* The FreeType OpenType validation service (specification). */
/* */ /* */
/* Copyright 2004 by */ /* Copyright 2004, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Internal PFR service functions (specification). */ /* Internal PFR service functions (specification). */
/* */ /* */
/* Copyright 2003 by */ /* Copyright 2003, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */

View File

@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */ /* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */ /* distributions. */
/* */ /* */
/* Copyright 2004, 2005 by */ /* Copyright 2004, 2005, 2006 by */
/* Albert Chin-A-Young. */ /* Albert Chin-A-Young. */
/* */ /* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */ /* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */

View File

@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */ /* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */ /* distributions. */
/* */ /* */
/* Copyright 2004, 2005 by */ /* Copyright 2004, 2005, 2006 by */
/* Albert Chin-A-Young. */ /* Albert Chin-A-Young. */
/* */ /* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */ /* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */

View File

@ -1,250 +1,250 @@
/***************************************************************************/ /***************************************************************************/
/* */ /* */
/* ttbdf.c */ /* ttbdf.c */
/* */ /* */
/* TrueType and OpenType embedded BDF properties (body). */ /* TrueType and OpenType embedded BDF properties (body). */
/* */ /* */
/* Copyright 2005 by */ /* Copyright 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
/* */ /* */
/***************************************************************************/ /***************************************************************************/
#include <ft2build.h> #include <ft2build.h>
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_TAGS_H
#include "ttbdf.h" #include "ttbdf.h"
#include "sferrors.h" #include "sferrors.h"
#ifdef TT_CONFIG_OPTION_BDF #ifdef TT_CONFIG_OPTION_BDF
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */ /* messages during execution. */
/* */ /* */
#undef FT_COMPONENT #undef FT_COMPONENT
#define FT_COMPONENT trace_ttbdf #define FT_COMPONENT trace_ttbdf
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
tt_face_free_bdf_props( TT_Face face ) tt_face_free_bdf_props( TT_Face face )
{ {
TT_BDF bdf = &face->bdf; TT_BDF bdf = &face->bdf;
if ( bdf->loaded ) if ( bdf->loaded )
{ {
FT_Stream stream = FT_FACE(face)->stream; FT_Stream stream = FT_FACE(face)->stream;
if ( bdf->table != NULL ) if ( bdf->table != NULL )
FT_FRAME_RELEASE( bdf->table ); FT_FRAME_RELEASE( bdf->table );
bdf->table_end = NULL; bdf->table_end = NULL;
bdf->strings = NULL; bdf->strings = NULL;
bdf->strings_size = 0; bdf->strings_size = 0;
} }
} }
static FT_Error static FT_Error
tt_face_load_bdf_props( TT_Face face, tt_face_load_bdf_props( TT_Face face,
FT_Stream stream ) FT_Stream stream )
{ {
TT_BDF bdf = &face->bdf; TT_BDF bdf = &face->bdf;
FT_ULong length; FT_ULong length;
FT_Error error; FT_Error error;
FT_ZERO( bdf ); FT_ZERO( bdf );
error = tt_face_goto_table( face, TTAG_BDF, stream, &length ); error = tt_face_goto_table( face, TTAG_BDF, stream, &length );
if ( error || if ( error ||
length < 8 || length < 8 ||
FT_FRAME_EXTRACT( length, bdf->table ) ) FT_FRAME_EXTRACT( length, bdf->table ) )
{ {
error = FT_Err_Invalid_Table; error = FT_Err_Invalid_Table;
goto Exit; goto Exit;
} }
bdf->table_end = bdf->table + length; bdf->table_end = bdf->table + length;
{ {
FT_Byte* p = bdf->table; FT_Byte* p = bdf->table;
FT_UInt version = FT_NEXT_USHORT( p ); FT_UInt version = FT_NEXT_USHORT( p );
FT_UInt num_strikes = FT_NEXT_USHORT( p ); FT_UInt num_strikes = FT_NEXT_USHORT( p );
FT_UInt32 strings = FT_NEXT_ULONG ( p ); FT_UInt32 strings = FT_NEXT_ULONG ( p );
FT_UInt count; FT_UInt count;
FT_Byte* strike; FT_Byte* strike;
if ( version != 0x0001 || if ( version != 0x0001 ||
strings < 8 || strings < 8 ||
( strings - 8 ) / 4 < num_strikes || ( strings - 8 ) / 4 < num_strikes ||
strings + 1 > length ) strings + 1 > length )
{ {
goto BadTable; goto BadTable;
} }
bdf->num_strikes = num_strikes; bdf->num_strikes = num_strikes;
bdf->strings = bdf->table + strings; bdf->strings = bdf->table + strings;
bdf->strings_size = length - strings; bdf->strings_size = length - strings;
count = bdf->num_strikes; count = bdf->num_strikes;
p = bdf->table + 8; p = bdf->table + 8;
strike = p + count * 4; strike = p + count * 4;
for ( ; count > 0; count-- ) for ( ; count > 0; count-- )
{ {
FT_UInt num_items = FT_PEEK_USHORT( p + 2 ); FT_UInt num_items = FT_PEEK_USHORT( p + 2 );
/* /*
* We don't need to check the value sets themselves, since this * We don't need to check the value sets themselves, since this
* is done later. * is done later.
*/ */
strike += 10 * num_items; strike += 10 * num_items;
p += 4; p += 4;
} }
if ( strike > bdf->strings ) if ( strike > bdf->strings )
goto BadTable; goto BadTable;
} }
bdf->loaded = 1; bdf->loaded = 1;
Exit: Exit:
return error; return error;
BadTable: BadTable:
FT_FRAME_RELEASE( bdf->table ); FT_FRAME_RELEASE( bdf->table );
FT_ZERO( bdf ); FT_ZERO( bdf );
error = FT_Err_Invalid_Table; error = FT_Err_Invalid_Table;
goto Exit; goto Exit;
} }
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
tt_face_find_bdf_prop( TT_Face face, tt_face_find_bdf_prop( TT_Face face,
const char* property_name, const char* property_name,
BDF_PropertyRec *aprop ) BDF_PropertyRec *aprop )
{ {
TT_BDF bdf = &face->bdf; TT_BDF bdf = &face->bdf;
FT_Size size = FT_FACE(face)->size; FT_Size size = FT_FACE(face)->size;
FT_Error error = 0; FT_Error error = 0;
FT_Byte* p; FT_Byte* p;
FT_UInt count; FT_UInt count;
FT_Byte* strike; FT_Byte* strike;
FT_UInt property_len; FT_UInt property_len;
aprop->type = BDF_PROPERTY_TYPE_NONE; aprop->type = BDF_PROPERTY_TYPE_NONE;
if ( bdf->loaded == 0 ) if ( bdf->loaded == 0 )
{ {
error = tt_face_load_bdf_props( face, FT_FACE( face )->stream ); error = tt_face_load_bdf_props( face, FT_FACE( face )->stream );
if ( error ) if ( error )
goto Exit; goto Exit;
} }
count = bdf->num_strikes; count = bdf->num_strikes;
p = bdf->table + 8; p = bdf->table + 8;
strike = p + 4 * count; strike = p + 4 * count;
error = FT_Err_Invalid_Argument; error = FT_Err_Invalid_Argument;
if ( size == NULL || property_name == NULL ) if ( size == NULL || property_name == NULL )
goto Exit; goto Exit;
property_len = ft_strlen( property_name ); property_len = ft_strlen( property_name );
if ( property_len == 0 ) if ( property_len == 0 )
goto Exit; goto Exit;
for ( ; count > 0; count-- ) for ( ; count > 0; count-- )
{ {
FT_UInt _ppem = FT_NEXT_USHORT( p ); FT_UInt _ppem = FT_NEXT_USHORT( p );
FT_UInt _count = FT_NEXT_USHORT( p ); FT_UInt _count = FT_NEXT_USHORT( p );
if ( _ppem == size->metrics.y_ppem ) if ( _ppem == size->metrics.y_ppem )
{ {
count = _count; count = _count;
goto FoundStrike; goto FoundStrike;
} }
strike += 10 * _count; strike += 10 * _count;
} }
goto Exit; goto Exit;
FoundStrike: FoundStrike:
p = strike; p = strike;
for ( ; count > 0; count-- ) for ( ; count > 0; count-- )
{ {
FT_UInt type = FT_PEEK_USHORT( p + 4 ); FT_UInt type = FT_PEEK_USHORT( p + 4 );
if ( ( type & 0x10 ) != 0 ) if ( ( type & 0x10 ) != 0 )
{ {
FT_UInt32 name_offset = FT_PEEK_ULONG( p ); FT_UInt32 name_offset = FT_PEEK_ULONG( p );
FT_UInt32 value = FT_PEEK_ULONG( p + 6 ); FT_UInt32 value = FT_PEEK_ULONG( p + 6 );
/* be a bit paranoid for invalid entries here */ /* be a bit paranoid for invalid entries here */
if ( name_offset < bdf->strings_size && if ( name_offset < bdf->strings_size &&
property_len < bdf->strings_size - name_offset && property_len < bdf->strings_size - name_offset &&
ft_strncmp( property_name, ft_strncmp( property_name,
(const char*)bdf->strings + name_offset, (const char*)bdf->strings + name_offset,
bdf->strings_size - name_offset ) == 0 ) bdf->strings_size - name_offset ) == 0 )
{ {
switch ( type & 0x0F ) switch ( type & 0x0F )
{ {
case 0x00: /* string */ case 0x00: /* string */
case 0x01: /* atoms */ case 0x01: /* atoms */
/* check that the content is really 0-terminated */ /* check that the content is really 0-terminated */
if ( value < bdf->strings_size && if ( value < bdf->strings_size &&
ft_memchr( bdf->strings + value, 0, bdf->strings_size ) ) ft_memchr( bdf->strings + value, 0, bdf->strings_size ) )
{ {
aprop->type = BDF_PROPERTY_TYPE_ATOM; aprop->type = BDF_PROPERTY_TYPE_ATOM;
aprop->u.atom = (const char*)bdf->strings + value; aprop->u.atom = (const char*)bdf->strings + value;
error = 0; error = 0;
goto Exit; goto Exit;
} }
break; break;
case 0x02: case 0x02:
aprop->type = BDF_PROPERTY_TYPE_INTEGER; aprop->type = BDF_PROPERTY_TYPE_INTEGER;
aprop->u.integer = (FT_Int32)value; aprop->u.integer = (FT_Int32)value;
error = 0; error = 0;
goto Exit; goto Exit;
case 0x03: case 0x03:
aprop->type = BDF_PROPERTY_TYPE_CARDINAL; aprop->type = BDF_PROPERTY_TYPE_CARDINAL;
aprop->u.cardinal = value; aprop->u.cardinal = value;
error = 0; error = 0;
goto Exit; goto Exit;
default: default:
; ;
} }
} }
} }
p += 10; p += 10;
} }
Exit: Exit:
return error; return error;
} }
#endif /* TT_CONFIG_OPTION_BDF */ #endif /* TT_CONFIG_OPTION_BDF */
/* END */ /* END */

View File

@ -4,7 +4,7 @@
/* */ /* */
/* A new `perfect' anti-aliasing renderer (body). */ /* A new `perfect' anti-aliasing renderer (body). */
/* */ /* */
/* Copyright 2000-2001, 2002, 2003, 2005 by */ /* Copyright 2000-2001, 2002, 2003, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */

View File

@ -10,7 +10,7 @@
* accepted if you are using GCC for compilation (and probably by * accepted if you are using GCC for compilation (and probably by
* other compilers too). * other compilers too).
* *
* Author: David Turner, 2005 * Author: David Turner, 2005, 2006
* *
* This code is explicitly placed into the public domain. * This code is explicitly placed into the public domain.
* *