aboutsummaryrefslogtreecommitdiffstats
path: root/lib/iso2022_jp.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/iso2022_jp.h')
-rw-r--r--lib/iso2022_jp.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/iso2022_jp.h b/lib/iso2022_jp.h
index 46aa8c8..1c8abec 100644
--- a/lib/iso2022_jp.h
+++ b/lib/iso2022_jp.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999-2001 Free Software Foundation, Inc.
+ * Copyright (C) 1999-2001, 2008 Free Software Foundation, Inc.
* This file is part of the GNU LIBICONV Library.
*
* The GNU LIBICONV Library is free software; you can redistribute it
@@ -59,7 +59,7 @@ iso2022_jp_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
goto none;
continue;
}
- return RET_ILSEQ;
+ goto ilseq;
}
if (s[1] == '$') {
if (s[2] == '@' || s[2] == 'B') {
@@ -70,9 +70,9 @@ iso2022_jp_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
goto none;
continue;
}
- return RET_ILSEQ;
+ goto ilseq;
}
- return RET_ILSEQ;
+ goto ilseq;
}
break;
}
@@ -81,40 +81,44 @@ iso2022_jp_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
if (c < 0x80) {
int ret = ascii_mbtowc(conv,pwc,s,1);
if (ret == RET_ILSEQ)
- return RET_ILSEQ;
+ goto ilseq;
if (ret != 1) abort();
conv->istate = state;
return count+1;
} else
- return RET_ILSEQ;
+ goto ilseq;
case STATE_JISX0201ROMAN:
if (c < 0x80) {
int ret = jisx0201_mbtowc(conv,pwc,s,1);
if (ret == RET_ILSEQ)
- return RET_ILSEQ;
+ goto ilseq;
if (ret != 1) abort();
conv->istate = state;
return count+1;
} else
- return RET_ILSEQ;
+ goto ilseq;
case STATE_JISX0208:
if (n < count+2)
goto none;
if (s[0] < 0x80 && s[1] < 0x80) {
int ret = jisx0208_mbtowc(conv,pwc,s,2);
if (ret == RET_ILSEQ)
- return RET_ILSEQ;
+ goto ilseq;
if (ret != 2) abort();
conv->istate = state;
return count+2;
} else
- return RET_ILSEQ;
+ goto ilseq;
default: abort();
}
none:
conv->istate = state;
return RET_TOOFEW(count);
+
+ilseq:
+ conv->istate = state;
+ return RET_SHIFT_ILSEQ(count);
}
static int