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

[Libguestfs] [PATCH 1/2] normalize iconv handling



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.

(This is a reduced version of 57512e778558c5b93cfa360c83836c2cf8fc5908
in libguestfs.)
---
 bootstrap   | 1 +
 lib/utf16.c | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bootstrap b/bootstrap
index b2960c1..bd82477 100755
--- a/bootstrap
+++ b/bootstrap
@@ -63,6 +63,7 @@ full-write
 gitlog-to-changelog
 gnu-make
 gnumakefile
+iconv
 ignore-value
 inttypes
 maintainer-makefile
diff --git a/lib/utf16.c b/lib/utf16.c
index 7d275fd..fe2c3bd 100644
--- a/lib/utf16.c
+++ b/lib/utf16.c
@@ -54,8 +54,7 @@ _hivex_recode (const char *input_encoding, const char *input, size_t input_len,
   const char *inp = input;
   char *outp = out;
 
-  /* Surely iconv doesn't really modify the input buffer? XXX */
-  size_t r = iconv (ic, (char **) &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


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