* src/base/Jamfile: adding src/base/ftgxval.c * src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c, src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c, src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c, src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c, src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c, src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c: removing _many_ compiler warnings when compiling with Visual C++ at maximum level (/W4)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
diff --git a/ChangeLog b/ChangeLog
index a47f4ac..acbfc52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,18 @@
* src/autofit/aflatin.c (af_latin_hints_init): fixed a bug that
prevented internal hint mode bitflags from being computed correctly
+ * src/base/Jamfile: adding src/base/ftgxval.c
+
+ * src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c,
+ src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c,
+ src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
+ src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c,
+ src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
+ src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c,
+ src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c:
+ removing _many_ compiler warnings when compiling with Visual C++
+ at maximum level (/W4)
+
2005-09-22 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Mention SING Glyphlet support.
diff --git a/src/base/Jamfile b/src/base/Jamfile
index 6222009..2c486d1 100644
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -30,10 +30,15 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ;
# Add the optional/replaceable files.
#
-Library $(FT2_LIB) : ftsystem.c ftinit.c ftglyph.c ftmm.c ftbdf.c
- ftbbox.c ftdebug.c ftxf86.c fttype1.c ftpfr.c
- ftstroke.c ftwinfnt.c ftotval.c ftbitmap.c
- ftsynth.c ;
+{
+ local _sources = system init glyph mm bdf
+ bbox debug xf86 type1 pfr
+ stroke winfnt otval bitmap synth
+ gxval
+ ;
+
+ Library $(FT2_LIB) : ft$(_sources).c ;
+}
# Add Macintosh-specific file to the library when necessary.
#
diff --git a/src/gxvalid/gxvbsln.c b/src/gxvalid/gxvbsln.c
index c330138..76ceeea 100644
--- a/src/gxvalid/gxvbsln.c
+++ b/src/gxvalid/gxvbsln.c
@@ -131,8 +131,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + ( relative_gindex * sizeof ( FT_UShort ) );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + ( relative_gindex * sizeof ( FT_UShort ) ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
diff --git a/src/gxvalid/gxvcommn.c b/src/gxvalid/gxvcommn.c
index c7bdfd1..bf31c76 100644
--- a/src/gxvalid/gxvcommn.c
+++ b/src/gxvalid/gxvcommn.c
@@ -94,7 +94,7 @@
if ( j == nmemb )
FT_INVALID_OFFSET;
- *(length[i]) = buff[j + 1] - buff[j];
+ *(length[i]) = (FT_UShort)(buff[j + 1] - buff[j]);
if ( 0 != offset[i] && 0 == *(length[i]) )
FT_INVALID_OFFSET;
@@ -197,8 +197,8 @@
GXV_LIMIT_CHECK( 1 );
val = FT_NEXT_BYTE( p );
- *min = FT_MIN( *min, val );
- *max = FT_MAX( *max, val );
+ *min = (FT_Byte)FT_MIN( *min, val );
+ *max = (FT_Byte)FT_MAX( *max, val );
}
valid->subtable_length = p - table;
@@ -226,8 +226,8 @@
GXV_LIMIT_CHECK( 2 );
val = FT_NEXT_USHORT( p );
- *min = FT_MIN( *min, val );
- *max = FT_MAX( *max, val );
+ *min = (FT_Byte) FT_MIN( *min, val );
+ *max = (FT_Byte) FT_MAX( *max, val );
}
valid->subtable_length = p - table;
@@ -282,9 +282,9 @@
;
entrySelector--;
- searchRange *= binSrchHeader->unitSize;
- rangeShift = binSrchHeader->nUnits * binSrchHeader->unitSize -
- searchRange;
+ searchRange = (FT_UShort)( searchRange * binSrchHeader->unitSize );
+ rangeShift = (FT_UShort)( binSrchHeader->nUnits * binSrchHeader->unitSize
+ - searchRange );
if ( searchRange != binSrchHeader->searchRange ||
entrySelector != binSrchHeader->entrySelector ||
@@ -629,8 +629,11 @@
for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
{
- value = valid->lookupfmt4_trans( gid - firstGlyph, base_value,
- limit, valid );
+ value = valid->lookupfmt4_trans( (FT_UShort)(gid - firstGlyph),
+ base_value,
+ limit,
+ valid );
+
valid->lookupval_func( gid, value, valid );
}
}
@@ -739,14 +742,14 @@
glyphCount = FT_NEXT_USHORT( p );
gxv_glyphid_validate( firstGlyph, valid );
- gxv_glyphid_validate( firstGlyph + glyphCount, valid );
+ gxv_glyphid_validate( (FT_UShort)(firstGlyph + glyphCount), valid );
/* valueArray */
for ( i = 0; i < glyphCount; i++ )
{
GXV_LIMIT_CHECK( 2 );
value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
- valid->lookupval_func( firstGlyph + i, value, valid );
+ valid->lookupval_func( (FT_UShort)(firstGlyph + i), value, valid );
}
valid->subtable_length = p - table;
@@ -912,13 +915,15 @@
}
GXV_TRACE(( " nameIndex = %d (UNTITLED)\n", name_index ));
- FT_INVALID_DATA;
+ FT_INVALID_DATA;
+ goto Exit; /* make compiler happy */
Out:
FT_TRACE1(( " nameIndex = %d (", name_index ));
GXV_TRACE_HEXDUMP_SFNTNAME( name );
FT_TRACE1(( ")\n" ));
+ Exit:
GXV_EXIT;
}
@@ -967,7 +972,7 @@
if ( !nGlyphs )
goto Out;
- gxv_glyphid_validate( firstGlyph + nGlyphs, valid );
+ gxv_glyphid_validate( (FT_UShort)(firstGlyph + nGlyphs), valid );
{
FT_Byte nGlyphInClass[256];
@@ -1000,12 +1005,12 @@
break;
}
}
- *length_p = p - table;
+ *length_p = (FT_UShort)(p - table);
/* scan max ClassID in use */
for ( i = 0; i < stateSize; i++ )
if ( ( 3 < i ) && ( nGlyphInClass[i] > 0 ) )
- *maxClassID_p = i;
+ *maxClassID_p = (FT_Byte)i; /* XXX: Check Range ? */
}
Out:
@@ -1037,6 +1042,8 @@
GXV_TRACE(( "parse %d bytes by stateSize=%d maxClassID=%d\n",
(int)(*length_p), stateSize, (int)(maxClassID) ));
+ FT_UNUSED( stateSize );
+
/*
* 2 states are predefined and must be described in StateArray:
* state 0 (start of text), 1 (start of line)
@@ -1053,13 +1060,13 @@
for ( clazz = 0; clazz <= maxClassID; clazz++ )
{
entry = FT_NEXT_BYTE( p );
- *maxEntry_p = FT_MAX( *maxEntry_p, entry );
+ *maxEntry_p = (FT_Byte) FT_MAX( *maxEntry_p, entry );
}
}
GXV_TRACE(( "parsed: maxState=%d, maxEntry=%d\n",
*maxState_p, *maxEntry_p ));
- *length_p = p - table;
+ *length_p = (FT_UShort)(p - table);
GXV_EXIT;
}
@@ -1097,7 +1104,7 @@
FT_INVALID_TOO_SHORT;
/* ftxvalidator and FontValidator both warn and continue */
- maxEntry = *length_p / entrySize - 1;
+ maxEntry = (FT_Byte)(*length_p / entrySize - 1);
GXV_TRACE(( "too large maxEntry, shrinking to %d fit EntryTable length\n",
maxEntry ));
}
@@ -1132,11 +1139,12 @@
continue;
}
- state = ( newState - stateArray ) / ( 1 + maxClassID );
+ state = (FT_Byte)(( newState - stateArray ) / ( 1 + maxClassID ));
switch ( GXV_GLYPHOFFSET_FMT( statetable ) )
{
case GXV_GLYPHOFFSET_NONE:
+ glyphOffset.uc = 0; /* make compiler happy !! */
break;
case GXV_GLYPHOFFSET_UCHAR:
@@ -1166,6 +1174,8 @@
default:
if ( valid->root->level >= FT_VALIDATE_PARANOID )
FT_INVALID_FORMAT;
+
+ goto Exit;
}
if ( NULL != valid->statetable.entry_validate_func )
@@ -1176,7 +1186,8 @@
statetable_limit,
valid );
}
- *length_p = p - table;
+ Exit:
+ *length_p = (FT_UShort)(p - table);
GXV_EXIT;
}
@@ -1258,7 +1269,7 @@
else
setup_func = gxv_StateTable_subtable_setup;
- setup_func( limit - table,
+ setup_func( (FT_UShort)(limit - table),
classTable,
stateArray,
entryTable,
@@ -1276,7 +1287,7 @@
&maxClassID,
valid );
else
- maxClassID = stateSize - 1;
+ maxClassID = (FT_Byte)(stateSize - 1);
if ( stateArray != 0 )
gxv_StateArray_validate( table + stateArray,
@@ -1389,8 +1400,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof ( FT_UShort ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
@@ -1422,6 +1433,8 @@
GXV_TRACE(( "parse % 3d bytes by stateSize=% 3d maxClassID=% 3d\n",
(int)(*length_p), stateSize, (int)(maxClassID) ));
+ FT_UNUSED( stateSize );
+
/*
* 2 states are predefined and must be described:
* state 0 (start of text), 1 (start of line)
@@ -1438,7 +1451,7 @@
for ( clazz = 0; clazz <= maxClassID; clazz++ )
{
entry = FT_NEXT_USHORT( p );
- *maxEntry_p = FT_MAX( *maxEntry_p, entry );
+ *maxEntry_p = (FT_UShort) FT_MAX( *maxEntry_p, entry );
}
}
GXV_TRACE(( "parsed: maxState=%d, maxEntry=%d\n",
@@ -1492,7 +1505,7 @@
FT_INVALID_OFFSET;
}
- state = newState_idx / ( 1 + maxClassID );
+ state = (FT_UShort)(newState_idx / ( 1 + maxClassID ));
if ( 0 != ( newState_idx % ( 1 + maxClassID ) ) )
{
FT_TRACE4(( "-> new state = %d (supposed)\n"
@@ -1505,6 +1518,7 @@
switch ( GXV_GLYPHOFFSET_FMT( xstatetable ) )
{
case GXV_GLYPHOFFSET_NONE:
+ glyphOffset.uc = 0; /* make compiler happy */
break;
case GXV_GLYPHOFFSET_UCHAR:
@@ -1534,6 +1548,7 @@
default:
if ( valid->root->level >= FT_VALIDATE_PARANOID )
FT_INVALID_FORMAT;
+ goto Exit;
}
if ( NULL != valid->xstatetable.entry_validate_func )
@@ -1545,6 +1560,7 @@
valid );
}
+ Exit:
*length_p = p - table;
GXV_EXIT;
@@ -1622,7 +1638,11 @@
classTable_length = valid->subtable_length;
}
else
- valid->xstatetable.maxClassID = valid->xstatetable.nClasses - 1;
+ {
+ /* XXX: check range ? */
+ valid->xstatetable.maxClassID =
+ (FT_UShort)(valid->xstatetable.nClasses - 1);
+ }
if ( stateArray != 0 )
gxv_XStateArray_validate( table + stateArray,
diff --git a/src/gxvalid/gxvfeat.c b/src/gxvalid/gxvfeat.c
index 05e784b..61ba48b 100644
--- a/src/gxvalid/gxvfeat.c
+++ b/src/gxvalid/gxvfeat.c
@@ -225,14 +225,15 @@
( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 )
FT_INVALID_DATA;
- exclusive = featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS;
+ exclusive = FT_BOOL(featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS);
if ( exclusive )
{
FT_Byte dynamic_default;
if ( featureFlags & GXV_FEAT_MASK_DYNAMIC_DEFAULT )
- dynamic_default = featureFlags & GXV_FEAT_MASK_DEFAULT_SETTING;
+ dynamic_default = (FT_Byte)( featureFlags &
+ GXV_FEAT_MASK_DEFAULT_SETTING);
else
dynamic_default = 0;
diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c
index ec092eb..0919e01 100644
--- a/src/gxvalid/gxvjust.c
+++ b/src/gxvalid/gxvjust.c
@@ -401,10 +401,10 @@
FT_UNUSED( valid );
- setMark = ( 0x8000U & flags ) / 0x8000U;
- dontAdvance = ( 0x4000 & flags ) / 0x4000;
- markClass = ( 0x3F80 & flags ) / 0x0080;
- currentClass = 0x007F & flags ;
+ setMark = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1);
+ markClass = (FT_UShort)( (flags >> 7) & 0x7F );
+ currentClass = (FT_UShort)( flags & 0x7F );
/* TODO: validate markClass & currentClass */
}
diff --git a/src/gxvalid/gxvkern.c b/src/gxvalid/gxvkern.c
index a17ba9c..350326b 100644
--- a/src/gxvalid/gxvkern.c
+++ b/src/gxvalid/gxvkern.c
@@ -234,9 +234,9 @@
FT_UNUSED( glyphOffset );
- push = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- valueOffset = flags & 0x3FFF;
+ push = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ valueOffset = (FT_UShort)( flags & 0x3FFF );
{
GXV_kern_fmt1_StateOptRecData vt_rec =
@@ -341,7 +341,7 @@
tag, firstGlyph, nGlyphs ));
gxv_glyphid_validate( firstGlyph, valid );
- gxv_glyphid_validate( firstGlyph + nGlyphs - 1, valid );
+ gxv_glyphid_validate( (FT_UShort)(firstGlyph + nGlyphs - 1), valid );
gxv_array_getlimits_ushort( p, p + ( 2 * nGlyphs ),
&( GXV_KERN_FMT2_DATA( offset_min[spec] ) ),
@@ -517,10 +517,10 @@
if ( coverage & 0x1FFC )
return 0;
- kernVertical = ( coverage >> 15 ) & 1;
- kernCrossStream = ( coverage >> 14 ) & 1;
- kernVariation = ( coverage >> 13 ) & 1;
- *format = coverage & 0x0003;
+ kernVertical = FT_BOOL(( coverage >> 15 ) & 1);
+ kernCrossStream = FT_BOOL(( coverage >> 14 ) & 1);
+ kernVariation = FT_BOOL(( coverage >> 13 ) & 1);
+ *format = (FT_UShort)( coverage & 0x0003 );
GXV_TRACE(( "new Apple-dialect: "
"horizontal=%d, cross-stream=%d, variation=%d, format=%d\n",
@@ -528,6 +528,8 @@
GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" ));
+ FT_UNUSED( valid );
+
return 1;
}
@@ -550,9 +552,9 @@
if ( coverage & 0x02FC )
return 0;
- horizontal = ( coverage >> 15 ) & 1;
- cross_stream = ( coverage >> 13 ) & 1;
- *format = coverage & 0x0003;
+ horizontal = FT_BOOL(( coverage >> 15 ) & 1);
+ cross_stream = FT_BOOL(( coverage >> 13 ) & 1);
+ *format = (FT_UShort)( coverage & 0x0003 );
GXV_TRACE(( "classic Apple-dialect: "
"horizontal=%d, cross-stream=%d, format=%d\n",
@@ -579,16 +581,17 @@
FT_Bool cross_stream;
FT_Bool override;
+ FT_UNUSED( valid );
/* reserved bits = 0 */
if ( coverage & 0xFDF0 )
return 0;
- horizontal = coverage & 1;
- minimum = ( coverage >> 1 ) & 1;
- cross_stream = ( coverage >> 2 ) & 1;
- override = ( coverage >> 3 ) & 1;
- *format = ( coverage >> 8 ) & 0x0003;
+ horizontal = FT_BOOL( coverage & 1 );
+ minimum = FT_BOOL(( coverage >> 1 ) & 1);
+ cross_stream = FT_BOOL(( coverage >> 2 ) & 1);
+ override = FT_BOOL(( coverage >> 3 ) & 1);
+ *format = (FT_UShort)(( coverage >> 8 ) & 0x0003);
GXV_TRACE(( "classic Microsoft-dialect: "
"horizontal=%d, minimum=%d, cross-stream=%d, "
diff --git a/src/gxvalid/gxvlcar.c b/src/gxvalid/gxvlcar.c
index 3888358..e763c05 100644
--- a/src/gxvalid/gxvlcar.c
+++ b/src/gxvalid/gxvlcar.c
@@ -157,8 +157,8 @@
FT_UNUSED( lookuptbl_limit );
-
- offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof ( FT_UShort ));
p = valid->root->base + offset;
limit = valid->root->limit;
diff --git a/src/gxvalid/gxvmort.c b/src/gxvalid/gxvmort.c
index 4cb3a19..34b1179 100644
--- a/src/gxvalid/gxvmort.c
+++ b/src/gxvalid/gxvmort.c
@@ -64,10 +64,9 @@
/* nSettings in gxvfeat.c is halved for exclusive on/off settings */
+ nSettings_max = gxv_feat_registry[f->featureType].nSettings;
if ( gxv_feat_registry[f->featureType].exclusive )
- nSettings_max = 2 * gxv_feat_registry[f->featureType].nSettings;
- else
- nSettings_max = gxv_feat_registry[f->featureType].nSettings;
+ nSettings_max = (FT_Byte)(2*nSettings_max);
GXV_TRACE(( "featureType %d is registered", f->featureType ));
GXV_TRACE(( "setting %d", f->featureSetting ));
@@ -125,6 +124,8 @@
gxv_mort_coverage_validate( FT_UShort coverage,
GXV_Validator valid )
{
+ FT_UNUSED( valid );
+
if ( coverage & 0x8000U )
GXV_TRACE(( " this subtable is for vertical text only\n" ));
else
diff --git a/src/gxvalid/gxvmort0.c b/src/gxvalid/gxvmort0.c
index c93ee4d..098753c 100644
--- a/src/gxvalid/gxvmort0.c
+++ b/src/gxvalid/gxvmort0.c
@@ -80,13 +80,14 @@
FT_UNUSED( limit );
- markFirst = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- markLast = ( flags & 0x2000 ) / 0x2000;
- reserved = flags & 0x1FF0;
- verb = flags & 0x000F;
+ markFirst = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ markLast = (FT_UShort)( (flags >> 13) & 1 );
+ reserved = (FT_UShort)( flags & 0x1FF0 );
+ verb = (FT_UShort)( flags & 0x000F );
FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] );
+ FT_UNUSED( glyphOffset );
GXV_TRACE(( " IndicScript MorphRule for glyphOffset 0x%04x",
glyphOffset.u ));
@@ -96,6 +97,8 @@
GXV_TRACE(( " %02d", verb ));
GXV_TRACE(( " %s\n", GXV_Mort_IndicScript_Msg[verb] ));
+
+
if ( 0 < reserved )
{
GXV_TRACE(( " non-zero bits found in reserved range\n" ));
diff --git a/src/gxvalid/gxvmort1.c b/src/gxvalid/gxvmort1.c
index 86d667c..e37af64 100644
--- a/src/gxvalid/gxvmort1.c
+++ b/src/gxvalid/gxvmort1.c
@@ -115,13 +115,14 @@
substTable = ((GXV_mort_subtable_type1_StateOptRec *)
(valid->statetable.optdata))->substitutionTable;
- substTable_limit = substTable +
+ substTable_limit = (FT_UShort)(substTable +
((GXV_mort_subtable_type1_StateOptRec *)
- (valid->statetable.optdata))->substitutionTable_length;
+ (valid->statetable.optdata))->substitutionTable_length);
- min_gid = ( substTable - wordOffset * 2 ) / 2;
- max_gid = ( substTable_limit - wordOffset * 2 ) / 2;
- max_gid = FT_MAX( max_gid, valid->face->num_glyphs );
+ min_gid = (FT_UShort)(( substTable - wordOffset * 2 ) / 2);
+ max_gid = (FT_UShort)(( substTable_limit - wordOffset * 2 ) / 2);
+ max_gid = (FT_UShort)(FT_MAX( max_gid, valid->face->num_glyphs ));
+ /* XXX: check range ? */
/* TODO: min_gid & max_gid comparison with ClassTable contents */
}
@@ -146,11 +147,11 @@
FT_UNUSED( limit );
- setMark = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- reserved = flags & 0x3FFF;
- markOffset = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000UL );
- currentOffset = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFFUL );
+ setMark = (FT_UShort)( flags >> 15);
+ dontAdvance = (FT_UShort)((flags >> 14) & 1);
+ reserved = (FT_Short)( flags & 0x3FFF );
+ markOffset = (FT_Short)( glyphOffset.ul >> 16 );
+ currentOffset = (FT_Short)( glyphOffset.ul );
if ( 0 < reserved )
{
@@ -177,9 +178,9 @@
GXV_Validator valid )
{
FT_Bytes p = table;
- FT_UShort num_gids =
+ FT_UShort num_gids = (FT_UShort)(
((GXV_mort_subtable_type1_StateOptRec *)
- (valid->statetable.optdata))->substitutionTable_length / 2;
+ (valid->statetable.optdata))->substitutionTable_length / 2);
FT_UShort i;
diff --git a/src/gxvalid/gxvmort2.c b/src/gxvalid/gxvmort2.c
index bfbe473..a62b211 100644
--- a/src/gxvalid/gxvmort2.c
+++ b/src/gxvalid/gxvmort2.c
@@ -177,9 +177,9 @@
lig_action = FT_NEXT_ULONG( p );
- last = (lig_action & 0x80000000UL) / 0x80000000UL;
- store = (lig_action & 0x40000000UL) / 0x40000000UL;
- offset = lig_action & 0x3FFFFFFFUL;
+ last = (FT_UShort)( (lig_action >> 31) & 1 );
+ store = (FT_UShort)( (lig_action >> 30) & 1 );
+ offset = lig_action & 0x3FFFFFFFUL;
}
}
@@ -202,9 +202,9 @@
FT_UNUSED( limit );
- setComponent = ( flags & 0x8000U ) / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- offset = flags & 0x3FFF;
+ setComponent = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ offset = (FT_UShort)( flags & 0x3FFFU );
if ( 0 < offset )
gxv_mort_subtable_type2_ligActionOffset_validate( table, offset,
diff --git a/src/gxvalid/gxvmort4.c b/src/gxvalid/gxvmort4.c
index 959220e..9b7d982 100644
--- a/src/gxvalid/gxvmort4.c
+++ b/src/gxvalid/gxvmort4.c
@@ -87,8 +87,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
+ /* XXX: check range */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof ( FT_UShort ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
diff --git a/src/gxvalid/gxvmort5.c b/src/gxvalid/gxvmort5.c
index 5c90ed7..402096a 100644
--- a/src/gxvalid/gxvmort5.c
+++ b/src/gxvalid/gxvmort5.c
@@ -158,16 +158,16 @@
FT_UNUSED( state );
- setMark = ( flags >> 15 ) & 1;
- dontAdvance = ( flags >> 14 ) & 1;
- currentIsKashidaLike = ( flags >> 13 ) & 1;
- markedIsKashidaLike = ( flags >> 12 ) & 1;
- currentInsertBefore = ( flags >> 11 ) & 1;
- markedInsertBefore = ( flags >> 10 ) & 1;
- currentInsertCount = ( flags & 0x03E0 ) / 0x0020;
- markedInsertCount = ( flags & 0x001F );
- currentInsertList = glyphOffset.ul / 0x00010000UL;
- markedInsertList = glyphOffset.ul & 0x0000FFFFUL;
+ setMark = FT_BOOL(( flags >> 15 ) & 1);
+ dontAdvance = FT_BOOL(( flags >> 14 ) & 1);
+ currentIsKashidaLike = FT_BOOL(( flags >> 13 ) & 1);
+ markedIsKashidaLike = FT_BOOL(( flags >> 12 ) & 1);
+ currentInsertBefore = FT_BOOL(( flags >> 11 ) & 1);
+ markedInsertBefore = FT_BOOL(( flags >> 10 ) & 1);
+ currentInsertCount = (FT_Byte)( (flags >> 5) & 0x1F );
+ markedInsertCount = (FT_Byte)( flags & 0x001F );
+ currentInsertList = (FT_UShort)( glyphOffset.ul >> 16 );
+ markedInsertList = (FT_UShort)( glyphOffset.ul );
if ( 0 != currentInsertList && 0 != currentInsertCount )
{
diff --git a/src/gxvalid/gxvmorx.c b/src/gxvalid/gxvmorx.c
index 5f894c7..c3748a3 100644
--- a/src/gxvalid/gxvmorx.c
+++ b/src/gxvalid/gxvmorx.c
@@ -85,8 +85,8 @@
GXV_LIMIT_CHECK( rest );
/* morx coverage consists of mort_coverage & 16bit padding */
- gxv_mort_coverage_validate( ( coverage >> 16 ) | coverage, valid );
-
+ gxv_mort_coverage_validate( (FT_UShort)(( coverage >> 16 ) | coverage),
+ valid );
if ( type > 5 )
FT_INVALID_FORMAT;
@@ -128,7 +128,13 @@
/* feature-array of morx is same with that of mort */
gxv_mort_featurearray_validate( p, limit, nFeatureFlags, valid );
p += valid->subtable_length;
- gxv_morx_subtables_validate( p, table + chainLength, nSubtables, valid );
+
+ if ( nSubtables >= 0x10000 )
+ FT_INVALID_DATA;
+
+ gxv_morx_subtables_validate( p, table + chainLength,
+ (FT_UShort)nSubtables, valid );
+
valid->subtable_length = chainLength;
GXV_EXIT;
diff --git a/src/gxvalid/gxvmorx0.c b/src/gxvalid/gxvmorx0.c
index a902941..dddf583 100644
--- a/src/gxvalid/gxvmorx0.c
+++ b/src/gxvalid/gxvmorx0.c
@@ -59,11 +59,11 @@
FT_UNUSED( limit );
- markFirst = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- markLast = ( flags & 0x2000 ) / 0x2000;
- reserved = flags & 0x1FF0;
- verb = flags & 0x000F;
+ markFirst = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ markLast = (FT_UShort)( (flags >> 13) & 1 );
+ reserved = (FT_UShort)( flags & 0x1FF0 );
+ verb = (FT_UShort)( flags & 0x000F );
if ( 0 < reserved )
{
diff --git a/src/gxvalid/gxvmorx1.c b/src/gxvalid/gxvmorx1.c
index 689e4a7..e2caddc 100644
--- a/src/gxvalid/gxvmorx1.c
+++ b/src/gxvalid/gxvmorx1.c
@@ -122,11 +122,11 @@
FT_UNUSED( limit );
- setMark = flags / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- reserved = flags & 0x3FFF;
- markIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul / 0x00010000UL );
- currentIndex = GXV_USHORT_TO_SHORT( glyphOffset.ul & 0x0000FFFFUL );
+ setMark = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ reserved = (FT_UShort)( flags & 0x3FFF );
+ markIndex = (FT_Short)( glyphOffset.ul >> 16 );
+ currentIndex = (FT_Short)( glyphOffset.ul );
GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
setMark, dontAdvance ));
@@ -142,10 +142,10 @@
markIndex, currentIndex ));
if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )
- optdata->substitutionTable_num_lookupTables = markIndex + 1;
+ optdata->substitutionTable_num_lookupTables = (FT_Short)(markIndex + 1);
if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )
- optdata->substitutionTable_num_lookupTables = currentIndex + 1;
+ optdata->substitutionTable_num_lookupTables = (FT_Short)(currentIndex + 1);
}
@@ -155,6 +155,9 @@
GXV_Validator valid )
{
GXV_TRACE(( "morx subtable type1 subst.: %d -> %d\n", glyph, value.u ));
+
+ FT_UNUSED( glyph );
+
if ( value.u > valid->face->num_glyphs )
FT_INVALID_GLYPH_ID;
}
@@ -172,8 +175,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + relative_gindex * sizeof ( FT_UShort );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof ( FT_UShort ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
diff --git a/src/gxvalid/gxvmorx2.c b/src/gxvalid/gxvmorx2.c
index 93fe318..7493b0e 100644
--- a/src/gxvalid/gxvmorx2.c
+++ b/src/gxvalid/gxvmorx2.c
@@ -174,9 +174,9 @@
lig_action = FT_NEXT_ULONG( p );
- last = (lig_action & 0x80000000UL) / 0x80000000UL;
- store = (lig_action & 0x40000000UL) / 0x40000000UL;
- offset = lig_action & 0x3FFFFFFFUL;
+ last = (FT_UShort)( (lig_action >> 31) & 1 );
+ store = (FT_UShort)( (lig_action >> 30) & 1 );
+ offset = lig_action & 0x3FFFFFFFUL;
}
}
@@ -200,10 +200,10 @@
FT_UNUSED( limit );
- setComponent = ( flags & 0x8000U ) / 0x8000U;
- dontAdvance = ( flags & 0x4000 ) / 0x4000;
- performAction = ( flags & 0x2000 ) / 0x2000;
- reserved = flags & 0x1FFF;
+ setComponent = (FT_UShort)( (flags >> 15) & 1 );
+ dontAdvance = (FT_UShort)( (flags >> 14) & 1 );
+ performAction = (FT_UShort)( (flags >> 13) & 1 );
+ reserved = (FT_UShort)( flags & 0x1FFF );
ligActionIndex = glyphOffset.u;
if ( reserved > 0 )
diff --git a/src/gxvalid/gxvmorx5.c b/src/gxvalid/gxvmorx5.c
index de9aebc..ea250f3 100644
--- a/src/gxvalid/gxvmorx5.c
+++ b/src/gxvalid/gxvmorx5.c
@@ -147,7 +147,7 @@
FT_Bool markedIsKashidaLike;
FT_Bool currentInsertBefore;
FT_Bool markedInsertBefore;
- FT_Bool currentInsertCount;
+ FT_Byte currentInsertCount;
FT_Byte markedInsertCount;
FT_Byte currentInsertList;
FT_UShort markedInsertList;
@@ -155,16 +155,16 @@
FT_UNUSED( state );
- setMark = ( flags >> 15 ) & 1;
- dontAdvance = ( flags >> 14 ) & 1;
- currentIsKashidaLike = ( flags >> 13 ) & 1;
- markedIsKashidaLike = ( flags >> 12 ) & 1;
- currentInsertBefore = ( flags >> 11 ) & 1;
- markedInsertBefore = ( flags >> 10 ) & 1;
- currentInsertCount = ( flags & 0x03E0 ) / 0x20;
- markedInsertCount = ( flags & 0x001F );
- currentInsertList = glyphOffset.ul / 0x00010000UL;
- markedInsertList = glyphOffset.ul & 0x0000FFFFUL;
+ setMark = FT_BOOL(( flags >> 15 ) & 1);
+ dontAdvance = FT_BOOL(( flags >> 14 ) & 1);
+ currentIsKashidaLike = FT_BOOL(( flags >> 13 ) & 1);
+ markedIsKashidaLike = FT_BOOL(( flags >> 12 ) & 1);
+ currentInsertBefore = FT_BOOL(( flags >> 11 ) & 1);
+ markedInsertBefore = FT_BOOL(( flags >> 10 ) & 1);
+ currentInsertCount = (FT_Byte)( (flags >> 5) & 0x1F );
+ markedInsertCount = (FT_Byte)( flags & 0x001F );
+ currentInsertList = (FT_Byte) ( glyphOffset.ul >> 16 );
+ markedInsertList = (FT_UShort)( glyphOffset.ul );
if ( currentInsertList && 0 != currentInsertCount )
gxv_morx_subtable_type5_InsertList_validate( currentInsertList,
diff --git a/src/gxvalid/gxvopbd.c b/src/gxvalid/gxvopbd.c
index 12a21d4..bccc59b 100644
--- a/src/gxvalid/gxvopbd.c
+++ b/src/gxvalid/gxvopbd.c
@@ -141,8 +141,8 @@
FT_UNUSED( lookuptbl_limit );
FT_UNUSED( valid );
-
- value.u = base_value.u + relative_gindex * 4 * sizeof ( FT_Short );
+ /* XXX: check range ? */
+ value.u = (FT_UShort)(base_value.u + relative_gindex * 4 * sizeof ( FT_Short ));
return value;
}
diff --git a/src/gxvalid/gxvprop.c b/src/gxvalid/gxvprop.c
index b5211f1..7911d48 100644
--- a/src/gxvalid/gxvprop.c
+++ b/src/gxvalid/gxvprop.c
@@ -117,17 +117,17 @@
char complement;
- offset = property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET;
+ offset = (FT_UShort)(property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET);
if ( offset == 0 )
FT_INVALID_DATA;
- complement = offset >> 8;
+ complement = (char)(offset >> 8);
if ( complement & 0x08 )
{
/* Top bit is set: negative */
/* Calculate the absolute offset */
- complement = ( complement & 0x07 ) + 1;
+ complement = (char)(( complement & 0x07 ) + 1);
/* The gid for complement must be greater than 0 */
if ( glyph <= complement )
@@ -136,7 +136,7 @@
else
{
/* The gid for complement must be the face. */
- gxv_glyphid_validate( glyph + complement, valid );
+ gxv_glyphid_validate( (FT_UShort)(glyph + complement), valid );
}
}
else
@@ -213,8 +213,8 @@
FT_UShort offset;
GXV_LookupValueDesc value;
-
- offset = base_value.u + relative_gindex * sizeof( FT_UShort );
+ /* XXX: check range ? */
+ offset = (FT_UShort)(base_value.u + relative_gindex * sizeof( FT_UShort ));
p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit;
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index a282681..2c6f347 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -318,12 +318,6 @@
{
FT_UNUSED( module );
- if ( ft_strcmp( module_interface, "get_sfnt" ) == 0 )
- return (FT_Module_Interface)get_sfnt_table;
-
- if ( ft_strcmp( module_interface, "load_sfnt" ) == 0 )
- return (FT_Module_Interface)tt_face_load_any;
-
return ft_service_list_lookup( sfnt_services, module_interface );
}
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 1c00866..754ff00 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -762,6 +762,8 @@
TT_GlyphZone zone = &loader->zone;
FT_Pos origin;
+ FT_UNUSED(is_composite);
+
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
FT_UInt n_ins;
@@ -944,11 +946,11 @@
FT_UInt num_points = gloader->base.outline.n_points;
FT_Bool have_scale;
FT_Pos x, y;
-
- have_scale = subglyph->flags & ( WE_HAVE_A_SCALE |
- WE_HAVE_AN_XY_SCALE |
- WE_HAVE_A_2X2 );
+
+ have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE |
+ WE_HAVE_AN_XY_SCALE |
+ WE_HAVE_A_2X2 ) );
/* perform the transform required for this subglyph */
if ( have_scale )