mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 08:47:56 +01:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f70dda95c | ||
|
|
0d8b52336e | ||
|
|
0baab7fe72 | ||
|
|
c99f5af9fe | ||
|
|
fb8926614b | ||
|
|
2fa1d20d76 | ||
|
|
9d41525a2f |
No files matched your search
@@ -23,5 +23,6 @@ Přemysl Eric Janouch <p@janouch.name>
|
|||||||
Richard Hughes <rhughes@redhat.com>
|
Richard Hughes <rhughes@redhat.com>
|
||||||
Samuel Bronson <naesten@gmail.com>
|
Samuel Bronson <naesten@gmail.com>
|
||||||
rootkiller6788 <17553215+rootkiller6788@user.noreply.gitee.com>
|
rootkiller6788 <17553215+rootkiller6788@user.noreply.gitee.com>
|
||||||
|
sabith saheb <admin@medios.digiscrypt.com>
|
||||||
sarastro-nl <nlsarastro@gmail.com>
|
sarastro-nl <nlsarastro@gmail.com>
|
||||||
zhuzeitou <zhuzeitou@gmail.com>
|
zhuzeitou <zhuzeitou@gmail.com>
|
||||||
@@ -49,5 +49,6 @@ Přemysl Eric Janouch <p@janouch.name>
|
|||||||
Richard Hughes <rhughes@redhat.com>
|
Richard Hughes <rhughes@redhat.com>
|
||||||
Samuel Bronson <naesten@gmail.com>
|
Samuel Bronson <naesten@gmail.com>
|
||||||
rootkiller6788 <17553215+rootkiller6788@user.noreply.gitee.com>
|
rootkiller6788 <17553215+rootkiller6788@user.noreply.gitee.com>
|
||||||
|
sabith saheb <admin@medios.digiscrypt.com>
|
||||||
sarastro-nl <nlsarastro@gmail.com>
|
sarastro-nl <nlsarastro@gmail.com>
|
||||||
zhuzeitou <zhuzeitou@gmail.com>
|
zhuzeitou <zhuzeitou@gmail.com>
|
||||||
@@ -70,6 +70,12 @@ code (instead of writing C/C++ code that _uses_ Wuffs' standard library).
|
|||||||
a tab).
|
a tab).
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-10-20 version 0.3.6
|
||||||
|
|
||||||
|
- Fix some `parse_number_f64` and `parse_number_u64` bugs.
|
||||||
|
- Fix "go test" example names for newer Go toolchains.
|
||||||
|
|
||||||
|
|
||||||
## 2026-07-11 version 0.3.5
|
## 2026-07-11 version 0.3.5
|
||||||
|
|
||||||
- No significant changes to `wuffs-v0.3.c` per se.
|
- No significant changes to `wuffs-v0.3.c` per se.
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ archive containing 1 file) as [Farbfeld](https://tools.suckless.org/farbfeld/)
|
|||||||
or [NIE](./nie-spec.md) is to image files: an uncompressed, "designed for Unix
|
or [NIE](./nie-spec.md) is to image files: an uncompressed, "designed for Unix
|
||||||
pipes" format that is trivial to read or write in a few hundred lines of code,
|
pipes" format that is trivial to read or write in a few hundred lines of code,
|
||||||
ideally in a memory-safe programming language. It's a format for what the
|
ideally in a memory-safe programming language. It's a format for what the
|
||||||
Chromium web browser's
|
Chromium web browser's "Rule of 2" security advice calls
|
||||||
[https://chromium.googlesource.com/chromium/src/+/master/docs/security/rule-of-2.md](Rule of 2)
|
[Normalization](https://chromium.googlesource.com/chromium/src/+/master/docs/security/rule-of-2.md#normalization).
|
||||||
security advice calls Normalization.
|
|
||||||
|
|
||||||
|
|
||||||
## Subset of TAR
|
## Subset of TAR
|
||||||
|
|||||||
@@ -268,14 +268,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
uint8_t* q = s.ptr + s.len;
|
uint8_t* q = s.ptr + s.len;
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse sign.
|
// Parse sign.
|
||||||
do {
|
do {
|
||||||
@@ -288,14 +286,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
||||||
@@ -347,9 +343,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
if (nd < WUFFS_PRIVATE_IMPL__HPD__DIGITS_PRECISION) {
|
if (nd < WUFFS_PRIVATE_IMPL__HPD__DIGITS_PRECISION) {
|
||||||
h->digits[nd++] = (uint8_t)(*p - '0');
|
h->digits[nd++] = (uint8_t)(*p - '0');
|
||||||
dp = (int32_t)nd;
|
dp = (int32_t)nd;
|
||||||
} else if ('0' != *p) {
|
} else {
|
||||||
// Long-tail non-zeroes set the truncated bit.
|
dp++;
|
||||||
h->truncated = true;
|
if ('0' != *p) {
|
||||||
|
// Long-tail non-zeroes set the truncated bit.
|
||||||
|
h->truncated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (*p ==
|
} else if (*p ==
|
||||||
((options &
|
((options &
|
||||||
@@ -408,14 +407,12 @@ after_sep:
|
|||||||
after_exp:
|
after_exp:
|
||||||
do {
|
do {
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t exp_sign = +1;
|
int32_t exp_sign = +1;
|
||||||
if (*p == '+') {
|
if (*p == '+') {
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto hexadecimal;
|
goto hexadecimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
|
|
||||||
} else if ((*p == 'd') || (*p == 'D')) {
|
} else if ((*p == 'd') || (*p == 'D')) {
|
||||||
p++;
|
p++;
|
||||||
@@ -225,6 +226,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto decimal;
|
goto decimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
||||||
|
|||||||
@@ -21668,14 +21668,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
uint8_t* q = s.ptr + s.len;
|
uint8_t* q = s.ptr + s.len;
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse sign.
|
// Parse sign.
|
||||||
do {
|
do {
|
||||||
@@ -21688,14 +21686,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
||||||
@@ -21747,9 +21743,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
if (nd < WUFFS_PRIVATE_IMPL__HPD__DIGITS_PRECISION) {
|
if (nd < WUFFS_PRIVATE_IMPL__HPD__DIGITS_PRECISION) {
|
||||||
h->digits[nd++] = (uint8_t)(*p - '0');
|
h->digits[nd++] = (uint8_t)(*p - '0');
|
||||||
dp = (int32_t)nd;
|
dp = (int32_t)nd;
|
||||||
} else if ('0' != *p) {
|
} else {
|
||||||
// Long-tail non-zeroes set the truncated bit.
|
dp++;
|
||||||
h->truncated = true;
|
if ('0' != *p) {
|
||||||
|
// Long-tail non-zeroes set the truncated bit.
|
||||||
|
h->truncated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (*p ==
|
} else if (*p ==
|
||||||
((options &
|
((options &
|
||||||
@@ -21808,14 +21807,12 @@ after_sep:
|
|||||||
after_exp:
|
after_exp:
|
||||||
do {
|
do {
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t exp_sign = +1;
|
int32_t exp_sign = +1;
|
||||||
if (*p == '+') {
|
if (*p == '+') {
|
||||||
@@ -23585,6 +23582,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto hexadecimal;
|
goto hexadecimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
|
|
||||||
} else if ((*p == 'd') || (*p == 'D')) {
|
} else if ((*p == 'd') || (*p == 'D')) {
|
||||||
p++;
|
p++;
|
||||||
@@ -23595,6 +23593,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto decimal;
|
goto decimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
||||||
|
|||||||
+26
-27
@@ -85,15 +85,15 @@ extern "C" {
|
|||||||
// each major.minor branch, the commit count should increase monotonically.
|
// each major.minor branch, the commit count should increase monotonically.
|
||||||
//
|
//
|
||||||
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
|
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
|
||||||
// 40445d992b97be816cd09b0460c55e6a160389f6 committed on 2026-07-11.
|
// 55279938422060f30cd487173b98a651da075e3a committed on 2026-10-20.
|
||||||
#define WUFFS_VERSION 0x000030005
|
#define WUFFS_VERSION 0x000030006
|
||||||
#define WUFFS_VERSION_MAJOR 0
|
#define WUFFS_VERSION_MAJOR 0
|
||||||
#define WUFFS_VERSION_MINOR 3
|
#define WUFFS_VERSION_MINOR 3
|
||||||
#define WUFFS_VERSION_PATCH 5
|
#define WUFFS_VERSION_PATCH 6
|
||||||
#define WUFFS_VERSION_PRE_RELEASE_LABEL ""
|
#define WUFFS_VERSION_PRE_RELEASE_LABEL ""
|
||||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3404
|
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3407
|
||||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20260711
|
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20261020
|
||||||
#define WUFFS_VERSION_STRING "0.3.5+3404.20260711"
|
#define WUFFS_VERSION_STRING "0.3.6+3407.20261020"
|
||||||
|
|
||||||
// ---------------- Configuration
|
// ---------------- Configuration
|
||||||
|
|
||||||
@@ -13794,14 +13794,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
|||||||
uint8_t* q = s.ptr + s.len;
|
uint8_t* q = s.ptr + s.len;
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse sign.
|
// Parse sign.
|
||||||
do {
|
do {
|
||||||
@@ -13814,14 +13812,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
||||||
@@ -13873,9 +13869,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
|||||||
if (nd < WUFFS_BASE__PRIVATE_IMPLEMENTATION__HPD__DIGITS_PRECISION) {
|
if (nd < WUFFS_BASE__PRIVATE_IMPLEMENTATION__HPD__DIGITS_PRECISION) {
|
||||||
h->digits[nd++] = (uint8_t)(*p - '0');
|
h->digits[nd++] = (uint8_t)(*p - '0');
|
||||||
dp = (int32_t)nd;
|
dp = (int32_t)nd;
|
||||||
} else if ('0' != *p) {
|
} else {
|
||||||
// Long-tail non-zeroes set the truncated bit.
|
dp++;
|
||||||
h->truncated = true;
|
if ('0' != *p) {
|
||||||
|
// Long-tail non-zeroes set the truncated bit.
|
||||||
|
h->truncated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (*p ==
|
} else if (*p ==
|
||||||
((options &
|
((options &
|
||||||
@@ -13935,14 +13934,12 @@ after_sep:
|
|||||||
after_exp:
|
after_exp:
|
||||||
do {
|
do {
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t exp_sign = +1;
|
int32_t exp_sign = +1;
|
||||||
if (*p == '+') {
|
if (*p == '+') {
|
||||||
@@ -15751,6 +15748,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto hexadecimal;
|
goto hexadecimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
|
|
||||||
} else if ((*p == 'd') || (*p == 'D')) {
|
} else if ((*p == 'd') || (*p == 'D')) {
|
||||||
p++;
|
p++;
|
||||||
@@ -15761,6 +15759,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto decimal;
|
goto decimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
||||||
|
|||||||
+25
-26
@@ -71,15 +71,15 @@ extern "C" {
|
|||||||
// each major.minor branch, the commit count should increase monotonically.
|
// each major.minor branch, the commit count should increase monotonically.
|
||||||
//
|
//
|
||||||
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
|
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
|
||||||
// c677bef7fd69e8f336d1f3aa11eda63bcc29672a committed on 2026-10-18.
|
// 0d8b52336e4c5a27d885f62bc8c4be996a024d70 committed on 2026-10-20.
|
||||||
#define WUFFS_VERSION 0x000040000
|
#define WUFFS_VERSION 0x000040000
|
||||||
#define WUFFS_VERSION_MAJOR 0
|
#define WUFFS_VERSION_MAJOR 0
|
||||||
#define WUFFS_VERSION_MINOR 4
|
#define WUFFS_VERSION_MINOR 4
|
||||||
#define WUFFS_VERSION_PATCH 0
|
#define WUFFS_VERSION_PATCH 0
|
||||||
#define WUFFS_VERSION_PRE_RELEASE_LABEL "alpha.11"
|
#define WUFFS_VERSION_PRE_RELEASE_LABEL "alpha.12"
|
||||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 4041
|
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 4048
|
||||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20261018
|
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20261020
|
||||||
#define WUFFS_VERSION_STRING "0.4.0-alpha.11+4041.20261018"
|
#define WUFFS_VERSION_STRING "0.4.0-alpha.12+4048.20261020"
|
||||||
|
|
||||||
// ---------------- Private Implementation Macros Re-definition Check
|
// ---------------- Private Implementation Macros Re-definition Check
|
||||||
|
|
||||||
@@ -21669,14 +21669,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
uint8_t* q = s.ptr + s.len;
|
uint8_t* q = s.ptr + s.len;
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse sign.
|
// Parse sign.
|
||||||
do {
|
do {
|
||||||
@@ -21689,14 +21687,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
||||||
@@ -21748,9 +21744,12 @@ wuffs_private_impl__high_prec_dec__parse(wuffs_private_impl__high_prec_dec* h,
|
|||||||
if (nd < WUFFS_PRIVATE_IMPL__HPD__DIGITS_PRECISION) {
|
if (nd < WUFFS_PRIVATE_IMPL__HPD__DIGITS_PRECISION) {
|
||||||
h->digits[nd++] = (uint8_t)(*p - '0');
|
h->digits[nd++] = (uint8_t)(*p - '0');
|
||||||
dp = (int32_t)nd;
|
dp = (int32_t)nd;
|
||||||
} else if ('0' != *p) {
|
} else {
|
||||||
// Long-tail non-zeroes set the truncated bit.
|
dp++;
|
||||||
h->truncated = true;
|
if ('0' != *p) {
|
||||||
|
// Long-tail non-zeroes set the truncated bit.
|
||||||
|
h->truncated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (*p ==
|
} else if (*p ==
|
||||||
((options &
|
((options &
|
||||||
@@ -21809,14 +21808,12 @@ after_sep:
|
|||||||
after_exp:
|
after_exp:
|
||||||
do {
|
do {
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||||
for (;; p++) {
|
for (; (p < q) && (*p == '_'); p++) {
|
||||||
if (p >= q) {
|
|
||||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
|
||||||
} else if (*p != '_') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (p >= q) {
|
||||||
|
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t exp_sign = +1;
|
int32_t exp_sign = +1;
|
||||||
if (*p == '+') {
|
if (*p == '+') {
|
||||||
@@ -23586,6 +23583,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto hexadecimal;
|
goto hexadecimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
|
|
||||||
} else if ((*p == 'd') || (*p == 'D')) {
|
} else if ((*p == 'd') || (*p == 'D')) {
|
||||||
p++;
|
p++;
|
||||||
@@ -23596,6 +23594,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
|||||||
if (p < q) {
|
if (p < q) {
|
||||||
goto decimal;
|
goto decimal;
|
||||||
}
|
}
|
||||||
|
goto fail_bad_argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
||||||
|
|||||||
@@ -1082,6 +1082,47 @@ test_wuffs_strconv_parse_number_f64_regular() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Input that ends right after a sign or an exponent marker must be rejected
|
||||||
|
// without reading past the end of the slice. Use DEFAULT_OPTIONS, as
|
||||||
|
// ALLOW_UNDERSCORES takes a different code path.
|
||||||
|
{
|
||||||
|
const char* strs[] = {"", "+", "-", "1e", "1E", "12.5e"};
|
||||||
|
for (size_t i = 0; i < WUFFS_TESTLIB_ARRAY_SIZE(strs); i++) {
|
||||||
|
wuffs_base__result_f64 r = wuffs_base__parse_number_f64(
|
||||||
|
wuffs_base__make_slice_u8((uint8_t*)(void*)strs[i], strlen(strs[i])),
|
||||||
|
WUFFS_BASE__PARSE_NUMBER_XXX__DEFAULT_OPTIONS);
|
||||||
|
if (r.status.repr != wuffs_base__error__bad_argument) {
|
||||||
|
RETURN_FAIL("\"%s\": have \"%s\", want \"%s\"", strs[i], r.status.repr,
|
||||||
|
wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test the integer part being more than 800 digits.
|
||||||
|
{
|
||||||
|
// Initialize buf to "1222...222e-805" with 805 twos.
|
||||||
|
char buf[1024];
|
||||||
|
buf[0] = '1';
|
||||||
|
for (int i = 1; i < 806; i++) {
|
||||||
|
buf[i] = '2';
|
||||||
|
}
|
||||||
|
memcpy(buf + 806, "e-805", 5);
|
||||||
|
|
||||||
|
wuffs_base__result_f64 r = wuffs_base__parse_number_f64(
|
||||||
|
wuffs_base__make_slice_u8((uint8_t*)(void*)buf, 811),
|
||||||
|
WUFFS_BASE__PARSE_NUMBER_XXX__DEFAULT_OPTIONS);
|
||||||
|
uint64_t have =
|
||||||
|
(r.status.repr == NULL)
|
||||||
|
? wuffs_base__ieee_754_bit_representation__from_f64_to_u64(r.value)
|
||||||
|
: fail;
|
||||||
|
uint64_t want = wuffs_base__ieee_754_bit_representation__from_f64_to_u64(
|
||||||
|
1.2222222222222222222222222222222222222222222222222222222222222222);
|
||||||
|
if (have != want) {
|
||||||
|
RETURN_FAIL("\"%s\": have 0x%016" PRIX64 ", want 0x%016" PRIX64,
|
||||||
|
"1222...222e-805", have, want);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1245,6 +1286,23 @@ test_wuffs_strconv_parse_number_u64() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A bare "0x" or "0d" prefix is invalid, even with
|
||||||
|
// ALLOW_MULTIPLE_LEADING_ZEROES. Pass an explicit length (not strlen) so
|
||||||
|
// that the byte just past the end of the slice is a digit, which must not be
|
||||||
|
// read.
|
||||||
|
{
|
||||||
|
const char* strs[] = {"0x7", "0X7", "0d7", "0D7"};
|
||||||
|
for (size_t i = 0; i < WUFFS_TESTLIB_ARRAY_SIZE(strs); i++) {
|
||||||
|
wuffs_base__result_u64 r = wuffs_base__parse_number_u64(
|
||||||
|
wuffs_base__make_slice_u8((uint8_t*)(void*)strs[i], 2),
|
||||||
|
WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES);
|
||||||
|
if (r.status.repr != wuffs_base__error__bad_argument) {
|
||||||
|
RETURN_FAIL("\"%.2s\": have \"%s\", want \"%s\"", strs[i],
|
||||||
|
r.status.repr, wuffs_base__error__bad_argument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Test WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES.
|
// Test WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES.
|
||||||
{
|
{
|
||||||
for (int o = 0; o < 2; o++) {
|
for (int o = 0; o < 2; o++) {
|
||||||
|
|||||||
Reference in new issue
Block a user