wrowe 2002/07/19 01:32:56
Modified: xlate xlate.c
include apr_xlate.h apu.h.in apu.hnw apu.hw
Log:
A Fuggly patch to get things moving along. Define iconv_() as a wrapper
to prefix apr_iconv or iconv as appropriate based on APR_HAS_APR_ICONV.
Not even trying to teach Unix about APR_HAS_APR_ICONV right now.
Revision Changes Path
1.6 +20 -13 apr-util/xlate/xlate.c
Index: xlate.c
===================================================================
RCS file: /home/cvs/apr-util/xlate/xlate.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- xlate.c 18 Jul 2002 06:08:35 -0000 1.5
+++ xlate.c 19 Jul 2002 08:32:56 -0000 1.6
@@ -79,12 +79,19 @@
#include <iconv.h>
#endif
-#ifdef APR_ICONV_INBUF_CONST
+#if defined(APR_ICONV_INBUF_CONST) || APR_HAS_APR_ICONV
#define ICONV_INBUF_TYPE const char **
#else
#define ICONV_INBUF_TYPE char **
#endif
+#if APR_HAS_APR_ICONV
+#define HAVE_ICONV
+#define iconv_(n) apr_iconv_##n
+#else
+#define iconv_(n) iconv_##n
+#endif
+
#ifndef min
#define min(x,y) ((x) <= (y) ? (x) : (y))
#endif
@@ -95,7 +102,7 @@
char *topage;
char *sbcs_table;
#ifdef HAVE_ICONV
- iconv_t ich;
+ iconv_(_t) ich;
#endif
};
@@ -175,8 +182,8 @@
#ifdef HAVE_ICONV
apr_xlate_t *old = convset;
- if (old->ich != (iconv_t)-1) {
- if (iconv_close(old->ich)) {
+ if (old->ich != (iconv_(_t))-1) {
+ if (iconv_(_close)(old->ich)) {
int rv = errno;
/* Sometimes, iconv is not good about setting errno. */
return rv ? rv : EINVAL;
@@ -201,7 +208,7 @@
}
inbytes_left = outbytes_left = sizeof(inbuf);
- translated = iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr,
+ translated = iconv_()(convset->ich, (ICONV_INBUF_TYPE)&inbufptr,
&inbytes_left, &outbufptr, &outbytes_left);
if (translated != (apr_size_t) -1 &&
inbytes_left == 0 &&
@@ -212,8 +219,8 @@
convset->sbcs_table = apr_palloc(convset->pool, sizeof(outbuf));
memcpy(convset->sbcs_table, outbuf, sizeof(outbuf));
- iconv_close(convset->ich);
- convset->ich = (iconv_t)-1;
+ iconv_(_close)(convset->ich);
+ convset->ich = (iconv_(_t))-1;
/* TODO: add the table to the cache */
}
@@ -270,8 +277,8 @@
#ifdef HAVE_ICONV
if (!found) {
- new->ich = iconv_open(topage, frompage);
- if (new->ich == (iconv_t)-1) {
+ new->ich = iconv_(_open)(topage, frompage);
+ if (new->ich == (iconv_(_t))-1) {
int rv = errno;
/* Sometimes, iconv is not good about setting errno. */
return rv ? rv : EINVAL;
@@ -279,7 +286,7 @@
found = 1;
check_sbcs(new);
} else
- new->ich = (iconv_t)-1;
+ new->ich = (iconv_(_t))-1;
#endif /* HAVE_ICONV */
if (found) {
@@ -296,7 +303,7 @@
return status;
}
-apr_status_t apr_xlate_sb_get(apr_xlate_t *convset, int *onoff)
+APU_DECLARE(apr_status_t) apr_xlate_sb_get(apr_xlate_t *convset, int *onoff)
{
*onoff = convset->sbcs_table != NULL;
return APR_SUCCESS;
@@ -312,11 +319,11 @@
#ifdef HAVE_ICONV
apr_size_t translated;
- if (convset->ich != (iconv_t)-1) {
+ if (convset->ich != (iconv_(_t))-1) {
const char *inbufptr = inbuf;
char *outbufptr = outbuf;
- translated = iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr,
+ translated = iconv_()(convset->ich, (ICONV_INBUF_TYPE)&inbufptr,
inbytes_left, &outbufptr, outbytes_left);
/* If everything went fine but we ran out of buffer, don't
* report it as an error. Caller needs to look at the two
1.3 +0 -9 apr-util/include/apr_xlate.h
Index: apr_xlate.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_xlate.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- apr_xlate.h 17 Jul 2002 05:24:04 -0000 1.2
+++ apr_xlate.h 19 Jul 2002 08:32:56 -0000 1.3
@@ -74,15 +74,6 @@
* @{
*/
-/**
- * APR_HAS_XLATE determines whether or not useful implementations of
- * apr_xlate_open() et al are provided.
- *
- * If APR_HAS_XLATE is zero, apr_xlate_open() et al will all return
- * APR_ENOTIMPL at run-time.
- */
-#define APR_HAS_XLATE APR_HAVE_ICONV
-
typedef struct apr_xlate_t apr_xlate_t;
/**
1.13 +2 -0 apr-util/include/apu.h.in
Index: apu.h.in
===================================================================
RCS file: /home/cvs/apr-util/include/apu.h.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- apu.h.in 13 Mar 2002 20:40:48 -0000 1.12
+++ apu.h.in 19 Jul 2002 08:32:56 -0000 1.13
@@ -123,6 +123,8 @@
#endif
#endif
+#define APU_HAVE_APR_ICONV 0
+#define APR_HAS_XLATE APR_HAVE_ICONV
#endif /* APU_H */
/** @} */
1.4 +2 -0 apr-util/include/apu.hnw
Index: apu.hnw
===================================================================
RCS file: /home/cvs/apr-util/include/apu.hnw,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apu.hnw 13 Mar 2002 20:40:48 -0000 1.3
+++ apu.hnw 19 Jul 2002 08:32:56 -0000 1.4
@@ -123,6 +123,8 @@
#endif
#endif
+#define APU_HAVE_APR_ICONV 0
+#define APR_HAS_XLATE APR_HAVE_ICONV
#endif /* APU_H */
/** @} */
1.8 +2 -0 apr-util/include/apu.hw
Index: apu.hw
===================================================================
RCS file: /home/cvs/apr-util/include/apu.hw,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- apu.hw 13 Mar 2002 20:40:48 -0000 1.7
+++ apu.hw 19 Jul 2002 08:32:56 -0000 1.8
@@ -154,6 +154,8 @@
#endif
#endif
+#define APU_HAVE_APR_ICONV 1
+#define APR_HAS_XLATE 1
#endif /* APU_H */
#endif /* WIN32 */