diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-10-28 22:18:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-10-28 22:18:39 (GMT) |
commit | 11bdf91a5f408a447c4c03db820e437d250e7999 (patch) | |
tree | bc77a3f21c3643a24884e15e86411b6f7d5a77d5 /Modules/cjkcodecs/cjkcodecs.h | |
parent | 33aaa73cade0acee374139f855af2a167d139d89 (diff) | |
download | cpython-11bdf91a5f408a447c4c03db820e437d250e7999.zip cpython-11bdf91a5f408a447c4c03db820e437d250e7999.tar.gz cpython-11bdf91a5f408a447c4c03db820e437d250e7999.tar.bz2 |
Issue #18509: handle PyUnicode_Writer() error
Diffstat (limited to 'Modules/cjkcodecs/cjkcodecs.h')
-rw-r--r-- | Modules/cjkcodecs/cjkcodecs.h | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index 35723f4..a11fa5b 100644 --- a/Modules/cjkcodecs/cjkcodecs.h +++ b/Modules/cjkcodecs/cjkcodecs.h @@ -177,29 +177,13 @@ static const struct dbcs_map *mapping_list; #define TRYMAP_ENC(charset, assi, uni) \ if TRYMAP_ENC_COND(charset, assi, uni) -Py_LOCAL_INLINE(int) -_TRYMAP_DEC_WRITE(_PyUnicodeWriter *writer, Py_UCS4 c) -{ - if (c == UNIINV || _PyUnicodeWriter_WriteChar(writer, c) < 0) - return UNIINV; - else - return c; -} - -#define _TRYMAP_DEC(m, writer, val) \ - ((m)->map != NULL && \ - (val) >= (m)->bottom && \ - (val)<= (m)->top && \ - _TRYMAP_DEC_WRITE(writer, (m)->map[(val) - (m)->bottom]) != UNIINV) -#define _TRYMAP_DEC_CHAR(m, assi, val) \ +#define _TRYMAP_DEC(m, assi, val) \ ((m)->map != NULL && \ (val) >= (m)->bottom && \ (val)<= (m)->top && \ ((assi) = (m)->map[(val) - (m)->bottom]) != UNIINV) -#define TRYMAP_DEC(charset, writer, c1, c2) \ - if _TRYMAP_DEC(&charset##_decmap[c1], writer, c2) -#define TRYMAP_DEC_CHAR(charset, assi, c1, c2) \ - if _TRYMAP_DEC_CHAR(&charset##_decmap[c1], assi, c2) +#define TRYMAP_DEC(charset, assi, c1, c2) \ + _TRYMAP_DEC(&charset##_decmap[c1], assi, c2) #define _TRYMAP_ENC_MPLANE(m, assplane, asshi, asslo, val) \ ((m)->map != NULL && (val) >= (m)->bottom && \ @@ -210,8 +194,6 @@ _TRYMAP_DEC_WRITE(_PyUnicodeWriter *writer, Py_UCS4 c) #define TRYMAP_ENC_MPLANE(charset, assplane, asshi, asslo, uni) \ if _TRYMAP_ENC_MPLANE(&charset##_encmap[(uni) >> 8], \ assplane, asshi, asslo, (uni) & 0xff) -#define TRYMAP_DEC_MPLANE(charset, writer, plane, c1, c2) \ - if _TRYMAP_DEC(&charset##_decmap[plane][c1], writer, c2) #define BEGIN_MAPPINGS_LIST static const struct dbcs_map _mapping_list[] = { #define MAPPING_ENCONLY(enc) {#enc, (void*)enc##_encmap, NULL}, |