aboutsummaryrefslogtreecommitdiffstats
path: root/src/utf8.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-02-05 10:17:33 +0000
committerEric Wong <normalperson@yhbt.net>2008-02-05 10:17:33 +0000
commit6fbdc721d972d8c1f823acd5473a3dce8836d5fa (patch)
treee72131541f4e887d5dedd6c75ffce455cbf6b97c /src/utf8.c
parent22efbd5eca4705426af5cee17a65a3e76c33bec6 (diff)
downloadmpd-6fbdc721d972d8c1f823acd5473a3dce8836d5fa.tar.gz
mpd-6fbdc721d972d8c1f823acd5473a3dce8836d5fa.tar.xz
mpd-6fbdc721d972d8c1f823acd5473a3dce8836d5fa.zip
fix -Wconst warnings
[ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/utf8.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/utf8.c b/src/utf8.c
index d7b1503c3..f0d6b3b11 100644
--- a/src/utf8.c
+++ b/src/utf8.c
@@ -20,10 +20,10 @@
#include "utils.h"
#include "os_compat.h"
-char *latin1_to_utf8(char *dest, char *in_latin1)
+char *latin1_to_utf8(char *dest, const char *in_latin1)
{
unsigned char *cp = (unsigned char *)dest;
- unsigned char *latin1 = (unsigned char *)in_latin1;
+ const unsigned char *latin1 = (const unsigned char *)in_latin1;
while (*latin1) {
if (*latin1 < 128)
@@ -45,7 +45,7 @@ char *latin1_to_utf8(char *dest, char *in_latin1)
return dest;
}
-char *latin1StrToUtf8Dup(char *latin1)
+char *latin1StrToUtf8Dup(const char *latin1)
{
/* utf8 should have at most two char's per latin1 char */
char *ret = xmalloc(strlen(latin1) * 2 + 1);
@@ -55,10 +55,10 @@ char *latin1StrToUtf8Dup(char *latin1)
return ((ret) ? xrealloc(ret, strlen((char *)ret) + 1) : NULL);
}
-static char utf8_to_latin1_char(char *inUtf8)
+static char utf8_to_latin1_char(const char *inUtf8)
{
unsigned char c = 0;
- unsigned char *utf8 = (unsigned char *)inUtf8;
+ const unsigned char *utf8 = (const unsigned char *)inUtf8;
if (utf8[0] < 128)
return utf8[0];
@@ -69,9 +69,9 @@ static char utf8_to_latin1_char(char *inUtf8)
return (char)(c + utf8[1]);
}
-static int validateUtf8Char(char *inUtf8Char)
+static int validateUtf8Char(const char *inUtf8Char)
{
- unsigned char *utf8Char = (unsigned char *)inUtf8Char;
+ const unsigned char *utf8Char = (const unsigned char *)inUtf8Char;
if (utf8Char[0] < 0x80)
return 1;
@@ -95,7 +95,7 @@ static int validateUtf8Char(char *inUtf8Char)
return 0;
}
-int validUtf8String(char *string)
+int validUtf8String(const char *string)
{
int ret;
@@ -109,7 +109,7 @@ int validUtf8String(char *string)
return 1;
}
-char *utf8StrToLatin1Dup(char *utf8)
+char *utf8StrToLatin1Dup(const char *utf8)
{
/* utf8 should have at most two char's per latin1 char */
char *ret = xmalloc(strlen(utf8) + 1);
@@ -133,7 +133,7 @@ char *utf8StrToLatin1Dup(char *utf8)
return xrealloc(ret, len + 1);
}
-char *utf8_to_latin1(char *dest, char *utf8)
+char *utf8_to_latin1(char *dest, const char *utf8)
{
char *cp = dest;
int count;