diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-12-17 12:10:58 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-12-17 12:10:58 +0000 |
commit | 0937645101948542e6d0936546e9ca048847c24b (patch) | |
tree | f8b5594effce142c70526d9d683bd09dd619d9ad | |
parent | c7ec9d75a79e1ed2d558447ba788318d3f1fb76c (diff) | |
download | glibc-0937645101948542e6d0936546e9ca048847c24b.tar.gz glibc-0937645101948542e6d0936546e9ca048847c24b.tar.xz glibc-0937645101948542e6d0936546e9ca048847c24b.zip |
Update.
* iconvdata/iso646.c (gconv_init): Return correct error value if we run out of memory. * iconvdata/iso-2022-jp.c: Likewise.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | iconv/skeleton.c | 2 | ||||
-rw-r--r-- | iconvdata/iso-2022-jp.c | 52 | ||||
-rw-r--r-- | iconvdata/iso646.c | 49 |
4 files changed, 59 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog index bf27373cb6..e2ec7ee32d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 1998-12-17 Ulrich Drepper <drepper@cygnus.com> + * iconvdata/iso646.c (gconv_init): Return correct error value if we + run out of memory. + * iconvdata/iso-2022-jp.c: Likewise. + * iconv/gconv_db.c (gen_steps): Respect error return value from init functions and abort. diff --git a/iconv/skeleton.c b/iconv/skeleton.c index b1e96ebbcb..4ed16d6e68 100644 --- a/iconv/skeleton.c +++ b/iconv/skeleton.c @@ -1,4 +1,4 @@ -/* Skeleton for a converison module. +/* Skeleton for a conversion module. Copyright (C) 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c index e888d310b7..36465ccd45 100644 --- a/iconvdata/iso-2022-jp.c +++ b/iconvdata/iso-2022-jp.c @@ -132,34 +132,38 @@ gconv_init (struct gconv_step *step) } result = GCONV_NOCONV; - if (dir != illegal_dir - && ((new_data - = (struct iso2022jp_data *) malloc (sizeof (struct iso2022jp_data))) - != NULL)) + if (dir != illegal_dir) { - new_data->dir = dir; - new_data->var = var; - step->data = new_data; + new_data + = (struct iso2022jp_data *) malloc (sizeof (struct iso2022jp_data)); - if (dir == from_iso2022jp) + result = GCONV_NOMEM; + if (new_data != NULL) { - step->min_needed_from = MIN_NEEDED_FROM; - step->max_needed_from = MAX_NEEDED_FROM; - step->min_needed_to = MIN_NEEDED_TO; - step->max_needed_to = MIN_NEEDED_TO; + new_data->dir = dir; + new_data->var = var; + step->data = new_data; + + if (dir == from_iso2022jp) + { + step->min_needed_from = MIN_NEEDED_FROM; + step->max_needed_from = MAX_NEEDED_FROM; + step->min_needed_to = MIN_NEEDED_TO; + step->max_needed_to = MIN_NEEDED_TO; + } + else + { + step->min_needed_from = MIN_NEEDED_TO; + step->max_needed_from = MAX_NEEDED_TO; + step->min_needed_to = MIN_NEEDED_FROM; + step->max_needed_to = MIN_NEEDED_FROM + 2; + } + + /* Yes, this is a stateful encoding. */ + step->stateful = 1; + + result = GCONV_OK; } - else - { - step->min_needed_from = MIN_NEEDED_TO; - step->max_needed_from = MAX_NEEDED_TO; - step->min_needed_to = MIN_NEEDED_FROM; - step->max_needed_to = MIN_NEEDED_FROM + 2; - } - - /* Yes, this is a stateful encoding. */ - step->stateful = 1; - - result = GCONV_OK; } return result; diff --git a/iconvdata/iso646.c b/iconvdata/iso646.c index 1053c77ffd..701a71db44 100644 --- a/iconvdata/iso646.c +++ b/iconvdata/iso646.c @@ -106,7 +106,7 @@ static const char *names[] = [HU] = "MSZ_7795.3//", [CU] = "NC_NC00-10//", [FR] = "NF_Z_62-010//", - [FR1] = "NF_Z_62-010_1973//", /* Note the we don't have the parenthesis + [FR1] = "NF_Z_62-010_1973//", /* Note that we don't have the parenthesis in the name. */ [NO] = "NS_4551-1//", [NO2] = "NS_4551-2//", @@ -145,33 +145,36 @@ gconv_init (struct gconv_step *step) } result = GCONV_NOCONV; - if (dir != illegal_dir - && ((new_data - = (struct iso646_data *) malloc (sizeof (struct iso646_data))) - != NULL)) + if (dir != illegal_dir) { - new_data->dir = dir; - new_data->var = var; - step->data = new_data; + new_data = (struct iso646_data *) malloc (sizeof (struct iso646_data)); - if (var == from_iso646) + result = GCONV_NOMEM; + if (new_data != NULL) { - step->min_needed_from = MIN_NEEDED_FROM; - step->max_needed_from = MIN_NEEDED_FROM; - step->min_needed_to = MIN_NEEDED_TO; - step->max_needed_to = MIN_NEEDED_TO; - } - else - { - step->min_needed_from = MIN_NEEDED_TO; - step->max_needed_from = MIN_NEEDED_TO; - step->min_needed_to = MIN_NEEDED_FROM; - step->max_needed_to = MIN_NEEDED_FROM; - } + new_data->dir = dir; + new_data->var = var; + step->data = new_data; - step->stateful = 0; + if (var == from_iso646) + { + step->min_needed_from = MIN_NEEDED_FROM; + step->max_needed_from = MIN_NEEDED_FROM; + step->min_needed_to = MIN_NEEDED_TO; + step->max_needed_to = MIN_NEEDED_TO; + } + else + { + step->min_needed_from = MIN_NEEDED_TO; + step->max_needed_from = MIN_NEEDED_TO; + step->min_needed_to = MIN_NEEDED_FROM; + step->max_needed_to = MIN_NEEDED_FROM; + } - result = GCONV_OK; + step->stateful = 0; + + result = GCONV_OK; + } } return result; |