@@ -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 ;
@@ -1641,6 +1641,10 @@ xmlCreateUconvHandler(const char *name, xmlCharEncodingHandler **out) {
16411641 }
16421642 enc -> input = NULL ;
16431643 enc -> output = NULL ;
1644+ #ifdef LIBXML_ICONV_ENABLED
1645+ enc -> iconv_in = (iconv_t ) - 1 ;
1646+ enc -> iconv_out = (iconv_t ) - 1 ;
1647+ #endif
16441648 enc -> uconv_in = ucv_in ;
16451649 enc -> uconv_out = ucv_out ;
16461650
@@ -2200,7 +2204,7 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
22002204 }
22012205 }
22022206#ifdef LIBXML_ICONV_ENABLED
2203- else if (handler -> iconv_in != NULL ) {
2207+ else if (handler -> iconv_in != ( iconv_t ) - 1 ) {
22042208 ret = xmlIconvWrapper (handler -> iconv_in , out , outlen , in , inlen );
22052209 }
22062210#endif /* LIBXML_ICONV_ENABLED */
@@ -2260,7 +2264,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
22602264 }
22612265 }
22622266#ifdef LIBXML_ICONV_ENABLED
2263- else if (handler -> iconv_out != NULL ) {
2267+ else if (handler -> iconv_out != ( iconv_t ) - 1 ) {
22642268 ret = xmlIconvWrapper (handler -> iconv_out , out , outlen , in , inlen );
22652269 }
22662270#endif /* LIBXML_ICONV_ENABLED */
@@ -2672,17 +2676,17 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
26722676 * Iconv handlers can be used only once, free the whole block.
26732677 * and the associated icon resources.
26742678 */
2675- if ((handler -> iconv_out != NULL ) || (handler -> iconv_in != NULL )) {
2679+ if ((handler -> iconv_out != ( iconv_t ) - 1 ) || (handler -> iconv_in != ( iconv_t ) - 1 )) {
26762680 tofree = 1 ;
2677- if (handler -> iconv_out != NULL ) {
2681+ if (handler -> iconv_out != ( iconv_t ) - 1 ) {
26782682 if (iconv_close (handler -> iconv_out ))
26792683 ret = -1 ;
2680- handler -> iconv_out = NULL ;
2684+ handler -> iconv_out = ( iconv_t ) - 1 ;
26812685 }
2682- if (handler -> iconv_in != NULL ) {
2686+ if (handler -> iconv_in != ( iconv_t ) - 1 ) {
26832687 if (iconv_close (handler -> iconv_in ))
26842688 ret = -1 ;
2685- handler -> iconv_in = NULL ;
2689+ handler -> iconv_in = ( iconv_t ) - 1 ;
26862690 }
26872691 }
26882692#endif /* LIBXML_ICONV_ENABLED */
0 commit comments