Formatting, copyright years, s/memcpy/ft_memcpy/.
This commit is contained in:
parent
2ef3e0f1cd
commit
442bfb8913
38
ChangeLog
38
ChangeLog
@ -1,21 +1,32 @@
|
||||
2007-02-12 David Turner <david@freetype.org>
|
||||
|
||||
* src/autofit/afloader.c: improve spacing adjustments for the
|
||||
non-light auto-hinted modes. Gets rid of "inter-letter spacing
|
||||
is too wide"
|
||||
* src/truetype/ttinterp.h, src/truetype/ttinterp.c: Simplify
|
||||
projection and dual-projection code interface.
|
||||
|
||||
* src/truetype/ttinterp.h, src/truetype/ttinterp.c: simplify
|
||||
projection and dual-projection code interface
|
||||
* src/autofit/afloader.c: Improve spacing adjustments for the
|
||||
non-light auto-hinted modes. Gets rid of `inter-letter spacing is
|
||||
too wide' problems.
|
||||
|
||||
* include/freetype/internal/ftmemory.h, src/base/ftutils.c,
|
||||
src/bfd/bfddrivr.c, src/bdf/bdflib.c, src/pcf/pcfread.c,
|
||||
src/cff/cffdrivr.c, src/cff/cffload.c, src/cff/cffobjs.c,
|
||||
src/sfnt/sfdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
|
||||
introduce ft_mem_strdup, ft_mem_dup, ft_mem_strcpyn and the
|
||||
corresponding macros, and modify code to use them. This is to
|
||||
get rid of various uses of strcpy and other "evil" functions,
|
||||
as well as simplify a few things
|
||||
|
||||
Introduce new string functions and the corresponding macros to get
|
||||
rid of various uses of strcpy and other `evil' functions, as well as
|
||||
to simplify a few things.
|
||||
|
||||
* include/freetype/internal/ftmemory.h (ft_mem_strdup, ft_mem_dup,
|
||||
ft_mem_strcpyn): New declarations.
|
||||
(FT_MEM_STRDUP, FT_STRDUP, FT_MEM_DUP, FT_DUP, FT_STRCPYN): New
|
||||
macros.
|
||||
* src/base/ftutil.c (ft_mem_dup, ft_mem_strdup, ft_mem_strcpyn): New
|
||||
functions.
|
||||
|
||||
* src/bfd/bfddrivr.c (bdf_interpret_style, BDF_Face_Init),
|
||||
src/bdf/bdflib.c (_bdf_add_property), src/pcf/pcfread.c
|
||||
(pcf_get_properties, pcf_interpret_style, pcf_load_font),
|
||||
src/cff/cffdrivr.c (cff_get_glyph_name), src/cff/cffload.c
|
||||
(cff_index_get_sid_string), src/cff/cffobjs.c (cff_strcpy),
|
||||
src/sfnt/sfdriver.c (sfnt_get_glyph_name), src/type1/t1driver.c
|
||||
(t1_get_glyph_name), src/type42/t42drivr.c (t42_get_glyph_name,
|
||||
t42_get_name_index): Use new functions and simplify code.
|
||||
|
||||
2007-02-11 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
@ -85,7 +96,6 @@
|
||||
(gxv_mort_subtable_type1_substTable_validate): Fix debugging
|
||||
message.
|
||||
|
||||
>>>>>>> 1.1514
|
||||
2007-01-31 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
|
||||
|
@ -333,26 +333,29 @@ FT_BEGIN_HEADER
|
||||
FT_ULong size,
|
||||
FT_Error *p_error );
|
||||
|
||||
#define FT_MEM_STRDUP(dst,str) \
|
||||
(dst) = ft_mem_strdup( memory, (const char*)(str), &error )
|
||||
#define FT_MEM_STRDUP( dst, str ) \
|
||||
(dst) = ft_mem_strdup( memory, (const char*)(str), &error )
|
||||
|
||||
#define FT_STRDUP(dst,str) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_STRDUP(dst,str) )
|
||||
#define FT_STRDUP( dst, str ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
|
||||
|
||||
#define FT_MEM_DUP(dst, address,size) \
|
||||
(dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
|
||||
#define FT_MEM_DUP( dst, address, size ) \
|
||||
(dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
|
||||
|
||||
#define FT_DUP(dst,address,size) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_DUP(dst,address,size) )
|
||||
#define FT_DUP( dst, address, size ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )
|
||||
|
||||
/* returns 1 or more if a trunction occured, 0 if the source string fitted the buffer */
|
||||
/* this is *not* the same than the normal strlcpy() call */
|
||||
|
||||
/* Return >= 1 if a truncation occurs. */
|
||||
/* Return 0 if the source string fits the buffer. */
|
||||
/* This is *not* the same as strlcpy(). */
|
||||
FT_BASE( FT_Int )
|
||||
ft_mem_strcpyn( char* dst,
|
||||
const char* src,
|
||||
FT_ULong size );
|
||||
|
||||
#define FT_STRCPYN(dst,src,size) ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
|
||||
#define FT_STRCPYN( dst, src, size ) \
|
||||
ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
|
||||
|
||||
/* */
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* FreeType utility file for memory and list management (body). */
|
||||
/* */
|
||||
/* Copyright 2002, 2004, 2005, 2006 by */
|
||||
/* Copyright 2002, 2004, 2005, 2006, 2007 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -181,7 +181,8 @@
|
||||
FT_Error error;
|
||||
FT_Pointer p = ft_mem_qalloc( memory, size, &error );
|
||||
|
||||
if (!error && address)
|
||||
|
||||
if ( !error && address )
|
||||
ft_memcpy( p, address, size );
|
||||
|
||||
*p_error = error;
|
||||
@ -194,7 +195,9 @@
|
||||
const char* str,
|
||||
FT_Error *p_error )
|
||||
{
|
||||
FT_ULong len = str ? (FT_ULong)ft_strlen(str)+1 : 0;
|
||||
FT_ULong len = str ? (FT_ULong)ft_strlen( str ) + 1
|
||||
: 0;
|
||||
|
||||
|
||||
return ft_mem_dup( memory, str, len, p_error );
|
||||
}
|
||||
@ -210,7 +213,7 @@
|
||||
|
||||
*dst = 0; /* always zero-terminate */
|
||||
|
||||
return (*src != 0);
|
||||
return *src != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
FreeType font driver for bdf files
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by
|
||||
Francesco Zappa Nardelli
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -198,6 +198,7 @@ THE SOFTWARE.
|
||||
char* strings[4] = { NULL, NULL, NULL, NULL };
|
||||
int lengths[4];
|
||||
|
||||
|
||||
face->style_flags = 0;
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"SLANT" );
|
||||
@ -225,35 +226,31 @@ THE SOFTWARE.
|
||||
if ( prop && prop->format == BDF_ATOM &&
|
||||
prop->value.atom && *(prop->value.atom) &&
|
||||
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
|
||||
{
|
||||
strings[3] = (char *)(prop->value.atom);
|
||||
}
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"ADD_STYLE_NAME" );
|
||||
if ( prop && prop->format == BDF_ATOM &&
|
||||
prop->value.atom && *(prop->value.atom) &&
|
||||
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
|
||||
{
|
||||
strings[0] = (char *)(prop->value.atom);
|
||||
}
|
||||
|
||||
len = 0;
|
||||
len = 0;
|
||||
|
||||
for (len = 0, nn = 0; nn < 4; nn++)
|
||||
for ( len = 0, nn = 0; nn < 4; nn++ )
|
||||
{
|
||||
lengths[nn] = 0;
|
||||
if (strings[nn])
|
||||
if ( strings[nn] )
|
||||
{
|
||||
lengths[nn] = ft_strlen(strings[nn]);
|
||||
len += lengths[nn]+1;
|
||||
lengths[nn] = ft_strlen( strings[nn] );
|
||||
len += lengths[nn] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( len == 0 )
|
||||
{
|
||||
strings[0] = "Regular";
|
||||
lengths[0] = ft_strlen(strings[0]);
|
||||
len = lengths[0]+1;
|
||||
lengths[0] = ft_strlen( strings[0] );
|
||||
len = lengths[0] + 1;
|
||||
}
|
||||
|
||||
{
|
||||
@ -265,27 +262,30 @@ THE SOFTWARE.
|
||||
|
||||
s = face->style_name;
|
||||
|
||||
for (nn = 0; nn < 4; nn++)
|
||||
for ( nn = 0; nn < 4; nn++ )
|
||||
{
|
||||
char* src = strings[nn];
|
||||
int len = lengths[nn];
|
||||
|
||||
|
||||
if ( src == NULL )
|
||||
continue;
|
||||
|
||||
/* separate elements with a space */
|
||||
if (s != face->style_name)
|
||||
if ( s != face->style_name )
|
||||
*s++ = ' ';
|
||||
|
||||
memcpy( s, src, len );
|
||||
ft_memcpy( s, src, len );
|
||||
|
||||
/* need to convert spaces to dashes for add_style_name and setwidth_name */
|
||||
if (nn == 0 || nn == 3)
|
||||
/* need to convert spaces to dashes for */
|
||||
/* add_style_name and setwidth_name */
|
||||
if ( nn == 0 || nn == 3 )
|
||||
{
|
||||
int mm;
|
||||
|
||||
for (mm = 0; mm < len; mm++)
|
||||
if (s[mm] == ' ')
|
||||
|
||||
for ( mm = 0; mm < len; mm++ )
|
||||
if ( s[mm] == ' ' )
|
||||
s[mm] = '-';
|
||||
}
|
||||
|
||||
@ -495,12 +495,14 @@ THE SOFTWARE.
|
||||
const char* s;
|
||||
|
||||
|
||||
if ( FT_STRDUP( face->charset_encoding, charset_encoding->value.atom ) ||
|
||||
FT_STRDUP( face->charset_registry, charset_registry->value.atom ) )
|
||||
if ( FT_STRDUP( face->charset_encoding,
|
||||
charset_encoding->value.atom ) ||
|
||||
FT_STRDUP( face->charset_registry,
|
||||
charset_registry->value.atom ) )
|
||||
goto Exit;
|
||||
|
||||
/* Uh, oh, compare first letters manually to avoid dependency
|
||||
on locales. */
|
||||
/* Uh, oh, compare first letters manually to avoid dependency */
|
||||
/* on locales. */
|
||||
s = face->charset_registry;
|
||||
if ( ( s[0] == 'i' || s[0] == 'I' ) &&
|
||||
( s[1] == 's' || s[1] == 'S' ) &&
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2000 Computing Research Labs, New Mexico State University
|
||||
* Copyright 2001, 2002, 2003, 2004, 2005, 2006 Francesco Zappa Nardelli
|
||||
* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
* Francesco Zappa Nardelli
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
@ -287,7 +287,8 @@
|
||||
FT_Error error;
|
||||
FT_String* result;
|
||||
|
||||
result = ft_mem_strdup(memory, source, &error);
|
||||
|
||||
result = ft_mem_strdup( memory, source, &error );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1002,9 +1002,9 @@ THE SOFTWARE.
|
||||
*(prop->value.atom) == 'I' || *(prop->value.atom) == 'i' ) )
|
||||
{
|
||||
face->style_flags |= FT_STYLE_FLAG_ITALIC;
|
||||
strings[2] = ( *(prop->value.atom) == 'O' || *(prop->value.atom) == 'o' )
|
||||
? (char *)"Oblique"
|
||||
: (char *)"Italic";
|
||||
strings[2] = ( *(prop->value.atom) == 'O' ||
|
||||
*(prop->value.atom) == 'o' ) ? (char *)"Oblique"
|
||||
: (char *)"Italic";
|
||||
}
|
||||
|
||||
prop = pcf_find_property( pcf, "WEIGHT_NAME" );
|
||||
@ -1019,33 +1019,29 @@ THE SOFTWARE.
|
||||
if ( prop && prop->isString &&
|
||||
*(prop->value.atom) &&
|
||||
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
|
||||
{
|
||||
strings[3] = (char *)(prop->value.atom);
|
||||
}
|
||||
|
||||
prop = pcf_find_property( pcf, "ADD_STYLE_NAME" );
|
||||
if ( prop && prop->isString &&
|
||||
*(prop->value.atom) &&
|
||||
!( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) )
|
||||
{
|
||||
strings[0] = (char *)(prop->value.atom);
|
||||
}
|
||||
|
||||
for (len = 0, nn = 0; nn < 4; nn++)
|
||||
for ( len = 0, nn = 0; nn < 4; nn++ )
|
||||
{
|
||||
lengths[nn] = 0;
|
||||
if (strings[nn])
|
||||
if ( strings[nn] )
|
||||
{
|
||||
lengths[nn] = ft_strlen(strings[nn]);
|
||||
len += lengths[nn]+1;
|
||||
lengths[nn] = ft_strlen( strings[nn] );
|
||||
len += lengths[nn] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( len == 0 )
|
||||
{
|
||||
strings[0] = "Regular";
|
||||
lengths[0] = ft_strlen(strings[0]);
|
||||
len = lengths[0]+1;
|
||||
lengths[0] = ft_strlen( strings[0] );
|
||||
len = lengths[0] + 1;
|
||||
}
|
||||
|
||||
{
|
||||
@ -1057,26 +1053,29 @@ THE SOFTWARE.
|
||||
|
||||
s = face->style_name;
|
||||
|
||||
for (nn = 0; nn < 4; nn++)
|
||||
for ( nn = 0; nn < 4; nn++ )
|
||||
{
|
||||
char* src = strings[nn];
|
||||
int len = lengths[nn];
|
||||
|
||||
|
||||
if ( src == NULL )
|
||||
continue;
|
||||
|
||||
/* separate elements with a space */
|
||||
if (s != face->style_name)
|
||||
if ( s != face->style_name )
|
||||
*s++ = ' ';
|
||||
|
||||
memcpy( s, src, len );
|
||||
ft_memcpy( s, src, len );
|
||||
|
||||
/* need to convert spaces to dashes for add_style_name and setwidth_name */
|
||||
if (nn == 0 || nn == 3)
|
||||
/* need to convert spaces to dashes for */
|
||||
/* add_style_name and setwidth_name */
|
||||
if ( nn == 0 || nn == 3 )
|
||||
{
|
||||
int mm;
|
||||
|
||||
for (mm = 0; mm < len; mm++)
|
||||
|
||||
for ( mm = 0; mm < len; mm++ )
|
||||
if (s[mm] == ' ')
|
||||
s[mm] = '-';
|
||||
}
|
||||
@ -1243,8 +1242,10 @@ THE SOFTWARE.
|
||||
if ( charset_registry && charset_registry->isString &&
|
||||
charset_encoding && charset_encoding->isString )
|
||||
{
|
||||
if ( FT_STRDUP( face->charset_encoding, charset_encoding->value.atom ) ||
|
||||
FT_STRDUP( face->charset_registry, charset_registry->value.atom ) )
|
||||
if ( FT_STRDUP( face->charset_encoding,
|
||||
charset_encoding->value.atom ) ||
|
||||
FT_STRDUP( face->charset_registry,
|
||||
charset_registry->value.atom ) )
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* High-level SFNT driver interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* Type 1 driver interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2006 by */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -60,6 +60,7 @@
|
||||
FT_UInt buffer_max )
|
||||
{
|
||||
FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );
|
||||
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* High-level Type 42 driver interface (body). */
|
||||
/* */
|
||||
/* Copyright 2002, 2003, 2004, 2006 by Roberto Alameda. */
|
||||
/* Copyright 2002, 2003, 2004, 2006, 2007 by Roberto Alameda. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
@ -62,6 +62,7 @@
|
||||
FT_UInt buffer_max )
|
||||
{
|
||||
FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max );
|
||||
|
||||
return T42_Err_Ok;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user