Skip to content

Commit 67c0a57

Browse files
committed
utf8.h Swap which definition is the base
The GOT defines are now the principal ones, and the ALLOW ones are changed to be in terms of the GOT. This seems right to me, as the GOT ones are the ones anyone might actually care about. (The ALLOW ones are for weird cases.) More importantly this makes the next commit make more sense.
1 parent 4b10878 commit 67c0a57

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

utf8.h

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,27 +1175,27 @@ point's representation.
11751175

11761176
/* The ordering of these bits is important to a switch() statement in utf8.c
11771177
* for handling problems in converting UTF-8 to a UV */
1178-
#define UTF8_ALLOW_OVERFLOW 0x0001
1179-
#define UTF8_GOT_OVERFLOW UTF8_ALLOW_OVERFLOW
1178+
#define UTF8_GOT_OVERFLOW 0x0001
1179+
#define UTF8_ALLOW_OVERFLOW UTF8_GOT_OVERFLOW
11801180

1181-
#define UTF8_ALLOW_EMPTY 0x0002 /* Allow a zero length string */
1182-
#define UTF8_GOT_EMPTY UTF8_ALLOW_EMPTY
1181+
#define UTF8_GOT_EMPTY 0x0002 /* Allow a zero length string */
1182+
#define UTF8_ALLOW_EMPTY UTF8_GOT_EMPTY
11831183

11841184
/* Allow first byte to be a continuation byte */
1185-
#define UTF8_ALLOW_CONTINUATION 0x0004
1186-
#define UTF8_GOT_CONTINUATION UTF8_ALLOW_CONTINUATION
1185+
#define UTF8_GOT_CONTINUATION 0x0004
1186+
#define UTF8_ALLOW_CONTINUATION UTF8_GOT_CONTINUATION
11871187

11881188
/* expecting more bytes than were available in the string */
1189-
#define UTF8_ALLOW_SHORT 0x0008
1190-
#define UTF8_GOT_SHORT UTF8_ALLOW_SHORT
1189+
#define UTF8_GOT_SHORT 0x0008
1190+
#define UTF8_ALLOW_SHORT UTF8_GOT_SHORT
11911191

11921192
/* Unexpected non-continuation byte */
1193-
#define UTF8_ALLOW_NON_CONTINUATION 0x0010
1194-
#define UTF8_GOT_NON_CONTINUATION UTF8_ALLOW_NON_CONTINUATION
1193+
#define UTF8_GOT_NON_CONTINUATION 0x0010
1194+
#define UTF8_ALLOW_NON_CONTINUATION UTF8_GOT_NON_CONTINUATION
11951195

1196-
#define UTF8_DISALLOW_SURROGATE 0x0020 /* Unicode surrogates */
1197-
#define UTF8_GOT_SURROGATE UTF8_DISALLOW_SURROGATE
1198-
#define UTF8_WARN_SURROGATE 0x0040
1196+
#define UTF8_GOT_SURROGATE 0x0020 /* Unicode surrogates */
1197+
#define UTF8_DISALLOW_SURROGATE UTF8_GOT_SURROGATE
1198+
#define UTF8_WARN_SURROGATE 0x0040
11991199

12001200
/* The original UTF-8 standard did not define UTF-8 with start bytes of 0xFE or
12011201
* 0xFF, though UTF-EBCDIC did. This allowed both versions to represent code
@@ -1206,27 +1206,27 @@ point's representation.
12061206
* extensions, and not likely to be interchangeable with other languages. Note
12071207
* that on ASCII platforms, FE overflows a signed 32-bit word, and FF an
12081208
* unsigned one. */
1209-
#define UTF8_DISALLOW_PERL_EXTENDED 0x0080
1210-
#define UTF8_GOT_PERL_EXTENDED UTF8_DISALLOW_PERL_EXTENDED
1209+
#define UTF8_GOT_PERL_EXTENDED 0x0080
1210+
#define UTF8_DISALLOW_PERL_EXTENDED UTF8_GOT_PERL_EXTENDED
12111211
#define UTF8_WARN_PERL_EXTENDED 0x0100
12121212

12131213
/* Super-set of Unicode: code points above the legal max */
1214-
#define UTF8_DISALLOW_SUPER 0x0200
1215-
#define UTF8_GOT_SUPER UTF8_DISALLOW_SUPER
1216-
#define UTF8_WARN_SUPER 0x0400
1214+
#define UTF8_GOT_SUPER 0x0200
1215+
#define UTF8_DISALLOW_SUPER UTF8_GOT_SUPER
1216+
#define UTF8_WARN_SUPER 0x0400
12171217

12181218
/* Unicode non-character code points */
1219-
#define UTF8_DISALLOW_NONCHAR 0x0800
1220-
#define UTF8_GOT_NONCHAR UTF8_DISALLOW_NONCHAR
1219+
#define UTF8_GOT_NONCHAR 0x0800
1220+
#define UTF8_DISALLOW_NONCHAR UTF8_GOT_NONCHAR
12211221
#define UTF8_WARN_NONCHAR 0x1000
12221222

12231223
/* Overlong sequence; i.e., the code point can be specified in fewer bytes.
12241224
* First one will convert the overlong to the REPLACEMENT CHARACTER; second
12251225
* will return what the overlong evaluates to */
1226-
#define UTF8_ALLOW_LONG 0x2000
1227-
#define UTF8_GOT_LONG UTF8_ALLOW_LONG
1228-
#define UTF8_ALLOW_LONG_AND_ITS_VALUE 0x4000
1229-
#define UTF8_GOT_LONG_WITH_VALUE UTF8_ALLOW_LONG_AND_ITS_VALUE
1226+
#define UTF8_GOT_LONG 0x2000
1227+
#define UTF8_ALLOW_LONG UTF8_GOT_LONG
1228+
#define UTF8_GOT_LONG_WITH_VALUE 0x4000
1229+
#define UTF8_ALLOW_LONG_AND_ITS_VALUE UTF8_GOT_LONG_WITH_VALUE
12301230

12311231
/* For back compat, these old names are misleading for overlongs and
12321232
* UTF_EBCDIC. */
@@ -1236,7 +1236,7 @@ point's representation.
12361236
#define UTF8_DISALLOW_FE_FF UTF8_DISALLOW_PERL_EXTENDED
12371237
#define UTF8_WARN_FE_FF UTF8_WARN_PERL_EXTENDED
12381238

1239-
#define UTF8_CHECK_ONLY 0x8000
1239+
#define UTF8_CHECK_ONLY 0x8000
12401240
#define UTF8_NO_CONFIDENCE_IN_CURLEN_ 0x10000 /* Internal core use only */
12411241
#define UTF8_DIE_IF_MALFORMED 0x20000
12421242
#define UTF8_FORCE_WARN_IF_MALFORMED 0x40000

0 commit comments

Comments
 (0)