Skip to content

Commit 5d4cb6f

Browse files
committed
remove IDNA_ prefix from enum idna_mode
1 parent ff3020e commit 5d4cb6f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/node_i18n.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ int32_t ToASCII(MaybeStackBuffer<char>* buf,
648648
UIDNA_CHECK_BIDI | // CheckBidi = true
649649
UIDNA_CHECK_CONTEXTJ | // CheckJoiners = true
650650
UIDNA_NONTRANSITIONAL_TO_ASCII; // Nontransitional_Processing
651-
if (mode == idna_mode::IDNA_STRICT) {
651+
if (mode == idna_mode::STRICT) {
652652
options |= UIDNA_USE_STD3_RULES; // UseSTD3ASCIIRules = beStrict
653653
// VerifyDnsLength = beStrict;
654654
// handled later
@@ -696,15 +696,14 @@ int32_t ToASCII(MaybeStackBuffer<char>* buf,
696696
info.errors &= ~UIDNA_ERROR_LEADING_HYPHEN;
697697
info.errors &= ~UIDNA_ERROR_TRAILING_HYPHEN;
698698

699-
if (mode != idna_mode::IDNA_STRICT) {
699+
if (mode != idna_mode::STRICT) {
700700
// VerifyDnsLength = beStrict
701701
info.errors &= ~UIDNA_ERROR_EMPTY_LABEL;
702702
info.errors &= ~UIDNA_ERROR_LABEL_TOO_LONG;
703703
info.errors &= ~UIDNA_ERROR_DOMAIN_NAME_TOO_LONG;
704704
}
705705

706-
if (U_FAILURE(status) ||
707-
(mode != idna_mode::IDNA_LENIENT && info.errors != 0)) {
706+
if (U_FAILURE(status) || (mode != idna_mode::LENIENT && info.errors != 0)) {
708707
len = -1;
709708
buf->SetLength(0);
710709
} else {
@@ -742,7 +741,7 @@ static void ToASCII(const FunctionCallbackInfo<Value>& args) {
742741
Utf8Value val(env->isolate(), args[0]);
743742
// optional arg
744743
bool lenient = args[1]->BooleanValue(env->isolate());
745-
idna_mode mode = lenient ? idna_mode::IDNA_LENIENT : idna_mode::IDNA_DEFAULT;
744+
idna_mode mode = lenient ? idna_mode::LENIENT : idna_mode::DEFAULT;
746745

747746
MaybeStackBuffer<char> buf;
748747
int32_t len = ToASCII(&buf, *val, val.length(), mode);

src/node_i18n.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@ void SetDefaultTimeZone(const char* tzid);
4444

4545
enum class idna_mode {
4646
// Default mode for maximum compatibility.
47-
IDNA_DEFAULT,
47+
DEFAULT,
4848
// Ignore all errors in IDNA conversion, if possible.
49-
IDNA_LENIENT,
49+
LENIENT,
5050
// Enforce STD3 rules (UseSTD3ASCIIRules) and DNS length restrictions
5151
// (VerifyDnsLength). Corresponds to `beStrict` flag in the "domain to ASCII"
5252
// algorithm.
53-
IDNA_STRICT
53+
STRICT
5454
};
5555

5656
// Implements the WHATWG URL Standard "domain to ASCII" algorithm.
5757
// https://url.spec.whatwg.org/#concept-domain-to-ascii
5858
int32_t ToASCII(MaybeStackBuffer<char>* buf,
5959
const char* input,
6060
size_t length,
61-
idna_mode mode = idna_mode::IDNA_DEFAULT);
61+
idna_mode mode = idna_mode::DEFAULT);
6262

6363
// Implements the WHATWG URL Standard "domain to Unicode" algorithm.
6464
// https://url.spec.whatwg.org/#concept-domain-to-unicode

0 commit comments

Comments
 (0)