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>
* include/freetype/config/ftoption.h, src/autofit/afcjk.c,
src/base/ftobjs.c, src/base/ftutil.c, src/cff/cffobjs.c,
src/psaux/afmparse.c, src/sfnt/ttbdf.c, src/tools/apinames.c,
src/truetype/ttdriver.c:
Fix compiler warnings as well as C++ compilation problems.
Add missing prototypes.
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,
include/freetype/internal/services/svotval.h,
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:
* src/cache/ftcbasic.c: Fix `-Wmissing-prototypes' warnings with
gcc.
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>

View File

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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>
/*************************************************************************
*
* @macro:
@ -615,7 +616,6 @@
#define FT_PFR_H <freetype/ftpfr.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
* each time a memory-management function is called.
*
* note that it shouldn't be activated when compiling the library
* as C++
* Note that it shouldn't be activated when building the library with
* a C++ compiler.
*/
#ifndef __cplusplus
#define FT_STRICT_ALIASING
@ -601,10 +601,9 @@ FT_BEGIN_HEADER
* a few obsolete functions to avoid linking problems on typical Unix
* distributions.
*
* if you're on an embedded system, or if you're building a new
* distribution from scratch, it is recommended to disable the macro
* since it will reduce the library's code size and activate a few
* memory-saving optimizations as well.
* For embedded systems or building a new distribution from scratch, it
* is recommended to disable the macro since it reduces the library's code
* size and activates a few memory-saving optimizations as well.
*/
#define FT_CONFIG_OPTION_OLD_INTERNALS

View File

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

View File

@ -4,7 +4,7 @@
/* */
/* Internal PFR service functions (specification). */
/* */
/* Copyright 2003 by */
/* Copyright 2003, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* 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 */
/* distributions. */
/* */
/* Copyright 2004, 2005 by */
/* Copyright 2004, 2005, 2006 by */
/* Albert Chin-A-Young. */
/* */
/* 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 */
/* distributions. */
/* */
/* Copyright 2004, 2005 by */
/* Copyright 2004, 2005, 2006 by */
/* Albert Chin-A-Young. */
/* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */

View File

@ -1,250 +1,250 @@
/***************************************************************************/
/* */
/* ttbdf.c */
/* */
/* TrueType and OpenType embedded BDF properties (body). */
/* */
/* Copyright 2005 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_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H
#include "ttbdf.h"
#include "sferrors.h"
#ifdef TT_CONFIG_OPTION_BDF
/*************************************************************************/
/* */
/* 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 */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_ttbdf
FT_LOCAL_DEF( void )
tt_face_free_bdf_props( TT_Face face )
{
TT_BDF bdf = &face->bdf;
if ( bdf->loaded )
{
FT_Stream stream = FT_FACE(face)->stream;
if ( bdf->table != NULL )
FT_FRAME_RELEASE( bdf->table );
bdf->table_end = NULL;
bdf->strings = NULL;
bdf->strings_size = 0;
}
}
static FT_Error
tt_face_load_bdf_props( TT_Face face,
FT_Stream stream )
{
TT_BDF bdf = &face->bdf;
FT_ULong length;
FT_Error error;
FT_ZERO( bdf );
error = tt_face_goto_table( face, TTAG_BDF, stream, &length );
if ( error ||
length < 8 ||
FT_FRAME_EXTRACT( length, bdf->table ) )
{
error = FT_Err_Invalid_Table;
goto Exit;
}
bdf->table_end = bdf->table + length;
{
FT_Byte* p = bdf->table;
FT_UInt version = FT_NEXT_USHORT( p );
FT_UInt num_strikes = FT_NEXT_USHORT( p );
FT_UInt32 strings = FT_NEXT_ULONG ( p );
FT_UInt count;
FT_Byte* strike;
if ( version != 0x0001 ||
strings < 8 ||
( strings - 8 ) / 4 < num_strikes ||
strings + 1 > length )
{
goto BadTable;
}
bdf->num_strikes = num_strikes;
bdf->strings = bdf->table + strings;
bdf->strings_size = length - strings;
count = bdf->num_strikes;
p = bdf->table + 8;
strike = p + count * 4;
for ( ; count > 0; count-- )
{
FT_UInt num_items = FT_PEEK_USHORT( p + 2 );
/*
* We don't need to check the value sets themselves, since this
* is done later.
*/
strike += 10 * num_items;
p += 4;
}
if ( strike > bdf->strings )
goto BadTable;
}
bdf->loaded = 1;
Exit:
return error;
BadTable:
FT_FRAME_RELEASE( bdf->table );
FT_ZERO( bdf );
error = FT_Err_Invalid_Table;
goto Exit;
}
FT_LOCAL_DEF( FT_Error )
tt_face_find_bdf_prop( TT_Face face,
const char* property_name,
BDF_PropertyRec *aprop )
{
TT_BDF bdf = &face->bdf;
FT_Size size = FT_FACE(face)->size;
FT_Error error = 0;
FT_Byte* p;
FT_UInt count;
FT_Byte* strike;
FT_UInt property_len;
aprop->type = BDF_PROPERTY_TYPE_NONE;
if ( bdf->loaded == 0 )
{
error = tt_face_load_bdf_props( face, FT_FACE( face )->stream );
if ( error )
goto Exit;
}
count = bdf->num_strikes;
p = bdf->table + 8;
strike = p + 4 * count;
error = FT_Err_Invalid_Argument;
if ( size == NULL || property_name == NULL )
goto Exit;
property_len = ft_strlen( property_name );
if ( property_len == 0 )
goto Exit;
for ( ; count > 0; count-- )
{
FT_UInt _ppem = FT_NEXT_USHORT( p );
FT_UInt _count = FT_NEXT_USHORT( p );
if ( _ppem == size->metrics.y_ppem )
{
count = _count;
goto FoundStrike;
}
strike += 10 * _count;
}
goto Exit;
FoundStrike:
p = strike;
for ( ; count > 0; count-- )
{
FT_UInt type = FT_PEEK_USHORT( p + 4 );
if ( ( type & 0x10 ) != 0 )
{
FT_UInt32 name_offset = FT_PEEK_ULONG( p );
FT_UInt32 value = FT_PEEK_ULONG( p + 6 );
/* be a bit paranoid for invalid entries here */
if ( name_offset < bdf->strings_size &&
property_len < bdf->strings_size - name_offset &&
ft_strncmp( property_name,
(const char*)bdf->strings + name_offset,
bdf->strings_size - name_offset ) == 0 )
{
switch ( type & 0x0F )
{
case 0x00: /* string */
case 0x01: /* atoms */
/* check that the content is really 0-terminated */
if ( value < bdf->strings_size &&
ft_memchr( bdf->strings + value, 0, bdf->strings_size ) )
{
aprop->type = BDF_PROPERTY_TYPE_ATOM;
aprop->u.atom = (const char*)bdf->strings + value;
error = 0;
goto Exit;
}
break;
case 0x02:
aprop->type = BDF_PROPERTY_TYPE_INTEGER;
aprop->u.integer = (FT_Int32)value;
error = 0;
goto Exit;
case 0x03:
aprop->type = BDF_PROPERTY_TYPE_CARDINAL;
aprop->u.cardinal = value;
error = 0;
goto Exit;
default:
;
}
}
}
p += 10;
}
Exit:
return error;
}
#endif /* TT_CONFIG_OPTION_BDF */
/* END */
/***************************************************************************/
/* */
/* ttbdf.c */
/* */
/* TrueType and OpenType embedded BDF properties (body). */
/* */
/* Copyright 2005, 2006 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_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_TRUETYPE_TAGS_H
#include "ttbdf.h"
#include "sferrors.h"
#ifdef TT_CONFIG_OPTION_BDF
/*************************************************************************/
/* */
/* 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 */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_ttbdf
FT_LOCAL_DEF( void )
tt_face_free_bdf_props( TT_Face face )
{
TT_BDF bdf = &face->bdf;
if ( bdf->loaded )
{
FT_Stream stream = FT_FACE(face)->stream;
if ( bdf->table != NULL )
FT_FRAME_RELEASE( bdf->table );
bdf->table_end = NULL;
bdf->strings = NULL;
bdf->strings_size = 0;
}
}
static FT_Error
tt_face_load_bdf_props( TT_Face face,
FT_Stream stream )
{
TT_BDF bdf = &face->bdf;
FT_ULong length;
FT_Error error;
FT_ZERO( bdf );
error = tt_face_goto_table( face, TTAG_BDF, stream, &length );
if ( error ||
length < 8 ||
FT_FRAME_EXTRACT( length, bdf->table ) )
{
error = FT_Err_Invalid_Table;
goto Exit;
}
bdf->table_end = bdf->table + length;
{
FT_Byte* p = bdf->table;
FT_UInt version = FT_NEXT_USHORT( p );
FT_UInt num_strikes = FT_NEXT_USHORT( p );
FT_UInt32 strings = FT_NEXT_ULONG ( p );
FT_UInt count;
FT_Byte* strike;
if ( version != 0x0001 ||
strings < 8 ||
( strings - 8 ) / 4 < num_strikes ||
strings + 1 > length )
{
goto BadTable;
}
bdf->num_strikes = num_strikes;
bdf->strings = bdf->table + strings;
bdf->strings_size = length - strings;
count = bdf->num_strikes;
p = bdf->table + 8;
strike = p + count * 4;
for ( ; count > 0; count-- )
{
FT_UInt num_items = FT_PEEK_USHORT( p + 2 );
/*
* We don't need to check the value sets themselves, since this
* is done later.
*/
strike += 10 * num_items;
p += 4;
}
if ( strike > bdf->strings )
goto BadTable;
}
bdf->loaded = 1;
Exit:
return error;
BadTable:
FT_FRAME_RELEASE( bdf->table );
FT_ZERO( bdf );
error = FT_Err_Invalid_Table;
goto Exit;
}
FT_LOCAL_DEF( FT_Error )
tt_face_find_bdf_prop( TT_Face face,
const char* property_name,
BDF_PropertyRec *aprop )
{
TT_BDF bdf = &face->bdf;
FT_Size size = FT_FACE(face)->size;
FT_Error error = 0;
FT_Byte* p;
FT_UInt count;
FT_Byte* strike;
FT_UInt property_len;
aprop->type = BDF_PROPERTY_TYPE_NONE;
if ( bdf->loaded == 0 )
{
error = tt_face_load_bdf_props( face, FT_FACE( face )->stream );
if ( error )
goto Exit;
}
count = bdf->num_strikes;
p = bdf->table + 8;
strike = p + 4 * count;
error = FT_Err_Invalid_Argument;
if ( size == NULL || property_name == NULL )
goto Exit;
property_len = ft_strlen( property_name );
if ( property_len == 0 )
goto Exit;
for ( ; count > 0; count-- )
{
FT_UInt _ppem = FT_NEXT_USHORT( p );
FT_UInt _count = FT_NEXT_USHORT( p );
if ( _ppem == size->metrics.y_ppem )
{
count = _count;
goto FoundStrike;
}
strike += 10 * _count;
}
goto Exit;
FoundStrike:
p = strike;
for ( ; count > 0; count-- )
{
FT_UInt type = FT_PEEK_USHORT( p + 4 );
if ( ( type & 0x10 ) != 0 )
{
FT_UInt32 name_offset = FT_PEEK_ULONG( p );
FT_UInt32 value = FT_PEEK_ULONG( p + 6 );
/* be a bit paranoid for invalid entries here */
if ( name_offset < bdf->strings_size &&
property_len < bdf->strings_size - name_offset &&
ft_strncmp( property_name,
(const char*)bdf->strings + name_offset,
bdf->strings_size - name_offset ) == 0 )
{
switch ( type & 0x0F )
{
case 0x00: /* string */
case 0x01: /* atoms */
/* check that the content is really 0-terminated */
if ( value < bdf->strings_size &&
ft_memchr( bdf->strings + value, 0, bdf->strings_size ) )
{
aprop->type = BDF_PROPERTY_TYPE_ATOM;
aprop->u.atom = (const char*)bdf->strings + value;
error = 0;
goto Exit;
}
break;
case 0x02:
aprop->type = BDF_PROPERTY_TYPE_INTEGER;
aprop->u.integer = (FT_Int32)value;
error = 0;
goto Exit;
case 0x03:
aprop->type = BDF_PROPERTY_TYPE_CARDINAL;
aprop->u.cardinal = value;
error = 0;
goto Exit;
default:
;
}
}
}
p += 10;
}
Exit:
return error;
}
#endif /* TT_CONFIG_OPTION_BDF */
/* END */

View File

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* 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
* other compilers too).
*
* Author: David Turner, 2005
* Author: David Turner, 2005, 2006
*
* This code is explicitly placed into the public domain.
*