[Libguestfs] [PATCH 07/16] normalize iconv handling

Pino Toscano ptoscano at redhat.com
Thu Oct 23 18:18:35 UTC 2014


Since the signature of iconv() changes between implementations (the
constness of the second parameter, in particular), make use of the iconv
module of gnulib to handle these potential differences, including an
external (out of libc) iconv implementation.
---
 bootstrap                | 1 +
 src/Makefile.am          | 1 +
 src/inspect-fs-windows.c | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/bootstrap b/bootstrap
index b7a45ff..402ac4e 100755
--- a/bootstrap
+++ b/bootstrap
@@ -64,6 +64,7 @@ gnumakefile
 hash
 hash-pjw
 human
+iconv
 ignore-value
 lock
 maintainer-makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 3d06203..e717251 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -161,6 +161,7 @@ libguestfs_la_LIBADD = \
 	$(LIB_CLOCK_GETTIME) \
 	$(LIBINTL) \
 	$(LTLIBTHREAD) \
+	$(LTLIBICONV) \
 	$(SERVENT_LIB)
 
 # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index 6d430d1..619706c 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -669,7 +669,7 @@ utf16_to_utf8 (/* const */ char *input, size_t len)
   char *inp = input;
   char *outp = out;
 
-  size_t r = iconv (ic, &inp, &inlen, &outp, &outlen);
+  size_t r = iconv (ic, (ICONV_CONST char **) &inp, &inlen, &outp, &outlen);
   if (r == (size_t) -1) {
     if (errno == E2BIG) {
       int err = errno;
-- 
1.9.3




More information about the Libguestfs mailing list