summaryrefslogtreecommitdiff
path: root/lib/iconv_open.c
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:15 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:15 +0200
commit3e0814cd9862b89c7a39672672937477bd87ddfb (patch)
tree159134a624e51509f40ed8823249f09a70d1dda3 /lib/iconv_open.c
parent3bebb94360f1c2333feb8d504a9fa4f96984d8b7 (diff)
Imported Upstream version 0.9.3upstream/0.9.3
Diffstat (limited to 'lib/iconv_open.c')
-rw-r--r--lib/iconv_open.c87
1 files changed, 44 insertions, 43 deletions
diff --git a/lib/iconv_open.c b/lib/iconv_open.c
index 3d873acd..1d1c0536 100644
--- a/lib/iconv_open.c
+++ b/lib/iconv_open.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -36,6 +36,7 @@
#define ICONV_FLAVOR_HPUX "iconv_open-hpux.h"
#define ICONV_FLAVOR_IRIX "iconv_open-irix.h"
#define ICONV_FLAVOR_OSF "iconv_open-osf.h"
+#define ICONV_FLAVOR_SOLARIS "iconv_open-solaris.h"
#ifdef ICONV_FLAVOR
# include ICONV_FLAVOR
@@ -66,33 +67,33 @@ rpl_iconv_open (const char *tocode, const char *fromcode)
&& fromcode[3] == '-')
{
if (c_toupper (tocode[0]) == 'U'
- && c_toupper (tocode[1]) == 'T'
- && c_toupper (tocode[2]) == 'F'
- && tocode[3] == '-')
- {
- if (strcmp (fromcode + 4, "8") == 0)
- {
- if (c_strcasecmp (tocode + 4, "16BE") == 0)
- return _ICONV_UTF8_UTF16BE;
- if (c_strcasecmp (tocode + 4, "16LE") == 0)
- return _ICONV_UTF8_UTF16LE;
- if (c_strcasecmp (tocode + 4, "32BE") == 0)
- return _ICONV_UTF8_UTF32BE;
- if (c_strcasecmp (tocode + 4, "32LE") == 0)
- return _ICONV_UTF8_UTF32LE;
- }
- else if (strcmp (tocode + 4, "8") == 0)
- {
- if (c_strcasecmp (fromcode + 4, "16BE") == 0)
- return _ICONV_UTF16BE_UTF8;
- if (c_strcasecmp (fromcode + 4, "16LE") == 0)
- return _ICONV_UTF16LE_UTF8;
- if (c_strcasecmp (fromcode + 4, "32BE") == 0)
- return _ICONV_UTF32BE_UTF8;
- if (c_strcasecmp (fromcode + 4, "32LE") == 0)
- return _ICONV_UTF32LE_UTF8;
- }
- }
+ && c_toupper (tocode[1]) == 'T'
+ && c_toupper (tocode[2]) == 'F'
+ && tocode[3] == '-')
+ {
+ if (strcmp (fromcode + 4, "8") == 0)
+ {
+ if (c_strcasecmp (tocode + 4, "16BE") == 0)
+ return _ICONV_UTF8_UTF16BE;
+ if (c_strcasecmp (tocode + 4, "16LE") == 0)
+ return _ICONV_UTF8_UTF16LE;
+ if (c_strcasecmp (tocode + 4, "32BE") == 0)
+ return _ICONV_UTF8_UTF32BE;
+ if (c_strcasecmp (tocode + 4, "32LE") == 0)
+ return _ICONV_UTF8_UTF32LE;
+ }
+ else if (strcmp (tocode + 4, "8") == 0)
+ {
+ if (c_strcasecmp (fromcode + 4, "16BE") == 0)
+ return _ICONV_UTF16BE_UTF8;
+ if (c_strcasecmp (fromcode + 4, "16LE") == 0)
+ return _ICONV_UTF16LE_UTF8;
+ if (c_strcasecmp (fromcode + 4, "32BE") == 0)
+ return _ICONV_UTF32BE_UTF8;
+ if (c_strcasecmp (fromcode + 4, "32LE") == 0)
+ return _ICONV_UTF32LE_UTF8;
+ }
+ }
}
#endif
@@ -115,20 +116,20 @@ rpl_iconv_open (const char *tocode, const char *fromcode)
/* Convert the encodings to upper case, because
1. in the arguments of iconv_open() on AIX, HP-UX, and OSF/1 the case
- matters,
+ matters,
2. it makes searching in the table faster. */
{
const char *p = fromcode;
char *q = fromcode_upper;
while ((*q = c_toupper (*p)) != '\0')
{
- p++;
- q++;
- if (q == &fromcode_upper[SIZEOF (fromcode_upper)])
- {
- errno = EINVAL;
- return (iconv_t)(-1);
- }
+ p++;
+ q++;
+ if (q == &fromcode_upper[SIZEOF (fromcode_upper)])
+ {
+ errno = EINVAL;
+ return (iconv_t)(-1);
+ }
}
fromcode_upper_end = q;
}
@@ -138,13 +139,13 @@ rpl_iconv_open (const char *tocode, const char *fromcode)
char *q = tocode_upper;
while ((*q = c_toupper (*p)) != '\0')
{
- p++;
- q++;
- if (q == &tocode_upper[SIZEOF (tocode_upper)])
- {
- errno = EINVAL;
- return (iconv_t)(-1);
- }
+ p++;
+ q++;
+ if (q == &tocode_upper[SIZEOF (tocode_upper)])
+ {
+ errno = EINVAL;
+ return (iconv_t)(-1);
+ }
}
tocode_upper_end = q;
}