diff options
author | Moonchild <moonchild@palemoon.org> | 2021-10-26 11:15:59 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-01 17:19:24 +0200 |
commit | e00bc543ad1d535471497a72b8e9f3f6919220dc (patch) | |
tree | 24292fd7d7c8119cd9059afe577233bcda12d5c2 /js/src | |
parent | 1e8c04030754055104207180824c2c734e7cb99f (diff) | |
download | uxp-e00bc543ad1d535471497a72b8e9f3f6919220dc.tar.gz |
[No issue] Don't rely on nsCRT from jsdate.
Diffstat (limited to 'js/src')
-rwxr-xr-x | js/src/jsdate.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 21d2b476a5..dfd04e1305 100755 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -20,8 +20,6 @@ #include "mozilla/FloatingPoint.h" #include "mozilla/Sprintf.h" -#include "nsCRT.h" - #include <ctype.h> #include <math.h> #include <string.h> @@ -932,6 +930,10 @@ ParseISOStyleDate(const CharT* s, size_t length, ClippedTime* result) #undef NEED_NDIGITS } +static bool IsAsciiDigit(char ch) { + return (uint8_t)(ch - '0') <= 9; +} + template <typename CharT> static bool ParseDate(const CharT* s, size_t length, ClippedTime* result) @@ -967,7 +969,7 @@ ParseDate(const CharT* s, size_t length, ClippedTime* result) // Dashes are delimiters if they're immediately followed by a number field. // If they're not followed by a number field, they're simply ignored. if (c == '-') { - if (i < length && nsCRT::IsAsciiDigit(s[i])) { + if (i < length && IsAsciiDigit(s[i])) { prevc = c; } continue; @@ -989,7 +991,7 @@ ParseDate(const CharT* s, size_t length, ClippedTime* result) } // Parse a number field. - if (nsCRT::IsAsciiDigit(c)) { + if (IsAsciiDigit(c)) { int n = c - '0'; while (i < length && '0' <= (c = s[i]) && c <= '9') { n = n * 10 + c - '0'; |