GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: use `enum class` instead of `enum` in node_i18n · nodejs/node@ed0a867

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_i18n.cc
    • node_i18n.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_i18n.cc‎

Copy file name to clipboardExpand all lines: src/node_i18n.cc
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -642,13 +642,13 @@ int32_t ToUnicode(MaybeStackBuffer<char>* buf,
642642
int32_t ToASCII(MaybeStackBuffer<char>* buf,
643643
const char* input,
644644
size_t length,
645-
enum idna_mode mode) {
645+
idna_mode mode) {
646646
UErrorCode status = U_ZERO_ERROR;
647647
uint32_t options = // CheckHyphens = false; handled later
648648
UIDNA_CHECK_BIDI | // CheckBidi = true
649649
UIDNA_CHECK_CONTEXTJ | // CheckJoiners = true
650650
UIDNA_NONTRANSITIONAL_TO_ASCII; // Nontransitional_Processing
651-
if (mode == IDNA_STRICT) {
651+
if (mode == idna_mode::kStrict) {
652652
options |= UIDNA_USE_STD3_RULES; // UseSTD3ASCIIRules = beStrict
653653
// VerifyDnsLength = beStrict;
654654
// handled later
@@ -696,14 +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_STRICT) {
699+
if (mode != idna_mode::kStrict) {
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) || (mode != IDNA_LENIENT && info.errors != 0)) {
706+
if (U_FAILURE(status) || (mode != idna_mode::kLenient && info.errors != 0)) {
707707
len = -1;
708708
buf->SetLength(0);
709709
} else {
@@ -741,7 +741,7 @@ static void ToASCII(const FunctionCallbackInfo<Value>& args) {
741741
Utf8Value val(env->isolate(), args[0]);
742742
// optional arg
743743
bool lenient = args[1]->BooleanValue(env->isolate());
744-
enum idna_mode mode = lenient ? IDNA_LENIENT : IDNA_DEFAULT;
744+
idna_mode mode = lenient ? idna_mode::kLenient : idna_mode::kDefault;
745745

746746
MaybeStackBuffer<char> buf;
747747
int32_t len = ToASCII(&buf, *val, val.length(), mode);
Collapse file

‎src/node_i18n.h‎

Copy file name to clipboardExpand all lines: src/node_i18n.h
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ bool InitializeICUDirectory(const std::string& path);
4242

4343
void SetDefaultTimeZone(const char* tzid);
4444

45-
enum idna_mode {
45+
enum class idna_mode {
4646
// Default mode for maximum compatibility.
47-
IDNA_DEFAULT,
47+
kDefault,
4848
// Ignore all errors in IDNA conversion, if possible.
49-
IDNA_LENIENT,
49+
kLenient,
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+
kStrict
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-
enum idna_mode mode = IDNA_DEFAULT);
61+
idna_mode mode = idna_mode::kDefault);
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 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.