OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* psconv.c */ | 3 /* psconv.c */ |
4 /* */ | 4 /* */ |
5 /* Some convenience conversions (body). */ | 5 /* Some convenience conversions (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2006, 2008, 2009, 2012-2013 by */ | 7 /* Copyright 2006-2015 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 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 c_limit = (FT_Char)( 0x7FFFFFFFL % base ); | 117 c_limit = (FT_Char)( 0x7FFFFFFFL % base ); |
118 | 118 |
119 for ( ; p < limit; p++ ) | 119 for ( ; p < limit; p++ ) |
120 { | 120 { |
121 FT_Char c; | 121 FT_Char c; |
122 | 122 |
123 | 123 |
124 if ( IS_PS_SPACE( *p ) || *p OP 0x80 ) | 124 if ( IS_PS_SPACE( *p ) || *p OP 0x80 ) |
125 break; | 125 break; |
126 | 126 |
127 c = ft_char_table[*p & 0x7f]; | 127 c = ft_char_table[*p & 0x7F]; |
128 | 128 |
129 if ( c < 0 || c >= base ) | 129 if ( c < 0 || c >= base ) |
130 break; | 130 break; |
131 | 131 |
132 if ( num > num_limit || ( num == num_limit && c > c_limit ) ) | 132 if ( num > num_limit || ( num == num_limit && c > c_limit ) ) |
133 have_overflow = 1; | 133 have_overflow = 1; |
134 else | 134 else |
135 num = num * base + c; | 135 num = num * base + c; |
136 } | 136 } |
137 | 137 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 p++; | 238 p++; |
239 | 239 |
240 for ( ; p < limit; p++ ) | 240 for ( ; p < limit; p++ ) |
241 { | 241 { |
242 FT_Char c; | 242 FT_Char c; |
243 | 243 |
244 | 244 |
245 if ( IS_PS_SPACE( *p ) || *p OP 0x80 ) | 245 if ( IS_PS_SPACE( *p ) || *p OP 0x80 ) |
246 break; | 246 break; |
247 | 247 |
248 c = ft_char_table[*p & 0x7f]; | 248 c = ft_char_table[*p & 0x7F]; |
249 | 249 |
250 if ( c < 0 || c >= 10 ) | 250 if ( c < 0 || c >= 10 ) |
251 break; | 251 break; |
252 | 252 |
253 /* only add digit if we don't overflow */ | 253 /* only add digit if we don't overflow */ |
254 if ( divider < 0xCCCCCCCL && decimal < 0xCCCCCCCL ) | 254 if ( divider < 0xCCCCCCCL && decimal < 0xCCCCCCCL ) |
255 { | 255 { |
256 decimal = decimal * 10 + c; | 256 decimal = decimal * 10 + c; |
257 | 257 |
258 if ( !integral && power_ten > 0 ) | 258 if ( !integral && power_ten > 0 ) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 { | 482 { |
483 FT_UInt c = p[r]; | 483 FT_UInt c = p[r]; |
484 | 484 |
485 | 485 |
486 if ( IS_PS_SPACE( c ) ) | 486 if ( IS_PS_SPACE( c ) ) |
487 continue; | 487 continue; |
488 | 488 |
489 if ( c OP 0x80 ) | 489 if ( c OP 0x80 ) |
490 break; | 490 break; |
491 | 491 |
492 c = ft_char_table[c & 0x7F]; | 492 c = (FT_UInt)ft_char_table[c & 0x7F]; |
493 if ( (unsigned)c >= 16 ) | 493 if ( c >= 16 ) |
494 break; | 494 break; |
495 | 495 |
496 pad = ( pad << 4 ) | c; | 496 pad = ( pad << 4 ) | c; |
497 if ( pad & 0x100 ) | 497 if ( pad & 0x100 ) |
498 { | 498 { |
499 buffer[w++] = (FT_Byte)pad; | 499 buffer[w++] = (FT_Byte)pad; |
500 pad = 0x01; | 500 pad = 0x01; |
501 } | 501 } |
502 } | 502 } |
503 | 503 |
(...skipping 10 matching lines...) Expand all Loading... |
514 { | 514 { |
515 FT_Char c; | 515 FT_Char c; |
516 | 516 |
517 | 517 |
518 if ( IS_PS_SPACE( *p ) ) | 518 if ( IS_PS_SPACE( *p ) ) |
519 continue; | 519 continue; |
520 | 520 |
521 if ( *p OP 0x80 ) | 521 if ( *p OP 0x80 ) |
522 break; | 522 break; |
523 | 523 |
524 c = ft_char_table[*p & 0x7f]; | 524 c = ft_char_table[*p & 0x7F]; |
525 | 525 |
526 if ( (unsigned)c >= 16 ) | 526 if ( (unsigned)c >= 16 ) |
527 break; | 527 break; |
528 | 528 |
529 if ( r & 1 ) | 529 if ( r & 1 ) |
530 { | 530 { |
531 *buffer = (FT_Byte)(*buffer + c); | 531 *buffer = (FT_Byte)(*buffer + c); |
532 buffer++; | 532 buffer++; |
533 } | 533 } |
534 else | 534 else |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 *cursor = p; | 594 *cursor = p; |
595 *seed = s; | 595 *seed = s; |
596 | 596 |
597 #endif /* 0 */ | 597 #endif /* 0 */ |
598 | 598 |
599 return r; | 599 return r; |
600 } | 600 } |
601 | 601 |
602 | 602 |
603 /* END */ | 603 /* END */ |
OLD | NEW |