Skip to content

Commit fc72e08

Browse files
committed
Fix compilation with uclibc
The patch fixes the following errors and warnings raised by the compilation of the library with uClibc: encoding.c: In function ‘xmlEncInputChunk’: encoding.c:2209:32: warning: comparison between pointer and integer 2209 | else if (handler->iconv_in != NULL) { | ^~ encoding.c: In function ‘xmlEncOutputChunk’: encoding.c:2269:33: warning: comparison between pointer and integer 2269 | else if (handler->iconv_out != NULL) { | ^~ encoding.c: In function ‘xmlCharEncCloseFunc’: encoding.c:2681:29: warning: comparison between pointer and integer 2681 | if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) { | ^~ encoding.c:2681:60: warning: comparison between pointer and integer 2681 | if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) { | ^~ encoding.c:2683:32: warning: comparison between pointer and integer 2683 | if (handler->iconv_out != NULL) { | ^~ encoding.c:2686:32: error: assignment to ‘iconv_t’ {aka ‘long int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion] 2686 | handler->iconv_out = NULL; | ^ encoding.c:2688:31: warning: comparison between pointer and integer 2688 | if (handler->iconv_in != NULL) { | ^~ encoding.c:2691:31: error: assignment to ‘iconv_t’ {aka ‘long int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion] 2691 | handler->iconv_in = NULL; | ^ make[4]: *** [Makefile:1147: libxml2_la-encoding.lo] Error 1 Signed-off-by: Dario Binacchi <[email protected]>
1 parent 110e44e commit fc72e08

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

encoding.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ DECLARE_ISO_FUNCS(16)
12641264
#endif /* LIBXML_ISO8859X_ENABLED */
12651265

12661266
#ifdef LIBXML_ICONV_ENABLED
1267-
#define EMPTY_ICONV , (iconv_t) 0, (iconv_t) 0
1267+
#define EMPTY_ICONV , (iconv_t) -1, (iconv_t) -1
12681268
#else
12691269
#define EMPTY_ICONV
12701270
#endif
@@ -1389,8 +1389,8 @@ xmlNewCharEncodingHandler(const char *name,
13891389
handler->name = up;
13901390

13911391
#ifdef LIBXML_ICONV_ENABLED
1392-
handler->iconv_in = NULL;
1393-
handler->iconv_out = NULL;
1392+
handler->iconv_in = (iconv_t) -1;
1393+
handler->iconv_out = (iconv_t) -1;
13941394
#endif
13951395
#ifdef LIBXML_ICU_ENABLED
13961396
handler->uconv_in = NULL;
@@ -2200,7 +2200,7 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
22002200
}
22012201
}
22022202
#ifdef LIBXML_ICONV_ENABLED
2203-
else if (handler->iconv_in != NULL) {
2203+
else if (handler->iconv_in != (iconv_t) -1) {
22042204
ret = xmlIconvWrapper(handler->iconv_in, out, outlen, in, inlen);
22052205
}
22062206
#endif /* LIBXML_ICONV_ENABLED */
@@ -2260,7 +2260,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
22602260
}
22612261
}
22622262
#ifdef LIBXML_ICONV_ENABLED
2263-
else if (handler->iconv_out != NULL) {
2263+
else if (handler->iconv_out != (iconv_t) -1) {
22642264
ret = xmlIconvWrapper(handler->iconv_out, out, outlen, in, inlen);
22652265
}
22662266
#endif /* LIBXML_ICONV_ENABLED */
@@ -2672,17 +2672,17 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
26722672
* Iconv handlers can be used only once, free the whole block.
26732673
* and the associated icon resources.
26742674
*/
2675-
if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
2675+
if ((handler->iconv_out != (iconv_t) -1) || (handler->iconv_in != (iconv_t) -1)) {
26762676
tofree = 1;
2677-
if (handler->iconv_out != NULL) {
2677+
if (handler->iconv_out != (iconv_t) -1) {
26782678
if (iconv_close(handler->iconv_out))
26792679
ret = -1;
2680-
handler->iconv_out = NULL;
2680+
handler->iconv_out = (iconv_t) -1;
26812681
}
2682-
if (handler->iconv_in != NULL) {
2682+
if (handler->iconv_in != (iconv_t) -1) {
26832683
if (iconv_close(handler->iconv_in))
26842684
ret = -1;
2685-
handler->iconv_in = NULL;
2685+
handler->iconv_in = (iconv_t) -1;
26862686
}
26872687
}
26882688
#endif /* LIBXML_ICONV_ENABLED */

0 commit comments

Comments
 (0)