[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] Strict compiler warns at gxvmort2.c
From: |
suzuki toshiya |
Subject: |
Re: [ft-devel] Strict compiler warns at gxvmort2.c |
Date: |
Tue, 06 Dec 2011 21:59:38 +0900 |
User-agent: |
Mozilla-Thunderbird 2.0.0.12 (X11/20080406) |
Dear Antoine,
Thank you for finding the issue, I think the issue may cause the errors
reported by Sean McBride with clang. I have to fix the signedness issue.
Regards,
mpsuzuki
Antoine Leca wrote:
> Hi Toshiya-san,
>
> Microsoft's compiler bails out while compiling src/gxvalid/gxvalid.c
> cl /Za /D_CRT_SECURE_NO_DEPRECATE /Iobjs /I..\freetype2\builds\win32
> /I..\freetype2\include /nologo /c /Ox /W3 /WX /DFT2_BUILD_LIBRARY
> /DFT_CONFIG_MODULES_H="<ftmodule.h>" /I..\freetype2\src\gxvalid
> /Foobjs\gxvalid.obj ..\freetype2\src\gxvalid\gxvalid.c
> gxvalid.c
> C:\Users\FT\freetype2\src\gxvalid\gxvmort2.c(195) : error C2220: warning
> treated as error - no object file generated
> C:\Users\FT\freetype2\src\gxvalid\gxvmort2.c(195) : warning C4018: '>' :
> signed/unsigned mismatch
> mingw32-make.exe: *** [objs/gxvalid.obj] Error 2
>
> A quick look shows this is caused by the combination of
> typedef struct GXV_mort_subtable_type2_StateOptRec_
> { /* ... */
> FT_UShort ligatureTable;
> FT_UShort ligActionTable_length;
>
> and the actual code
> FT_ULong offset;
> /* ... */
> } else if ( offset * 2 >
> optdata->ligatureTable + optdata->ligatureTable_length )
>
> The warning is pretty strict but highlights a potential problem on a
> 16-bit target (the sum can overflow, so being a very big negative, which
> will trigger the test in a wrong way.)
>
> I added a cast (to FT_ULong) to avoid the problem.
>
> While I was here, I fixed a number of issues with the printf
> specifications in the same area of code; I am not sure this is really
> needed since I guess there are a lot of similar mismatches through the
> codebase (any comments this about?)
>
>
> Antoine
>