Index: third_party/freetype/src/type1/t1driver.c |
diff --git a/third_party/freetype/src/type1/t1driver.c b/third_party/freetype/src/type1/t1driver.c |
index 2602bdb6ffca4f22e9ca6b5f3e60c59414ebed98..571f2d2f8cde69efa8cc6f0d64f469befd1ae17d 100644 |
--- a/third_party/freetype/src/type1/t1driver.c |
+++ b/third_party/freetype/src/type1/t1driver.c |
@@ -4,7 +4,7 @@ |
/* */ |
/* Type 1 driver interface (body). */ |
/* */ |
-/* Copyright 1996-2004, 2006, 2007, 2009, 2011, 2013, 2014 by */ |
+/* Copyright 1996-2015 by */ |
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
/* */ |
/* This file is part of the FreeType project, and may only be used, */ |
@@ -32,7 +32,7 @@ |
#include FT_SERVICE_MULTIPLE_MASTERS_H |
#include FT_SERVICE_GLYPH_DICT_H |
-#include FT_SERVICE_XFREE86_NAME_H |
+#include FT_SERVICE_FONT_FORMAT_H |
#include FT_SERVICE_POSTSCRIPT_NAME_H |
#include FT_SERVICE_POSTSCRIPT_CMAPS_H |
#include FT_SERVICE_POSTSCRIPT_INFO_H |
@@ -176,9 +176,11 @@ |
PS_Dict_Keys key, |
FT_UInt idx, |
void *value, |
- FT_Long value_len ) |
+ FT_Long value_len_ ) |
{ |
- FT_Long retval = -1; |
+ FT_ULong retval = 0; /* always >= 1 if valid */ |
+ FT_ULong value_len = value_len_ < 0 ? 0 : (FT_ULong)value_len_; |
+ |
T1_Face t1face = (T1_Face)face; |
T1_Font type1 = &t1face->type1; |
@@ -225,7 +227,7 @@ |
if ( idx < sizeof ( type1->font_bbox ) / |
sizeof ( type1->font_bbox.xMin ) ) |
{ |
- FT_Fixed val = 0; |
+ FT_Fixed val = 0; |
retval = sizeof ( val ); |
@@ -258,7 +260,7 @@ |
break; |
case PS_DICT_FONT_NAME: |
- retval = (FT_Long)( ft_strlen( type1->font_name ) + 1 ); |
+ retval = ft_strlen( type1->font_name ) + 1; |
if ( value && value_len >= retval ) |
ft_memcpy( value, (void *)( type1->font_name ), retval ); |
break; |
@@ -278,7 +280,7 @@ |
case PS_DICT_CHAR_STRING_KEY: |
if ( idx < (FT_UInt)type1->num_glyphs ) |
{ |
- retval = (FT_Long)( ft_strlen( type1->glyph_names[idx] ) + 1 ); |
+ retval = ft_strlen( type1->glyph_names[idx] ) + 1; |
if ( value && value_len >= retval ) |
{ |
ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval ); |
@@ -290,7 +292,7 @@ |
case PS_DICT_CHAR_STRING: |
if ( idx < (FT_UInt)type1->num_glyphs ) |
{ |
- retval = (FT_Long)( type1->charstrings_len[idx] + 1 ); |
+ retval = type1->charstrings_len[idx] + 1; |
if ( value && value_len >= retval ) |
{ |
ft_memcpy( value, (void *)( type1->charstrings[idx] ), |
@@ -310,7 +312,7 @@ |
if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY && |
idx < (FT_UInt)type1->encoding.num_chars ) |
{ |
- retval = (FT_Long)( ft_strlen( type1->encoding.char_name[idx] ) + 1 ); |
+ retval = ft_strlen( type1->encoding.char_name[idx] ) + 1; |
if ( value && value_len >= retval ) |
{ |
ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ), |
@@ -329,7 +331,7 @@ |
case PS_DICT_SUBR: |
if ( idx < (FT_UInt)type1->num_subrs ) |
{ |
- retval = (FT_Long)( type1->subrs_len[idx] + 1 ); |
+ retval = type1->subrs_len[idx] + 1; |
if ( value && value_len >= retval ) |
{ |
ft_memcpy( value, (void *)( type1->subrs[idx] ), retval - 1 ); |
@@ -523,31 +525,31 @@ |
break; |
case PS_DICT_VERSION: |
- retval = (FT_Long)( ft_strlen( type1->font_info.version ) + 1 ); |
+ retval = ft_strlen( type1->font_info.version ) + 1; |
if ( value && value_len >= retval ) |
ft_memcpy( value, (void *)( type1->font_info.version ), retval ); |
break; |
case PS_DICT_NOTICE: |
- retval = (FT_Long)( ft_strlen( type1->font_info.notice ) + 1 ); |
+ retval = ft_strlen( type1->font_info.notice ) + 1; |
if ( value && value_len >= retval ) |
ft_memcpy( value, (void *)( type1->font_info.notice ), retval ); |
break; |
case PS_DICT_FULL_NAME: |
- retval = (FT_Long)( ft_strlen( type1->font_info.full_name ) + 1 ); |
+ retval = ft_strlen( type1->font_info.full_name ) + 1; |
if ( value && value_len >= retval ) |
ft_memcpy( value, (void *)( type1->font_info.full_name ), retval ); |
break; |
case PS_DICT_FAMILY_NAME: |
- retval = (FT_Long)( ft_strlen( type1->font_info.family_name ) + 1 ); |
+ retval = ft_strlen( type1->font_info.family_name ) + 1; |
if ( value && value_len >= retval ) |
ft_memcpy( value, (void *)( type1->font_info.family_name ), retval ); |
break; |
case PS_DICT_WEIGHT: |
- retval = (FT_Long)( ft_strlen( type1->font_info.weight ) + 1 ); |
+ retval = ft_strlen( type1->font_info.weight ) + 1; |
if ( value && value_len >= retval ) |
ft_memcpy( value, (void *)( type1->font_info.weight ), retval ); |
break; |
@@ -559,7 +561,7 @@ |
break; |
} |
- return retval; |
+ return retval == 0 ? -1 : (FT_Long)retval; |
} |
@@ -590,7 +592,7 @@ |
{ |
{ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &t1_service_ps_name }, |
{ FT_SERVICE_ID_GLYPH_DICT, &t1_service_glyph_dict }, |
- { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TYPE_1 }, |
+ { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_TYPE_1 }, |
{ FT_SERVICE_ID_POSTSCRIPT_INFO, &t1_service_ps_info }, |
#ifndef T1_CONFIG_OPTION_NO_AFM |