caryll / otfcc

Optimized OpenType builder and inspector.
Apache License 2.0
422 stars 63 forks source link

Integer precision #17

Closed schriftgestalt closed 8 years ago

schriftgestalt commented 8 years ago

The code compiles fine with Xcode/clang in 64 bit mode. But it produces a lot warnings because the code mixes definitions of size_t and uint32_t. On 32 bit both are the same so that would not show up as a problem.

be5invis commented 8 years ago

@schriftgestalt Could you please show me the messages? I have a compile script using Clang-cl and it produces no error or warning.

schriftgestalt commented 8 years ago

..otfcc/src/extern/sds.h ..otfcc/src/extern/sds.h:144:34: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/extern/sds.h:208:36: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/support/util.h ..otfcc/src/support/util.h:79:53: Implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'int32_t' (aka 'int') ..otfcc/src/support/util.h:103:53: Implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'int32_t' (aka 'int') ..otfcc/src/support/util.h:133:32: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/support/util.h:146:15: Implicit conversion loses integer precision: 'int64_t' (aka 'long long') to 'int' ..otfcc/src/support/ttinstr.c ..otfcc/src/support/ttinstr.c:309:36: Implicit conversion loses integer precision: 'unsigned long' to 'int' ..otfcc/src/support/ttinstr.c:317:11: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:319:68: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:333:63: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:335:78: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:345:61: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:354:16: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:361:45: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:366:42: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:398:48: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:403:56: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:404:10: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:409:16: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:413:58: Implicit conversion loses integer precision: 'long' to 'int' ..otfcc/src/support/ttinstr.c:484:33: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/support/ttinstr.c:517:31: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/tables/CFF/cff_parser.c ..otfcc/src/tables/CFF/cff_parser.c:498:22: Implicit conversion loses integer precision: 'long' to 'uint32_t' (aka 'unsigned int') ..otfcc/src/tables/otl/gsub-ligature.c ..otfcc/src/tables/otl/gsub-ligature.c:91:56: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/tables/name.c ..otfcc/src/tables/name.c:70:43: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/tables/otl/gpos-mark-to-single.c ..otfcc/src/tables/otl/gpos-mark-to-single.c:88:43: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/tables/otl/gpos-mark-to-single.c:102:36: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/extern/json.c ..otfcc/src/extern/json.c:920:11: Variable 'root' may be uninitialized when used here ..otfcc/src/tables/otl/gpos-mark-to-ligature.c ..otfcc/src/tables/otl/gpos-mark-to-ligature.c:109:43: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/tables/otl/gpos-mark-to-ligature.c:126:35: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/extern/emyg-dtoa/emyg-dtoa.c ..otfcc/src/extern/emyg-dtoa/emyg-dtoa.c:73:43: Implicit conversion loses integer precision: 'unsigned long long' to 'int' ..otfcc/src/tables/cvt.c ..otfcc/src/tables/cvt.c:53:19: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/font/caryll-sfnt-builder.c ..otfcc/src/font/caryll-sfnt-builder.c:14:26: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/font/caryll-sfnt-builder.c:28:18: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/font/caryll-sfnt-builder.c:94:23: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/extern/sds.c ..otfcc/src/extern/sds.c:117:23: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/extern/sds.c:118:25: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/extern/sds.c:174:19: Implicit conversion loses integer precision: 'unsigned long' to 'int' ..otfcc/src/extern/sds.c:456:12: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' ..otfcc/src/extern/sds.c:485:12: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' ..otfcc/src/extern/sds.c:586:9: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' ..otfcc/src/extern/sds.c:718:20: Implicit conversion loses integer precision: 'unsigned long' to 'int' ..otfcc/src/extern/sds.c:722:18: Implicit conversion loses integer precision: 'unsigned long' to 'int' ..otfcc/src/extern/sds.c:730:22: Implicit conversion loses integer precision: 'unsigned long' to 'int' ..otfcc/src/extern/sds.c:743:15: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' ..otfcc/src/extern/sds.c:750:15: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' ..otfcc/src/extern/sds.c:774:28: Implicit conversion loses integer precision: 'unsigned long' to 'int' ..otfcc/src/tables/glyf.c ..otfcc/src/tables/glyf.c:400:43: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/tables/glyf.c:486:37: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/tables/glyf.c:861:22: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/tables/glyf.c:873:39: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/tables/cmap.c ..otfcc/src/tables/cmap.c:118:43: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' ..otfcc/src/tables/cmap.c:305:19: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') ..otfcc/src/tables/CFF/cff_codecs.c ..otfcc/src/tables/CFF/cff_codecs.c:259:22: Implicit conversion loses integer precision: 'long' to 'uint32_t' (aka 'unsigned int') ..otfcc/src/extern/json-builder.c ..otfcc/src/extern/json-builder.c:176:41: Implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' ..otfcc/src/extern/json-builder.c:232:32: Implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' ..otfcc/src/extern/json-builder.c:359:85: Implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' ..otfcc/src/tables/otl/otl.c ..otfcc/src/tables/otl/otl.c:721:58: Implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int')

be5invis commented 8 years ago

@schriftgestalt I've updated to eliminate implicit conversions in my own code. These narrowing conversions are intentional, and most of them are related to put a size_t into some sort of offsets. The dependencies are not modified. You can checkout the latest commit in cff/.

be5invis commented 8 years ago

ps. I always use -Wall in daily testing, and Clang 3.8’s -Wall does not have -Wshorten-64-to-32.

be5invis commented 8 years ago

Closed due to inactivity.