summaryrefslogtreecommitdiffstats
path: root/src/psaux
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-18 22:20:25 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-18 22:20:25 -0700
commit0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6 (patch)
treebda73f0de3896a97ff4231e4600fccd89a3f9118 /src/psaux
parent049d6fea481044fcc000e7782e5bc7046fc70844 (diff)
downloadandroid_external_freetype-0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6.tar.gz
android_external_freetype-0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6.tar.bz2
android_external_freetype-0a9d06e2b5cf75c3d6ba958026bfdf4745f576d6.zip
auto import //branches/master/...@140412
Diffstat (limited to 'src/psaux')
-rw-r--r--src/psaux/afmparse.c9
-rw-r--r--src/psaux/psobjs.c46
-rw-r--r--src/psaux/t1decode.c17
3 files changed, 45 insertions, 27 deletions
diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c
index 0528fe6..63a786e 100644
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
/* */
/* AFM parser (body). */
/* */
-/* Copyright 2006, 2007 by */
+/* Copyright 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -672,7 +672,12 @@
FT_ULong index2 = KERN_INDEX( kp2->index1, kp2->index2 );
- return (int)( index1 - index2 );
+ if ( index1 > index2 )
+ return 1;
+ else if ( index1 < index2 )
+ return -1;
+ else
+ return 0;
}
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index b7b84ac..52e30a4 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -175,11 +175,17 @@
return PSaux_Err_Invalid_Argument;
}
+ if ( length < 0 )
+ {
+ FT_ERROR(( "ps_table_add: invalid length\n" ));
+ return PSaux_Err_Invalid_Argument;
+ }
+
/* grow the base block if needed */
if ( table->cursor + length > table->capacity )
{
FT_Error error;
- FT_Offset new_size = table->capacity;
+ FT_Offset new_size = table->capacity;
FT_Long in_offset;
@@ -376,7 +382,7 @@
/* skip octal escape or ignore backslash */
for ( i = 0; i < 3 && cur < limit; ++i )
{
- if ( ! IS_OCTAL_DIGIT( *cur ) )
+ if ( !IS_OCTAL_DIGIT( *cur ) )
break;
++cur;
@@ -1259,8 +1265,9 @@
old_cursor = parser->cursor;
old_limit = parser->limit;
- /* we store the elements count if necessary */
- if ( field->type != T1_FIELD_TYPE_BBOX )
+ /* we store the elements count if necessary; */
+ /* we further assume that `count_offset' can't be zero */
+ if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
*(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
(FT_Byte)num_elements;
@@ -1634,27 +1641,24 @@
t1_builder_close_contour( T1_Builder builder )
{
FT_Outline* outline = builder->current;
+ FT_Int first;
if ( !outline )
return;
- /* XXXX: We must not include the last point in the path if it */
- /* is located on the first point. */
+ first = outline->n_contours <= 1
+ ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+ /* We must not include the last point in the path if it */
+ /* is located on the first point. */
if ( outline->n_points > 1 )
{
- FT_Int first = 0;
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
- if ( outline->n_contours > 1 )
- {
- first = outline->contours[outline->n_contours - 2] + 1;
- p1 = outline->points + first;
- }
-
/* `delete' last point only if it coincides with the first */
/* point and it is not a control point (which can happen). */
if ( p1->x == p2->x && p1->y == p2->y )
@@ -1663,8 +1667,18 @@
}
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ {
+ /* Don't add contours only consisting of one point, i.e., */
+ /* check whether begin point and last point are the same. */
+ if ( first == outline->n_points - 1 )
+ {
+ outline->n_contours--;
+ outline->n_points--;
+ }
+ else
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+ }
}
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 550ba64..bda2324 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -354,10 +354,9 @@
( decoder->buildchar == NULL ) );
if ( decoder->len_buildchar > 0 )
- memset( &decoder->buildchar[0],
- 0,
- sizeof( decoder->buildchar[0] ) *
- decoder->len_buildchar );
+ ft_memset( &decoder->buildchar[0],
+ 0,
+ sizeof( decoder->buildchar[0] ) * decoder->len_buildchar );
FT_TRACE4(( "\nStart charstring\n" ));
@@ -777,10 +776,10 @@
idx + blend->num_designs > decoder->face->len_buildchar )
goto Unexpected_OtherSubr;
- memcpy( &decoder->buildchar[idx],
- blend->weight_vector,
- blend->num_designs *
- sizeof( blend->weight_vector[ 0 ] ) );
+ ft_memcpy( &decoder->buildchar[idx],
+ blend->weight_vector,
+ blend->num_designs *
+ sizeof( blend->weight_vector[0] ) );
}
break;