mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b69ebf4606 | ||
|
|
5527993842 | ||
|
|
32a23a9bb5 | ||
|
|
d1a6f2c3de | ||
|
|
40445d992b | ||
|
|
e7b15476b8 | ||
|
|
ec71f9c6d8 | ||
|
|
a138188d57 | ||
|
|
d910658bce | ||
|
|
00d5e35865 | ||
|
|
05f0172b93 |
No files matched your search
@@ -1,6 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## 2024-04-19 version 0.3.4
|
||||
|
||||
- Have `std/png` ignore tRNS chunks for color types 4 (YA) and 6 (RGBA).
|
||||
|
||||
|
||||
## 2023-04-08 version 0.3.3
|
||||
|
||||
The `wuffs_base__parse_number_f64` function has been further optimized.
|
||||
|
||||
|
||||
## 2023-04-07 version 0.3.2
|
||||
|
||||
The `std/bmp` and `std/nie` image decoders' `decode_frame` method now allow
|
||||
|
||||
@@ -276,14 +276,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
uint8_t* q = s.ptr + s.len;
|
||||
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
|
||||
// Parse sign.
|
||||
do {
|
||||
@@ -296,14 +294,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
break;
|
||||
}
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
||||
@@ -355,9 +351,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
if (nd < WUFFS_BASE__PRIVATE_IMPLEMENTATION__HPD__DIGITS_PRECISION) {
|
||||
h->digits[nd++] = (uint8_t)(*p - '0');
|
||||
dp = (int32_t)nd;
|
||||
} else if ('0' != *p) {
|
||||
// Long-tail non-zeroes set the truncated bit.
|
||||
h->truncated = true;
|
||||
} else {
|
||||
dp++;
|
||||
if ('0' != *p) {
|
||||
// Long-tail non-zeroes set the truncated bit.
|
||||
h->truncated = true;
|
||||
}
|
||||
}
|
||||
} else if (*p ==
|
||||
((options &
|
||||
@@ -417,14 +416,12 @@ after_sep:
|
||||
after_exp:
|
||||
do {
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
|
||||
int32_t exp_sign = +1;
|
||||
if (*p == '+') {
|
||||
@@ -1304,24 +1301,41 @@ wuffs_base__private_implementation__high_prec_dec__to_f64(
|
||||
// approach taken in wuffs_base__parse_number_f64. The latter is optimized
|
||||
// for the common cases (e.g. assuming no underscores or a leading '+'
|
||||
// sign) rather than the full set of cases allowed by the Wuffs API.
|
||||
if (h->num_digits <= 19) {
|
||||
//
|
||||
// When we have 19 or fewer mantissa digits, run Eisel-Lemire once (trying
|
||||
// for an exact result). When we have more than 19 mantissa digits, run it
|
||||
// twice to get a lower and upper bound. We still have an exact result
|
||||
// (within f64's rounding margin) if both bounds are equal (and valid).
|
||||
uint32_t i_max = h->num_digits;
|
||||
if (i_max > 19) {
|
||||
i_max = 19;
|
||||
}
|
||||
int32_t exp10 = h->decimal_point - ((int32_t)i_max);
|
||||
if ((-307 <= exp10) && (exp10 <= 288)) {
|
||||
uint64_t man = 0;
|
||||
uint32_t i;
|
||||
for (i = 0; i < h->num_digits; i++) {
|
||||
for (i = 0; i < i_max; i++) {
|
||||
man = (10 * man) + h->digits[i];
|
||||
}
|
||||
int32_t exp10 = h->decimal_point - ((int32_t)(h->num_digits));
|
||||
if ((man != 0) && (-307 <= exp10) && (exp10 <= 288)) {
|
||||
int64_t r =
|
||||
while (man != 0) { // The 'while' is just an 'if' that we can 'break'.
|
||||
int64_t r0 =
|
||||
wuffs_base__private_implementation__parse_number_f64_eisel_lemire(
|
||||
man, exp10);
|
||||
if (r >= 0) {
|
||||
wuffs_base__result_f64 ret;
|
||||
ret.status.repr = NULL;
|
||||
ret.value = wuffs_base__ieee_754_bit_representation__from_u64_to_f64(
|
||||
((uint64_t)r) | (((uint64_t)(h->negative)) << 63));
|
||||
return ret;
|
||||
man + 0, exp10);
|
||||
if (r0 < 0) {
|
||||
break;
|
||||
} else if (h->num_digits > 19) {
|
||||
int64_t r1 =
|
||||
wuffs_base__private_implementation__parse_number_f64_eisel_lemire(
|
||||
man + 1, exp10);
|
||||
if (r1 != r0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
wuffs_base__result_f64 ret;
|
||||
ret.status.repr = NULL;
|
||||
ret.value = wuffs_base__ieee_754_bit_representation__from_u64_to_f64(
|
||||
((uint64_t)r0) | (((uint64_t)(h->negative)) << 63));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,6 +219,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
if (p < q) {
|
||||
goto hexadecimal;
|
||||
}
|
||||
goto fail_bad_argument;
|
||||
|
||||
} else if ((*p == 'd') || (*p == 'D')) {
|
||||
p++;
|
||||
@@ -229,6 +230,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
if (p < q) {
|
||||
goto decimal;
|
||||
}
|
||||
goto fail_bad_argument;
|
||||
}
|
||||
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/google/wuffs/lib/litonlylzma"
|
||||
)
|
||||
|
||||
func ExampleRoundTripLZMA() {
|
||||
func Example_roundTripLZMA() {
|
||||
original := []byte("Hello world.\n")
|
||||
compressed, err := litonlylzma.FileFormatLZMA.Encode(nil, original)
|
||||
if err != nil {
|
||||
@@ -49,7 +49,7 @@ func ExampleRoundTripLZMA() {
|
||||
// Hello world.
|
||||
}
|
||||
|
||||
func ExampleRoundTripXz() {
|
||||
func Example_roundTripXz() {
|
||||
original := []byte("Hello world.\n")
|
||||
compressed, err := litonlylzma.FileFormatXz.Encode(nil, original)
|
||||
if err != nil {
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"github.com/google/wuffs/lib/zlibcut"
|
||||
)
|
||||
|
||||
func ExampleCut() {
|
||||
func Example() {
|
||||
const sonnet18 = "" +
|
||||
"Shall I compare thee to a summer’s day?\n" +
|
||||
"Thou art more lovely and more temperate.\n" +
|
||||
|
||||
@@ -13793,14 +13793,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
uint8_t* q = s.ptr + s.len;
|
||||
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
|
||||
// Parse sign.
|
||||
do {
|
||||
@@ -13813,14 +13811,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
break;
|
||||
}
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
// Parse digits, up to (and including) a '.', 'E' or 'e'. Examples for each
|
||||
@@ -13872,9 +13868,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
if (nd < WUFFS_BASE__PRIVATE_IMPLEMENTATION__HPD__DIGITS_PRECISION) {
|
||||
h->digits[nd++] = (uint8_t)(*p - '0');
|
||||
dp = (int32_t)nd;
|
||||
} else if ('0' != *p) {
|
||||
// Long-tail non-zeroes set the truncated bit.
|
||||
h->truncated = true;
|
||||
} else {
|
||||
dp++;
|
||||
if ('0' != *p) {
|
||||
// Long-tail non-zeroes set the truncated bit.
|
||||
h->truncated = true;
|
||||
}
|
||||
}
|
||||
} else if (*p ==
|
||||
((options &
|
||||
@@ -13934,14 +13933,12 @@ after_sep:
|
||||
after_exp:
|
||||
do {
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
|
||||
int32_t exp_sign = +1;
|
||||
if (*p == '+') {
|
||||
@@ -14821,24 +14818,41 @@ wuffs_base__private_implementation__high_prec_dec__to_f64(
|
||||
// approach taken in wuffs_base__parse_number_f64. The latter is optimized
|
||||
// for the common cases (e.g. assuming no underscores or a leading '+'
|
||||
// sign) rather than the full set of cases allowed by the Wuffs API.
|
||||
if (h->num_digits <= 19) {
|
||||
//
|
||||
// When we have 19 or fewer mantissa digits, run Eisel-Lemire once (trying
|
||||
// for an exact result). When we have more than 19 mantissa digits, run it
|
||||
// twice to get a lower and upper bound. We still have an exact result
|
||||
// (within f64's rounding margin) if both bounds are equal (and valid).
|
||||
uint32_t i_max = h->num_digits;
|
||||
if (i_max > 19) {
|
||||
i_max = 19;
|
||||
}
|
||||
int32_t exp10 = h->decimal_point - ((int32_t)i_max);
|
||||
if ((-307 <= exp10) && (exp10 <= 288)) {
|
||||
uint64_t man = 0;
|
||||
uint32_t i;
|
||||
for (i = 0; i < h->num_digits; i++) {
|
||||
for (i = 0; i < i_max; i++) {
|
||||
man = (10 * man) + h->digits[i];
|
||||
}
|
||||
int32_t exp10 = h->decimal_point - ((int32_t)(h->num_digits));
|
||||
if ((man != 0) && (-307 <= exp10) && (exp10 <= 288)) {
|
||||
int64_t r =
|
||||
while (man != 0) { // The 'while' is just an 'if' that we can 'break'.
|
||||
int64_t r0 =
|
||||
wuffs_base__private_implementation__parse_number_f64_eisel_lemire(
|
||||
man, exp10);
|
||||
if (r >= 0) {
|
||||
wuffs_base__result_f64 ret;
|
||||
ret.status.repr = NULL;
|
||||
ret.value = wuffs_base__ieee_754_bit_representation__from_u64_to_f64(
|
||||
((uint64_t)r) | (((uint64_t)(h->negative)) << 63));
|
||||
return ret;
|
||||
man + 0, exp10);
|
||||
if (r0 < 0) {
|
||||
break;
|
||||
} else if (h->num_digits > 19) {
|
||||
int64_t r1 =
|
||||
wuffs_base__private_implementation__parse_number_f64_eisel_lemire(
|
||||
man + 1, exp10);
|
||||
if (r1 != r0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
wuffs_base__result_f64 ret;
|
||||
ret.status.repr = NULL;
|
||||
ret.value = wuffs_base__ieee_754_bit_representation__from_u64_to_f64(
|
||||
((uint64_t)r0) | (((uint64_t)(h->negative)) << 63));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15733,6 +15747,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
if (p < q) {
|
||||
goto hexadecimal;
|
||||
}
|
||||
goto fail_bad_argument;
|
||||
|
||||
} else if ((*p == 'd') || (*p == 'D')) {
|
||||
p++;
|
||||
@@ -15743,6 +15758,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
if (p < q) {
|
||||
goto decimal;
|
||||
}
|
||||
goto fail_bad_argument;
|
||||
}
|
||||
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
||||
@@ -41551,20 +41567,22 @@ wuffs_png__decoder__decode_other_chunk(
|
||||
self->private_impl.f_seen_srgb = true;
|
||||
}
|
||||
} else if (self->private_impl.f_chunk_type == 1397641844) {
|
||||
if (self->private_impl.f_seen_trns || (self->private_impl.f_color_type > 3) || ((self->private_impl.f_color_type == 3) && ! self->private_impl.f_seen_plte)) {
|
||||
if (self->private_impl.f_seen_trns || ((self->private_impl.f_color_type == 3) && ! self->private_impl.f_seen_plte)) {
|
||||
status = wuffs_base__make_status(wuffs_png__error__bad_chunk);
|
||||
goto exit;
|
||||
}
|
||||
if (a_src) {
|
||||
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9);
|
||||
status = wuffs_png__decoder__decode_trns(self, a_src);
|
||||
if (a_src) {
|
||||
iop_a_src = a_src->data.ptr + a_src->meta.ri;
|
||||
}
|
||||
if (status.repr) {
|
||||
goto suspend;
|
||||
} else if (self->private_impl.f_color_type > 3) {
|
||||
} else {
|
||||
if (a_src) {
|
||||
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9);
|
||||
status = wuffs_png__decoder__decode_trns(self, a_src);
|
||||
if (a_src) {
|
||||
iop_a_src = a_src->data.ptr + a_src->meta.ri;
|
||||
}
|
||||
if (status.repr) {
|
||||
goto suspend;
|
||||
}
|
||||
}
|
||||
self->private_impl.f_seen_trns = true;
|
||||
}
|
||||
|
||||
+69
-51
@@ -85,15 +85,15 @@ extern "C" {
|
||||
// each major.minor branch, the commit count should increase monotonically.
|
||||
//
|
||||
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
|
||||
// 67d9a68c49c01319baf3590b5695cb954a09c2c6 committed on 2023-04-07.
|
||||
#define WUFFS_VERSION 0x000030002
|
||||
// 55279938422060f30cd487173b98a651da075e3a committed on 2026-10-20.
|
||||
#define WUFFS_VERSION 0x000030006
|
||||
#define WUFFS_VERSION_MAJOR 0
|
||||
#define WUFFS_VERSION_MINOR 3
|
||||
#define WUFFS_VERSION_PATCH 2
|
||||
#define WUFFS_VERSION_PATCH 6
|
||||
#define WUFFS_VERSION_PRE_RELEASE_LABEL ""
|
||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3396
|
||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20230407
|
||||
#define WUFFS_VERSION_STRING "0.3.2+3396.20230407"
|
||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3407
|
||||
#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20261020
|
||||
#define WUFFS_VERSION_STRING "0.3.6+3407.20261020"
|
||||
|
||||
// ---------------- Configuration
|
||||
|
||||
@@ -13794,14 +13794,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
uint8_t* q = s.ptr + s.len;
|
||||
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
|
||||
// Parse sign.
|
||||
do {
|
||||
@@ -13814,14 +13812,12 @@ wuffs_base__private_implementation__high_prec_dec__parse(
|
||||
break;
|
||||
}
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
// 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) {
|
||||
h->digits[nd++] = (uint8_t)(*p - '0');
|
||||
dp = (int32_t)nd;
|
||||
} else if ('0' != *p) {
|
||||
// Long-tail non-zeroes set the truncated bit.
|
||||
h->truncated = true;
|
||||
} else {
|
||||
dp++;
|
||||
if ('0' != *p) {
|
||||
// Long-tail non-zeroes set the truncated bit.
|
||||
h->truncated = true;
|
||||
}
|
||||
}
|
||||
} else if (*p ==
|
||||
((options &
|
||||
@@ -13935,14 +13934,12 @@ after_sep:
|
||||
after_exp:
|
||||
do {
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {
|
||||
for (;; p++) {
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
} else if (*p != '_') {
|
||||
break;
|
||||
}
|
||||
for (; (p < q) && (*p == '_'); p++) {
|
||||
}
|
||||
}
|
||||
if (p >= q) {
|
||||
return wuffs_base__make_status(wuffs_base__error__bad_argument);
|
||||
}
|
||||
|
||||
int32_t exp_sign = +1;
|
||||
if (*p == '+') {
|
||||
@@ -14822,24 +14819,41 @@ wuffs_base__private_implementation__high_prec_dec__to_f64(
|
||||
// approach taken in wuffs_base__parse_number_f64. The latter is optimized
|
||||
// for the common cases (e.g. assuming no underscores or a leading '+'
|
||||
// sign) rather than the full set of cases allowed by the Wuffs API.
|
||||
if (h->num_digits <= 19) {
|
||||
//
|
||||
// When we have 19 or fewer mantissa digits, run Eisel-Lemire once (trying
|
||||
// for an exact result). When we have more than 19 mantissa digits, run it
|
||||
// twice to get a lower and upper bound. We still have an exact result
|
||||
// (within f64's rounding margin) if both bounds are equal (and valid).
|
||||
uint32_t i_max = h->num_digits;
|
||||
if (i_max > 19) {
|
||||
i_max = 19;
|
||||
}
|
||||
int32_t exp10 = h->decimal_point - ((int32_t)i_max);
|
||||
if ((-307 <= exp10) && (exp10 <= 288)) {
|
||||
uint64_t man = 0;
|
||||
uint32_t i;
|
||||
for (i = 0; i < h->num_digits; i++) {
|
||||
for (i = 0; i < i_max; i++) {
|
||||
man = (10 * man) + h->digits[i];
|
||||
}
|
||||
int32_t exp10 = h->decimal_point - ((int32_t)(h->num_digits));
|
||||
if ((man != 0) && (-307 <= exp10) && (exp10 <= 288)) {
|
||||
int64_t r =
|
||||
while (man != 0) { // The 'while' is just an 'if' that we can 'break'.
|
||||
int64_t r0 =
|
||||
wuffs_base__private_implementation__parse_number_f64_eisel_lemire(
|
||||
man, exp10);
|
||||
if (r >= 0) {
|
||||
wuffs_base__result_f64 ret;
|
||||
ret.status.repr = NULL;
|
||||
ret.value = wuffs_base__ieee_754_bit_representation__from_u64_to_f64(
|
||||
((uint64_t)r) | (((uint64_t)(h->negative)) << 63));
|
||||
return ret;
|
||||
man + 0, exp10);
|
||||
if (r0 < 0) {
|
||||
break;
|
||||
} else if (h->num_digits > 19) {
|
||||
int64_t r1 =
|
||||
wuffs_base__private_implementation__parse_number_f64_eisel_lemire(
|
||||
man + 1, exp10);
|
||||
if (r1 != r0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
wuffs_base__result_f64 ret;
|
||||
ret.status.repr = NULL;
|
||||
ret.value = wuffs_base__ieee_754_bit_representation__from_u64_to_f64(
|
||||
((uint64_t)r0) | (((uint64_t)(h->negative)) << 63));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15734,6 +15748,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
if (p < q) {
|
||||
goto hexadecimal;
|
||||
}
|
||||
goto fail_bad_argument;
|
||||
|
||||
} else if ((*p == 'd') || (*p == 'D')) {
|
||||
p++;
|
||||
@@ -15744,6 +15759,7 @@ wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
if (p < q) {
|
||||
goto decimal;
|
||||
}
|
||||
goto fail_bad_argument;
|
||||
}
|
||||
|
||||
if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {
|
||||
@@ -41552,20 +41568,22 @@ wuffs_png__decoder__decode_other_chunk(
|
||||
self->private_impl.f_seen_srgb = true;
|
||||
}
|
||||
} else if (self->private_impl.f_chunk_type == 1397641844) {
|
||||
if (self->private_impl.f_seen_trns || (self->private_impl.f_color_type > 3) || ((self->private_impl.f_color_type == 3) && ! self->private_impl.f_seen_plte)) {
|
||||
if (self->private_impl.f_seen_trns || ((self->private_impl.f_color_type == 3) && ! self->private_impl.f_seen_plte)) {
|
||||
status = wuffs_base__make_status(wuffs_png__error__bad_chunk);
|
||||
goto exit;
|
||||
}
|
||||
if (a_src) {
|
||||
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9);
|
||||
status = wuffs_png__decoder__decode_trns(self, a_src);
|
||||
if (a_src) {
|
||||
iop_a_src = a_src->data.ptr + a_src->meta.ri;
|
||||
}
|
||||
if (status.repr) {
|
||||
goto suspend;
|
||||
} else if (self->private_impl.f_color_type > 3) {
|
||||
} else {
|
||||
if (a_src) {
|
||||
a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
|
||||
}
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9);
|
||||
status = wuffs_png__decoder__decode_trns(self, a_src);
|
||||
if (a_src) {
|
||||
iop_a_src = a_src->data.ptr + a_src->meta.ri;
|
||||
}
|
||||
if (status.repr) {
|
||||
goto suspend;
|
||||
}
|
||||
}
|
||||
self->private_impl.f_seen_trns = true;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#define WUFFS_CONFIG__MODULE__NIE
|
||||
#define WUFFS_CONFIG__MODULE__PNG
|
||||
#define WUFFS_CONFIG__MODULE__TGA
|
||||
#define WUFFS_CONFIG__MODULE__WBMP
|
||||
#define WUFFS_CONFIG__MODULE__ZLIB
|
||||
|
||||
// If building this program in an environment that doesn't easily accommodate
|
||||
@@ -123,10 +124,8 @@ handle_image_decoder(wuffs_base__io_buffer src,
|
||||
dec = wuffs_tga__decoder::alloc_as__wuffs_base__image_decoder();
|
||||
break;
|
||||
case WUFFS_BASE__FOURCC__WBMP:
|
||||
// Unsupported. wuffs_base__magic_number_guess_fourcc can sometimes
|
||||
// return false positives for WBMP. The WBMP file format doesn't
|
||||
// start with a "magic" identifier.
|
||||
return unsupported_file_format;
|
||||
dec = wuffs_wbmp__decoder::alloc_as__wuffs_base__image_decoder();
|
||||
break;
|
||||
default:
|
||||
return unsupported_file_format;
|
||||
}
|
||||
@@ -169,6 +168,9 @@ handle_image_decoder(wuffs_base__io_buffer src,
|
||||
return df_status.message();
|
||||
}
|
||||
}
|
||||
if (src.meta.ri != src.meta.wi) {
|
||||
return skipped;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,7 @@ var u64TestCases = []uint64{
|
||||
0x44B52D02C7E14AF6,
|
||||
0x46293E5939A08CEA,
|
||||
0x54B249AD2594C37D,
|
||||
0x54B2987670ADB613,
|
||||
0x7BBA44DF832B8D46,
|
||||
0x7BF06B0BB1FB384C,
|
||||
0x7C2485CE9E7A065F,
|
||||
|
||||
@@ -615,11 +615,20 @@ pri func decoder.decode_other_chunk?(src: base.io_reader, framy: base.bool) {
|
||||
}
|
||||
|
||||
} else if this.chunk_type == 'tRNS'le {
|
||||
if this.seen_trns or (this.color_type > 3) or
|
||||
if this.seen_trns or
|
||||
((this.color_type == 3) and (not this.seen_plte)) {
|
||||
return "#bad chunk"
|
||||
} else if this.color_type > 3 {
|
||||
// No-op, ignoring the chunk. The PNG spec section "11.3.2.1
|
||||
// tRNS Transparency" says that "A tRNS chunk shall not appear
|
||||
// for colour types 4 and 6, since a full alpha channel is
|
||||
// already present in those cases." However, some real-world
|
||||
// PNG images (incorrectly) have these. libpng treats this as a
|
||||
// "benign error", not a fatal one. See
|
||||
// https://github.com/google/wuffs/issues/146
|
||||
} else {
|
||||
this.decode_trns?(src: args.src)
|
||||
}
|
||||
this.decode_trns?(src: args.src)
|
||||
this.seen_trns = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "bzlib.h"
|
||||
|
||||
const char* //
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
// #define WUFFS_MIMICLIB_USE_LIBDEFLATE_INSTEAD_OF_ZLIB 1
|
||||
// #define WUFFS_MIMICLIB_USE_MINIZ_INSTEAD_OF_ZLIB 1
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// -------------------------------- WUFFS_MIMICLIB_USE_XXX_INSTEAD_OF_ZLIB
|
||||
#if defined(WUFFS_MIMICLIB_USE_LIBDEFLATE_INSTEAD_OF_ZLIB)
|
||||
#include "libdeflate.h"
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "gif_lib.h"
|
||||
|
||||
int //
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
// #define WUFFS_MIMICLIB_USE_LODEPNG_INSTEAD_OF_LIBPNG 1
|
||||
// #define WUFFS_MIMICLIB_USE_STB_IMAGE_INSTEAD_OF_LIBPNG 1
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// -------------------------------- WUFFS_MIMICLIB_USE_XXX_INSTEAD_OF_LIBPNG
|
||||
#if defined(WUFFS_MIMICLIB_USE_LIBSPNG_INSTEAD_OF_LIBPNG)
|
||||
|
||||
|
||||
@@ -1026,6 +1026,7 @@ test_wuffs_strconv_parse_number_f64_regular() {
|
||||
{.want = 0x46293E5939A08CEA, .str = "1e30"},
|
||||
{.want = 0x54B249AD2594C37D, .str = "+1E+100"},
|
||||
{.want = 0x54B249AD2594C37D, .str = "+_1_E_+_1_0_0_"},
|
||||
{.want = 0x54B2987670ADB613, .str = "1.0168286519992372611942638e+100"},
|
||||
{.want = 0x7BBA44DF832B8D46, .str = "1e+288"},
|
||||
{.want = 0x7BF06B0BB1FB384C, .str = "1e+289"},
|
||||
{.want = 0x7C2485CE9E7A065F, .str = "1e+290"},
|
||||
@@ -1943,6 +1944,19 @@ test_wuffs_strconv_render_number_f64() {
|
||||
"4.000",
|
||||
.want_4g = "1e+100",
|
||||
},
|
||||
{
|
||||
.x = 0x54B2987670ADB613,
|
||||
.want__e = "1.0168286519992373e+100",
|
||||
.want__f = "10168286519992373000000000000000000000000000000000"
|
||||
"00000000000000000000000000000000000000000000000000"
|
||||
"0",
|
||||
.want_0g = "1e+100",
|
||||
.want_2e = "1.02e+100",
|
||||
.want_3f = "10168286519992372611942638135241625267907715220891"
|
||||
"31363562982164291689352904657807934098133246961254"
|
||||
"4.000",
|
||||
.want_4g = "1.017e+100",
|
||||
},
|
||||
{
|
||||
.x = 0x7BBA44DF832B8D46,
|
||||
.want__e = "1e+288",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
𝔸 U+1D538 MATHEMATICAL DOUBLE-STRUCK CAPITAL A. UTF-8: [F0 9D 94 B8].
|
||||
|
||||
This code point is outside of the Unicode BMP (Basic Multilingual Plane), but
|
||||
its Unicode Category is Lu (Letter, uppercase), so it is still a valid file
|
||||
path in terms of pkg.go.dev and its golang.org/x/mod/module package:
|
||||
|
||||
https://github.com/golang/mod/blob/dc121ce20ffab6bb810a0f231cfa9c24d3e51b29/module/module.go#L293
|
||||
File renamed without changes.
@@ -1,3 +0,0 @@
|
||||
😻 U+1F63B SMILING CAT FACE WITH HEART-SHAPED EYES. UTF-8: [F0 9F 98 BB].
|
||||
|
||||
This code point is outside of the Unicode BMP (Basic Multilingual Plane).
|
||||
Reference in new issue
Block a user