summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs/alg_jisx0201.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-28 23:19:27 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-28 23:19:27 (GMT)
commit14c9fea60aa6884586c0a87046b308c2af76d38d (patch)
tree81c61ca9de204a341e7b1e21b4ffa11bb4785e81 /Modules/cjkcodecs/alg_jisx0201.h
parent146a2ed0f29a338abe7ea954604ee0f68b35c37f (diff)
downloadcpython-14c9fea60aa6884586c0a87046b308c2af76d38d.zip
cpython-14c9fea60aa6884586c0a87046b308c2af76d38d.tar.gz
cpython-14c9fea60aa6884586c0a87046b308c2af76d38d.tar.bz2
CJK codecs: less magic macros, require explicit semicolon
Diffstat (limited to 'Modules/cjkcodecs/alg_jisx0201.h')
-rw-r--r--Modules/cjkcodecs/alg_jisx0201.h35
1 files changed, 24 insertions, 11 deletions
diff --git a/Modules/cjkcodecs/alg_jisx0201.h b/Modules/cjkcodecs/alg_jisx0201.h
index 5368e08..3034b5a 100644
--- a/Modules/cjkcodecs/alg_jisx0201.h
+++ b/Modules/cjkcodecs/alg_jisx0201.h
@@ -10,8 +10,9 @@
}
#define JISX0201_K_ENCODE(c, assi) \
- if ((c) >= 0xff61 && (c) <= 0xff9f) \
- { (assi) = (c) - 0xfec0; }
+ if ((c) >= 0xff61 && (c) <= 0xff9f) { \
+ (assi) = (c) - 0xfec0; \
+ }
#define JISX0201_ENCODE(c, assi) \
JISX0201_R_ENCODE(c, assi) \
@@ -35,18 +36,30 @@
}
#define JISX0201_R_DECODE(c, writer) \
- if ((c) < 0x5c) OUTCHAR(c); \
- else if ((c) == 0x5c) OUTCHAR(0x00a5); \
- else if ((c) < 0x7e) OUTCHAR(c); \
- else if ((c) == 0x7e) OUTCHAR(0x203e); \
- else if ((c) == 0x7f) OUTCHAR(0x7f);
+ if ((c) < 0x5c) { \
+ OUTCHAR(c); \
+ } \
+ else if ((c) == 0x5c) { \
+ OUTCHAR(0x00a5); \
+ } \
+ else if ((c) < 0x7e) { \
+ OUTCHAR(c); \
+ } \
+ else if ((c) == 0x7e) { \
+ OUTCHAR(0x203e); \
+ } \
+ else if ((c) == 0x7f) { \
+ OUTCHAR(0x7f); \
+ }
#define JISX0201_K_DECODE(c, writer) \
- if ((c) >= 0xa1 && (c) <= 0xdf) \
- OUTCHAR(0xfec0 + (c));
+ if ((c) >= 0xa1 && (c) <= 0xdf) { \
+ OUTCHAR(0xfec0 + (c)); \
+ }
#define JISX0201_K_DECODE_CHAR(c, assi) \
- if ((c) >= 0xa1 && (c) <= 0xdf) \
- (assi) = 0xfec0 + (c);
+ if ((c) >= 0xa1 && (c) <= 0xdf) { \
+ (assi) = 0xfec0 + (c); \
+ }
#define JISX0201_DECODE(c, writer) \
JISX0201_R_DECODE(c, writer) \
else JISX0201_K_DECODE(c, writer)