aboutsummaryrefslogtreecommitdiffstats
path: root/src/charConv.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-01 20:13:37 -0700
committerEric Wong <normalperson@yhbt.net>2008-09-01 20:13:37 -0700
commitdd7f8a723efa9c9edce951981aef7f3adf814134 (patch)
tree1c442a63c257f53d0e3f1ff127b98e682c35c4d5 /src/charConv.c
parentcf1f842a4c8f760c4c6a41f0dadc6c173a182d4f (diff)
parent925843cfedcde221207ec1ab78f778dab22325f9 (diff)
downloadmpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.gz
mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.xz
mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.zip
Merge branch 'ew/deconst'
* ew/deconst: use deconst_ptr instead of duplicating deconst logic provide a generic deconst_ptr function
Diffstat (limited to '')
-rw-r--r--src/charConv.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/charConv.c b/src/charConv.c
index c205e93e4..60bcc655a 100644
--- a/src/charConv.c
+++ b/src/charConv.c
@@ -95,22 +95,6 @@ int setCharSetConversion(const char *to, const char *from)
#endif
}
-#ifdef HAVE_ICONV
-static inline size_t deconst_iconv(iconv_t cd,
- const char **inbuf, size_t *inbytesleft,
- char **outbuf, size_t *outbytesleft)
-{
- union {
- const char **a;
- char **b;
- } deconst;
-
- deconst.a = inbuf;
-
- return iconv(cd, deconst.b, inbytesleft, outbuf, outbytesleft);
-}
-#endif
-
char *char_conv_str(char *dest, const char *string)
{
if (!char_conv_to)
@@ -132,11 +116,12 @@ char *char_conv_str(char *dest, const char *string)
dest[0] = '\0';
while (inleft) {
+ char *inbuf = deconst_ptr(string);
+
bufferPtr = buffer;
outleft = BUFFER_SIZE;
- err =
- deconst_iconv(char_conv_iconv, &string, &inleft,
- &bufferPtr, &outleft);
+ err = iconv(char_conv_iconv, &inbuf,
+ &inleft, &bufferPtr, &outleft);
if (outleft == BUFFER_SIZE
|| (err == (size_t)-1L && errno != E2BIG)) {
return NULL;