bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnu-libiconv] libiconv-1.13 on Interix 3.5 with fixes


From: Jay
Subject: [bug-gnu-libiconv] libiconv-1.13 on Interix 3.5 with fixes
Date: Sat, 20 Jun 2009 09:51:02 +0000

libiconv-1.13 on Interix 3.5:
 
In file included from /src/libiconv-1.13/lib/iconv.c:234:
/src/libiconv-1.13/lib/iconv_open2.h: In function `libiconv_open':
/src/libiconv-1.13/lib/iconv_open2.h:85: error: structure has no member named `state'
/src/libiconv-1.13/lib/iconv_open2.h:85: error: `mbstate_t' undeclared (first use in this function)
/src/libiconv-1.13/lib/iconv_open2.h:85: error: (Each undeclared identifier is reported only once
/src/libiconv-1.13/lib/iconv_open2.h:85: error: for each function it appears in.)
In file included from /src/libiconv-1.13/lib/iconv.c:290:
/src/libiconv-1.13/lib/iconv_open2.h: In function `libiconv_open_into':
/src/libiconv-1.13/lib/iconv_open2.h:85: error: structure has no member named `state'
/src/libiconv-1.13/lib/iconv_open2.h:85: error: `mbstate_t' undeclared (first use in this function)
 
 
Interix does not appear to have mbrtowc or wctombr.
 
It does have __mbstate_t in sys/types.h and mbstate_t in wchar.h, if that is relevant.
 
libiconv's loop_wchar.h.
/*
* The first two conversion loops have an extended conversion descriptor.
*/
struct wchar_conv_struct {
struct conv_struct parent;
#if HAVE_WCRTOMB || HAVE_MBRTOWC
mbstate_t state;
#endif
};
 
 
it follows therefore:
 
 
C:\src\libiconv-1.13\lib>diff -u iconv_open2.h.orig iconv_open2.h
--- iconv_open2.h.orig 2009-06-20 02:45:24.468750000 -0700
+++ iconv_open2.h 2009-06-20 02:45:27.546875000 -0700
@@ -79,9 +79,11 @@
cd->hooks.wc_hook = NULL;
cd->hooks.data = ""> #endif
+#if HAVE_WCRTOMB || HAVE_MBRTOWC
/* Initialize additional fields. */
if (from_wchar != to_wchar) {
struct wchar_conv_struct * wcd = (struct wchar_conv_struct *) cd;
memset(&wcd->state,'\0',sizeof(mbstate_t));
}
+#endif
/* Done. */
 
 
 
or maybe simpler to just:
 
 
iconv_t iconv_open (const char* tocode, const char* fromcode)
{
struct conv_struct * cd;
unsigned int from_index;
int from_wchar;
unsigned int to_index;
int to_wchar;
int transliterate;
int discard_ilseq;
#include "iconv_open1.h"
 
< cd = (struct conv_struct *) malloc(from_wchar != to_wchar
> cd = (struct conv_struct *) calloc(1, from_wchar != to_wchar
 
? sizeof(struct wchar_conv_struct)
: sizeof(struct conv_struct));
if (cd == NULL) {
errno = ENOMEM;
return (iconv_t)(-1);
}
#include "iconv_open2.h"
return (iconv_t)cd;
invalid:
errno = EINVAL;
return (iconv_t)(-1);
}
 
 
 
and then remove all the explicit field by field zeroing?
 
 
- Jay
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]