Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: third_party/freetype/src/psaux/psobjs.c

Issue 815103002: Update freetype to 2.5.4. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Adjust GYP and GN Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/freetype/src/psaux/psobjs.h ('k') | third_party/freetype/src/psaux/t1cmap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /***************************************************************************/ 1 /***************************************************************************/
2 /* */ 2 /* */
3 /* psobjs.c */ 3 /* psobjs.c */
4 /* */ 4 /* */
5 /* Auxiliary functions for PostScript fonts (body). */ 5 /* Auxiliary functions for PostScript fonts (body). */
6 /* */ 6 /* */
7 /* Copyright 1996-2013 by */ 7 /* Copyright 1996-2014 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */ 9 /* */
10 /* This file is part of the FreeType project, and may only be used, */ 10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */ 11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */ 13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */ 14 /* understand and accept it fully. */
15 /* */ 15 /* */
16 /***************************************************************************/ 16 /***************************************************************************/
17 17
18 18
19 #include "../../include/ft2build.h" 19 #include <ft2build.h>
20 #include "../../include/freetype/internal/psaux.h" 20 #include FT_INTERNAL_POSTSCRIPT_AUX_H
21 #include "../../include/freetype/internal/ftdebug.h" 21 #include FT_INTERNAL_DEBUG_H
22 #include "../../include/freetype/internal/ftcalc.h" 22 #include FT_INTERNAL_CALC_H
23 23
24 #include "psobjs.h" 24 #include "psobjs.h"
25 #include "psconv.h" 25 #include "psconv.h"
26 26
27 #include "psauxerr.h" 27 #include "psauxerr.h"
28 28
29 29
30 /*************************************************************************/ 30 /*************************************************************************/
31 /* */ 31 /* */
32 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ 32 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 840
841 Exit: 841 Exit:
842 *acur = cur; 842 *acur = cur;
843 return count; 843 return count;
844 } 844 }
845 845
846 846
847 /* first character must be a delimiter or a part of a number */ 847 /* first character must be a delimiter or a part of a number */
848 /* NB: `values' can be NULL if we just want to skip the */ 848 /* NB: `values' can be NULL if we just want to skip the */
849 /* array; in this case we ignore `max_values' */ 849 /* array; in this case we ignore `max_values' */
850 /* */
851 /* return number of successfully parsed values */
850 852
851 static FT_Int 853 static FT_Int
852 ps_tofixedarray( FT_Byte* *acur, 854 ps_tofixedarray( FT_Byte* *acur,
853 FT_Byte* limit, 855 FT_Byte* limit,
854 FT_Int max_values, 856 FT_Int max_values,
855 FT_Fixed* values, 857 FT_Fixed* values,
856 FT_Int power_ten ) 858 FT_Int power_ten )
857 { 859 {
858 FT_Byte* cur = *acur; 860 FT_Byte* cur = *acur;
859 FT_Int count = 0; 861 FT_Int count = 0;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1105
1104 case T1_FIELD_TYPE_FIXED: 1106 case T1_FIELD_TYPE_FIXED:
1105 val = PS_Conv_ToFixed( &cur, limit, 0 ); 1107 val = PS_Conv_ToFixed( &cur, limit, 0 );
1106 goto Store_Integer; 1108 goto Store_Integer;
1107 1109
1108 case T1_FIELD_TYPE_FIXED_1000: 1110 case T1_FIELD_TYPE_FIXED_1000:
1109 val = PS_Conv_ToFixed( &cur, limit, 3 ); 1111 val = PS_Conv_ToFixed( &cur, limit, 3 );
1110 goto Store_Integer; 1112 goto Store_Integer;
1111 1113
1112 case T1_FIELD_TYPE_INTEGER: 1114 case T1_FIELD_TYPE_INTEGER:
1113 { FT_Bool ret = xyq_PS_Conv_ToInt( &cur, limit, &val ); /* XYQ 2007-10- 10: abort if not a number*/ 1115 val = PS_Conv_ToInt( &cur, limit );
1114 » » if (!ret) break; }
1115 /* fall through */ 1116 /* fall through */
1116 1117
1117 Store_Integer: 1118 Store_Integer:
1118 switch ( field->size ) 1119 switch ( field->size )
1119 { 1120 {
1120 case (8 / FT_CHAR_BIT): 1121 case (8 / FT_CHAR_BIT):
1121 *(FT_Byte*)q = (FT_Byte)val; 1122 *(FT_Byte*)q = (FT_Byte)val;
1122 break; 1123 break;
1123 1124
1124 case (16 / FT_CHAR_BIT): 1125 case (16 / FT_CHAR_BIT):
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1188
1188 FT_MEM_COPY( string, cur, len ); 1189 FT_MEM_COPY( string, cur, len );
1189 string[len] = 0; 1190 string[len] = 0;
1190 1191
1191 *(FT_String**)q = string; 1192 *(FT_String**)q = string;
1192 } 1193 }
1193 break; 1194 break;
1194 1195
1195 case T1_FIELD_TYPE_BBOX: 1196 case T1_FIELD_TYPE_BBOX:
1196 { 1197 {
1197 » » // Add by Johnson, fix a Error #1: UNINITIALIZED READ. #testdo c 1282.pdf 1198 FT_Fixed temp[4];
1198 FT_Fixed temp[4] = {0,0,0,0};
1199 FT_BBox* bbox = (FT_BBox*)q; 1199 FT_BBox* bbox = (FT_BBox*)q;
1200 FT_Int result; 1200 FT_Int result;
1201 1201
1202 1202
1203 result = ps_tofixedarray( &cur, limit, 4, temp, 0 ); 1203 result = ps_tofixedarray( &cur, limit, 4, temp, 0 );
1204 1204
1205 if ( result < 0 ) 1205 if ( result < 4 )
1206 { 1206 {
1207 FT_ERROR(( "ps_parser_load_field:" 1207 FT_ERROR(( "ps_parser_load_field:"
1208 " expected four integers in bounding box\n" )); 1208 " expected four integers in bounding box\n" ));
1209 error = FT_THROW( Invalid_File_Format ); 1209 error = FT_THROW( Invalid_File_Format );
1210 goto Exit; 1210 goto Exit;
1211 } 1211 }
1212 1212
1213 bbox->xMin = FT_RoundFix( temp[0] ); 1213 bbox->xMin = FT_RoundFix( temp[0] );
1214 bbox->yMin = FT_RoundFix( temp[1] ); 1214 bbox->yMin = FT_RoundFix( temp[1] );
1215 bbox->xMax = FT_RoundFix( temp[2] ); 1215 bbox->xMax = FT_RoundFix( temp[2] );
1216 bbox->yMax = FT_RoundFix( temp[3] ); 1216 bbox->yMax = FT_RoundFix( temp[3] );
1217 } 1217 }
1218 break; 1218 break;
1219 1219
1220 case T1_FIELD_TYPE_MM_BBOX: 1220 case T1_FIELD_TYPE_MM_BBOX:
1221 { 1221 {
1222 FT_Memory memory = parser->memory; 1222 FT_Memory memory = parser->memory;
1223 FT_Fixed* temp; 1223 FT_Fixed* temp;
1224 FT_Int result; 1224 FT_Int result;
1225 FT_UInt i; 1225 FT_UInt i;
1226 1226
1227 1227
1228 if ( FT_NEW_ARRAY( temp, max_objects * 4 ) ) 1228 if ( FT_NEW_ARRAY( temp, max_objects * 4 ) )
1229 goto Exit; 1229 goto Exit;
1230 1230
1231 for ( i = 0; i < 4; i++ ) 1231 for ( i = 0; i < 4; i++ )
1232 { 1232 {
1233 result = ps_tofixedarray( &cur, limit, max_objects, 1233 result = ps_tofixedarray( &cur, limit, max_objects,
1234 temp + i * max_objects, 0 ); 1234 temp + i * max_objects, 0 );
1235 if ( result < 0 ) 1235 if ( result < 0 || (FT_UInt)result < max_objects )
1236 { 1236 {
1237 FT_ERROR(( "ps_parser_load_field:" 1237 FT_ERROR(( "ps_parser_load_field:"
1238 " expected %d integers in the %s subarray\n" 1238 " expected %d integers in the %s subarray\n"
1239 " " 1239 " "
1240 " of /FontBBox in the /Blend dictionary\n", 1240 " of /FontBBox in the /Blend dictionary\n",
1241 max_objects, 1241 max_objects,
1242 i == 0 ? "first" 1242 i == 0 ? "first"
1243 : ( i == 1 ? "second" 1243 : ( i == 1 ? "second"
1244 : ( i == 2 ? "third" 1244 : ( i == 2 ? "third"
1245 : "fourth" ) ) )); 1245 : "fourth" ) ) ));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 ) 1331 if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
1332 *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) = 1332 *(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
1333 (FT_Byte)num_elements; 1333 (FT_Byte)num_elements;
1334 1334
1335 /* we now load each element, adjusting the field.offset on each one */ 1335 /* we now load each element, adjusting the field.offset on each one */
1336 token = elements; 1336 token = elements;
1337 for ( ; num_elements > 0; num_elements--, token++ ) 1337 for ( ; num_elements > 0; num_elements--, token++ )
1338 { 1338 {
1339 parser->cursor = token->start; 1339 parser->cursor = token->start;
1340 parser->limit = token->limit; 1340 parser->limit = token->limit;
1341 ps_parser_load_field( parser, &fieldrec, objects, max_objects, 0 ); 1341
1342 error = ps_parser_load_field( parser,
1343 &fieldrec,
1344 objects,
1345 max_objects,
1346 0 );
1347 if ( error )
1348 break;
1349
1342 fieldrec.offset += fieldrec.size; 1350 fieldrec.offset += fieldrec.size;
1343 } 1351 }
1344 1352
1345 #if 0 /* obsolete -- keep for reference */ 1353 #if 0 /* obsolete -- keep for reference */
1346 if ( pflags ) 1354 if ( pflags )
1347 *pflags |= 1L << field->flag_bit; 1355 *pflags |= 1L << field->flag_bit;
1348 #else 1356 #else
1349 FT_UNUSED( pflags ); 1357 FT_UNUSED( pflags );
1350 #endif 1358 #endif
1351 1359
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 { 1766 {
1759 PS_Conv_EexecDecode( &buffer, 1767 PS_Conv_EexecDecode( &buffer,
1760 buffer + length, 1768 buffer + length,
1761 buffer, 1769 buffer,
1762 length, 1770 length,
1763 &seed ); 1771 &seed );
1764 } 1772 }
1765 1773
1766 1774
1767 /* END */ 1775 /* END */
OLDNEW
« no previous file with comments | « third_party/freetype/src/psaux/psobjs.h ('k') | third_party/freetype/src/psaux/t1cmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698