djcsdy / swfmill

Generate or decompile Adobe Flash SWF files using an XML dialect. Inspect and modify the XML by hand, or by using a built in XSLT processor.
http://www.swfmill.org/
GNU General Public License v2.0
131 stars 28 forks source link

Do not compare iconv_open result to zero #42

Closed fxcoudert closed 6 years ago

fxcoudert commented 6 years ago

Ordered comparison of iconv_t (which is, behind the scenes, a void *) with zero fails with recent clang, such as in Xcode 9 on macOS 10.13 (the system's default compiler).

The standards clearly state that:

Upon successful completion, iconv_open() returns a conversion descriptor for use on subsequent calls to iconv(). Otherwise iconv_open() returns (iconv_t)-1 and sets errno to indicate the error.

Thus the check for error is not cd < 0 but cd == (iconv_t)-1.

djcsdy commented 6 years ago

Thanks!