aboutsummaryrefslogtreecommitdiff
path: root/iconvdata
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-13 17:54:00 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-13 17:54:00 +0000
commit2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26 (patch)
treea783a384cc0f7cfcc8225c407e8255a6c25e5816 /iconvdata
parent40c0dc53b080fd3e1ace4fbe2cb79007babec6c3 (diff)
downloadglibc-2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26.zip
glibc-2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26.tar.gz
glibc-2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26.tar.bz2
Update.
1998-04-13 17:40 Ulrich Drepper <drepper@cygnus.com> * iconvdata/8bit-gap.c: Simplify step data handling. * iconvdata/8bit-generic.c: Likewise. * iconvdata/big5.c: Likewise. * iconvdata/euccn.c: Likewise. * iconvdata/eucjp.c: Likewise. * iconvdata/euckr.c: Likewise. * iconvdata/euctw.c: Likewise. * iconvdata/iso6937.c: Likewise. * iconvdata/iso8859-1.c: Likewise. * iconvdata/jis0208.h: Likewise. * iconvdata/jis0212.c: Likewise. * iconvdata/jis0212.h: Likewise. * iconvdata/johab.c: Likewise. * iconvdata/ksc5601.h: Likewise. * iconvdata/sjis.c: Likewise. * iconvdata/t61.c: Likewise. * iconvdata/uhc.c: Likewise.
Diffstat (limited to 'iconvdata')
-rw-r--r--iconvdata/8bit-gap.c49
-rw-r--r--iconvdata/8bit-generic.c47
-rw-r--r--iconvdata/big5.c46
-rw-r--r--iconvdata/euccn.c45
-rw-r--r--iconvdata/eucjp.c45
-rw-r--r--iconvdata/euckr.c45
-rw-r--r--iconvdata/euctw.c45
-rw-r--r--iconvdata/iso6937.c45
-rw-r--r--iconvdata/iso8859-1.c45
-rw-r--r--iconvdata/jis0208.h2
-rw-r--r--iconvdata/jis0212.c4
-rw-r--r--iconvdata/jis0212.h2
-rw-r--r--iconvdata/johab.c47
-rw-r--r--iconvdata/ksc5601.h2
-rw-r--r--iconvdata/sjis.c47
-rw-r--r--iconvdata/t61.c45
-rw-r--r--iconvdata/uhc.c45
17 files changed, 129 insertions, 477 deletions
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c
index 1528cb6..6c78ce5 100644
--- a/iconvdata/8bit-gap.c
+++ b/iconvdata/8bit-gap.c
@@ -20,8 +20,7 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
@@ -35,54 +34,30 @@ struct gap
/* Now we can include the tables. */
#include TABLES
-/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_8bit,
- from_8bit
-};
-
-struct s_8bit_data
-{
- enum direction dir;
-};
+/* We use three objects to describe the operation mode. */
+static int from_8bit_object;
+static int to_8bit_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct s_8bit_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, NAME) != NULL)
- dir = from_8bit;
+ step->data = &from_8bit_object;
else if (strcasestr (step->to_name, NAME) != NULL)
- dir = to_8bit;
+ step->data = &to_8bit_object;
else
- dir = illegal;
-
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct s_8bit_data *) malloc (sizeof (struct s_8bit_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
+ return GCONV_NOCONV;
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -119,15 +94,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct s_8bit_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_8bit)
+ if (step->data == &from_8bit_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -213,7 +186,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_8bit
+ result = (*inbufsize > (step->data == &from_8bit_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/8bit-generic.c b/iconvdata/8bit-generic.c
index 7f0bbae..52cd540 100644
--- a/iconvdata/8bit-generic.c
+++ b/iconvdata/8bit-generic.c
@@ -19,57 +19,32 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <stdlib.h>
#include <string.h>
-/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_8bit,
- from_8bit
-};
-
-struct s_8bit_data
-{
- enum direction dir;
-};
+/* We use three objects to describe the operation mode. */
+static int from_8bit_object;
+static int to_8bit_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct s_8bit_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, NAME) != NULL)
- dir = from_8bit;
+ step->data = &from_8bit_object;
else if (strcasestr (step->to_name, NAME) != NULL)
- dir = to_8bit;
+ step->data = &to_8bit_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct s_8bit_data *) malloc (sizeof (struct s_8bit_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -106,15 +81,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct s_8bit_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_8bit)
+ if (step->data == &from_8bit_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -191,7 +164,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_8bit
+ result = (*inbufsize > (step->data == &from_8bit_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/big5.c b/iconvdata/big5.c
index 26ea6ed..bfd14fd 100644
--- a/iconvdata/big5.c
+++ b/iconvdata/big5.c
@@ -19,7 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
@@ -8412,53 +8412,29 @@ static const char from_ucs4_tab13[][2] =
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_big5,
- from_big5
-};
-
-struct big5_data
-{
- enum direction dir;
-};
+static int to_big5_object;
+static int from_big5_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct big5_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "BIG5") != NULL)
- dir = from_big5;
+ step->data = &from_big5_object;
else if (strcasestr (step->to_name, "BIG5") != NULL)
- dir = to_big5;
+ step->data = &to_big5_object;
else
- dir = illegal;
-
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct big5_data *) malloc (sizeof (struct big5_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
+ return GCONV_NOCONV;
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -8492,15 +8468,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct big5_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_big5)
+ if (step->data == &from_big5_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -8686,7 +8660,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_big5
+ result = (*inbufsize > (step->data == &from_big5_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/euccn.c b/iconvdata/euccn.c
index 108974a..e8d9097 100644
--- a/iconvdata/euccn.c
+++ b/iconvdata/euccn.c
@@ -20,59 +20,34 @@
#include <gconv.h>
#include <stdint.h>
-#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <gb2312.h>
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_euccn,
- from_euccn
-};
-
-struct euccn_data
-{
- enum direction dir;
-};
+static int to_euccn_object;
+static int from_euccn_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct euccn_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "EUC-CN") != NULL)
- dir = from_euccn;
+ step->data = &from_euccn_object;
else if (strcasestr (step->to_name, "EUC-CN") != NULL)
- dir = to_euccn;
+ step->data = &to_euccn_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct euccn_data *) malloc (sizeof (struct euccn_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -109,15 +84,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct euccn_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_euccn)
+ if (step->data == &from_euccn_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -267,7 +240,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_euccn
+ result = (*inbufsize > (step->data == &from_euccn_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/eucjp.c b/iconvdata/eucjp.c
index caf24e2..4e82904 100644
--- a/iconvdata/eucjp.c
+++ b/iconvdata/eucjp.c
@@ -20,7 +20,6 @@
#include <gconv.h>
#include <stdint.h>
-#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <jis0201.h>
@@ -28,53 +27,29 @@
#include <jis0212.h>
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_eucjp,
- from_eucjp
-};
-
-struct eucjp_data
-{
- enum direction dir;
-};
+static int to_eucjp_object;
+static int from_eucjp_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct eucjp_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "EUC-JP") != NULL)
- dir = from_eucjp;
+ step->data = &from_eucjp_object;
else if (strcasestr (step->to_name, "EUC-JP") != NULL)
- dir = to_eucjp;
+ step->data = &to_eucjp_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct eucjp_data *) malloc (sizeof (struct eucjp_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -111,15 +86,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct eucjp_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_eucjp)
+ if (step->data == &from_eucjp_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -311,7 +284,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_eucjp
+ result = (*inbufsize > (step->data == &from_eucjp_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/euckr.c b/iconvdata/euckr.c
index 62dd2c4..1dfa42d 100644
--- a/iconvdata/euckr.c
+++ b/iconvdata/euckr.c
@@ -26,18 +26,8 @@
#include <ksc5601.h>
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_euckr,
- from_euckr
-};
-
-struct euckr_data
-{
- enum direction dir;
-};
-
+static int to_euckr_object;
+static int from_euckr_object;
static inline void
@@ -66,36 +56,21 @@ int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct euckr_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "EUC-KR") != NULL)
- dir = from_euckr;
+ step->data = &from_euckr_object;
else if (strcasestr (step->to_name, "EUC-KR") != NULL)
- dir = to_euckr;
+ step->data = &to_euckr_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct euckr_data *) malloc (sizeof (struct euckr_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -132,15 +107,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct euckr_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_euckr)
+ if (step->data == &from_euckr_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -281,7 +254,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_euckr
+ result = (*inbufsize > (step->data == &from_euckr_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/euctw.c b/iconvdata/euctw.c
index 33da1ce..f38db47 100644
--- a/iconvdata/euctw.c
+++ b/iconvdata/euctw.c
@@ -20,60 +20,35 @@
#include <gconv.h>
#include <stdint.h>
-#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <cns11643l1.h>
#include <cns11643.h>
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_euctw,
- from_euctw
-};
-
-struct euctw_data
-{
- enum direction dir;
-};
+static int to_euctw_object;
+static int from_euctw_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct euctw_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "EUC-TW") != NULL)
- dir = from_euctw;
+ step->data = &from_euctw_object;
else if (strcasestr (step->to_name, "EUC-TW") != NULL)
- dir = to_euctw;
+ step->data = &to_euctw_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct euctw_data *) malloc (sizeof (struct euctw_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -110,15 +85,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct euctw_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_euctw)
+ if (step->data == &from_euctw_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -307,7 +280,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_euctw
+ result = (*inbufsize > (step->data == &from_euctw_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/iso6937.c b/iconvdata/iso6937.c
index 377eef5..30c3831 100644
--- a/iconvdata/iso6937.c
+++ b/iconvdata/iso6937.c
@@ -19,7 +19,6 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <stdlib.h>
#include <string.h>
/* Data taken from the WG15 tables. */
@@ -373,53 +372,29 @@ static const char from_ucs4[][2] =
};
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_iso6937,
- from_iso6937
-};
-
-struct iso6937_data
-{
- enum direction dir;
-};
+static int to_iso6937_object;
+static int from_iso6937_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct iso6937_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "ISO_6937") != NULL)
- dir = from_iso6937;
+ step->data = &from_iso6937_object;
else if (strcasestr (step->to_name, "ISO_6937") != NULL)
- dir = to_iso6937;
+ step->data = &to_iso6937_object;
else
- dir = illegal;
-
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct iso6937_data *) malloc (sizeof (struct iso6937_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
+ return GCONV_NOCONV;
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothign to do. */
}
@@ -456,15 +431,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct iso6937_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_iso6937)
+ if (step->data == &from_iso6937_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -648,7 +621,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_iso6937
+ result = (*inbufsize > (step->data == &from_iso6937_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/iso8859-1.c b/iconvdata/iso8859-1.c
index cdeb526..ab69c4d 100644
--- a/iconvdata/iso8859-1.c
+++ b/iconvdata/iso8859-1.c
@@ -19,57 +19,32 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <stdlib.h>
#include <string.h>
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_iso88591,
- from_iso88591
-};
-
-struct iso88591_data
-{
- enum direction dir;
-};
+static int to_iso88591_object;
+static int from_iso88591_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct iso88591_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "ISO-8859-1") != NULL)
- dir = from_iso88591;
+ step->data = &from_iso88591_object;
else if (strcasestr (step->to_name, "ISO-8859-1") != NULL)
- dir = to_iso88591;
+ step->data = &to_iso88591_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct iso88591_data *) malloc (sizeof (struct iso88591_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -106,15 +81,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct iso88591_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_iso88591)
+ if (step->data == &from_iso88591_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -184,7 +157,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_iso88591
+ result = (*inbufsize > (step->data == &from_iso88591_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/jis0208.h b/iconvdata/jis0208.h
index 9c90cf9..94d2764 100644
--- a/iconvdata/jis0208.h
+++ b/iconvdata/jis0208.h
@@ -22,7 +22,7 @@
#define _JIS0208_H 1
#include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
/* Conversion table. */
extern const uint16_t jis0208_to_ucs[];
diff --git a/iconvdata/jis0212.c b/iconvdata/jis0212.c
index e9e1313..7484c5e 100644
--- a/iconvdata/jis0212.c
+++ b/iconvdata/jis0212.c
@@ -1,5 +1,5 @@
/* Mapping tables for JIS0212 handling.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -18,7 +18,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <inttypes.h>
+#include <stdint.h>
#include <wchar.h>
#include <jis0212.h>
diff --git a/iconvdata/jis0212.h b/iconvdata/jis0212.h
index 7d9e9ac..cf5d9191 100644
--- a/iconvdata/jis0212.h
+++ b/iconvdata/jis0212.h
@@ -22,7 +22,7 @@
#define _JIS0212_H 1
#include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
/* Struct for table with indeces in mapping table. */
diff --git a/iconvdata/johab.c b/iconvdata/johab.c
index bde56ce..51b235c 100644
--- a/iconvdata/johab.c
+++ b/iconvdata/johab.c
@@ -19,24 +19,14 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <ksc5601.h>
/* Direction of the transformation. */
-enum direction
- {
- illegal,
- to_johab,
- from_johab
- };
-
-struct johab_data
- {
- enum direction dir;
- };
+static int to_johab_object;
+static int from_johab_object;
/* The table for Bit pattern to Hangul Jamo
5 bits each are used to encode
@@ -242,36 +232,21 @@ int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct johab_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "JOHAB") != NULL)
- dir = from_johab;
+ step->data = &from_johab_object;
else if (strcasestr (step->to_name, "JOHAB") != NULL)
- dir = to_johab;
+ step->data = &to_johab_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct johab_data *) malloc (sizeof (struct johab_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -308,15 +283,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct johab_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_johab)
+ if (step->data == &from_johab_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -517,7 +490,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_johab
+ result = (*inbufsize > (step->data == &from_johab_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/ksc5601.h b/iconvdata/ksc5601.h
index 0b649c7..0d86c7b 100644
--- a/iconvdata/ksc5601.h
+++ b/iconvdata/ksc5601.h
@@ -25,7 +25,7 @@
#define KSC5601_SYMBOL 986
#include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
/* Conversion table. */
extern const uint16_t ksc5601_hangul_to_ucs[KSC5601_HANGUL];
diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c
index b1320c1..7a81c01 100644
--- a/iconvdata/sjis.c
+++ b/iconvdata/sjis.c
@@ -19,8 +19,7 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <wchar.h>
@@ -3983,53 +3982,29 @@ static const char from_ucs4_cjk[32657][2] =
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_sjis,
- from_sjis
-};
-
-struct sjis_data
-{
- enum direction dir;
-};
+static int to_sjis_object;
+static int from_sjis_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct sjis_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "SJIS") != NULL)
- dir = from_sjis;
+ step->data = &from_sjis_object;
else if (strcasestr (step->to_name, "SJIS") != NULL)
- dir = to_sjis;
+ step->data = &to_sjis_object;
else
- dir = illegal;
-
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct sjis_data *) malloc (sizeof (struct sjis_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
+ return GCONV_NOCONV;
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -4063,15 +4038,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct sjis_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_sjis)
+ if (step->data == &from_sjis_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -4236,7 +4209,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_sjis
+ result = (*inbufsize > (step->data == &from_sjis_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/t61.c b/iconvdata/t61.c
index 7d4314d..d532438 100644
--- a/iconvdata/t61.c
+++ b/iconvdata/t61.c
@@ -19,7 +19,6 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <stdlib.h>
#include <string.h>
/* Data taken from the WG15 tables. */
@@ -364,53 +363,29 @@ static const char from_ucs4[][2] =
};
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_t61,
- from_t61
-};
-
-struct t61_data
-{
- enum direction dir;
-};
+static int to_t61_object;
+static int from_t61_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct t61_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "T.61") != NULL)
- dir = from_t61;
+ step->data = &from_t61_object;
else if (strcasestr (step->to_name, "T.61") != NULL)
- dir = to_t61;
+ step->data = &to_t61_object;
else
- dir = illegal;
-
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct t61_data *) malloc (sizeof (struct t61_data)))
- != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
+ return GCONV_NOCONV;
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -447,15 +422,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct t61_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_t61)
+ if (step->data == &from_t61_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -597,7 +570,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_t61
+ result = (*inbufsize > (step->data == &from_t61_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;
diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c
index 9e5f009..c1d5a40 100644
--- a/iconvdata/uhc.c
+++ b/iconvdata/uhc.c
@@ -19,24 +19,15 @@
Boston, MA 02111-1307, USA. */
#include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <ksc5601.h>
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_uhc,
- from_uhc
-};
+static int to_uhc_object;
+static int from_uhc_object;
-struct uhc_data
-{
- enum direction dir;
-};
/*
egrep \
@@ -2626,35 +2617,21 @@ int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct uhc_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "UHC") != NULL)
- dir = from_uhc;
+ step->data = &from_uhc_object;
else if (strcasestr (step->to_name, "UHC") != NULL)
- dir = to_uhc;
+ step->data = &to_uhc_object;
else
- dir = illegal;
+ return GCONV_NOCONV;
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct uhc_data *) malloc (sizeof (struct uhc_data))) != NULL))
- {
- new_data->dir = dir;
- step->data = new_data;
- result = GCONV_OK;
- }
-
- return result;
+ return GCONV_OK;
}
void
gconv_end (struct gconv_step *data)
{
- free (data->data);
+ /* Nothing to do. */
}
@@ -2691,15 +2668,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct uhc_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_uhc)
+ if (step->data == &from_uhc_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -2869,7 +2844,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_uhc
+ result = (*inbufsize > (step->data == &from_uhc_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;