mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Add wuffs_base__parse_number_xxx options arg
This commit is contained in:
1 parent
832edf7227
commit
6b7ce30e32
9 files changed
+83
-53
No files matched your search
@@ -3922,6 +3922,14 @@ wuffs_base__pixel_swizzler::swizzle_interleaved_from_slice(
|
||||
|
||||
// ---------------- String Conversions
|
||||
|
||||
// Options (bitwise or'ed together) for wuffs_base__parse_number_xxx
|
||||
// functions. The XXX options apply to both integer and floating point. The FXX
|
||||
// options apply only to floating point.
|
||||
|
||||
#define WUFFS_BASE__PARSE_NUMBER_XXX__DEFAULT_OPTIONS ((uint32_t)0x00000000)
|
||||
|
||||
// --------
|
||||
|
||||
// Options (bitwise or'ed together) for wuffs_base__render_number_xxx
|
||||
// functions. The XXX options apply to both integer and floating point. The FXX
|
||||
// options apply only to floating point.
|
||||
@@ -4005,7 +4013,7 @@ wuffs_base__pixel_swizzler::swizzle_interleaved_from_slice(
|
||||
// function requires the WUFFS_CONFIG__MODULE__BASE__F64CONV sub-module, not
|
||||
// just WUFFS_CONFIG__MODULE__BASE__CORE.
|
||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //
|
||||
wuffs_base__parse_number_f64(wuffs_base__slice_u8 s);
|
||||
wuffs_base__parse_number_f64(wuffs_base__slice_u8 s, uint32_t options);
|
||||
|
||||
// --------
|
||||
|
||||
@@ -4049,7 +4057,7 @@ wuffs_base__ieee_754_bit_representation__to_f64(uint64_t u) {
|
||||
// It is similar to wuffs_base__parse_number_u64 but it returns a signed
|
||||
// integer, not an unsigned integer. It also allows a leading '+' or '-'.
|
||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__result_i64 //
|
||||
wuffs_base__parse_number_i64(wuffs_base__slice_u8 s);
|
||||
wuffs_base__parse_number_i64(wuffs_base__slice_u8 s, uint32_t options);
|
||||
|
||||
// wuffs_base__parse_number_u64 parses the ASCII integer in s. For example, if
|
||||
// s contains the bytes "123" then it will return the uint64_t 123.
|
||||
@@ -4076,7 +4084,7 @@ wuffs_base__parse_number_i64(wuffs_base__slice_u8 s);
|
||||
// opening "0d" or "0X" that denotes base-10 or base-16. For example,
|
||||
// "__0D_1_002" would successfully parse as "one thousand and two".
|
||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__result_u64 //
|
||||
wuffs_base__parse_number_u64(wuffs_base__slice_u8 s);
|
||||
wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options);
|
||||
|
||||
// --------
|
||||
|
||||
@@ -10933,7 +10941,7 @@ wuffs_base__private_implementation__is_decimal_digit(uint8_t c) {
|
||||
}
|
||||
|
||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__result_f64 //
|
||||
wuffs_base__parse_number_f64(wuffs_base__slice_u8 s) {
|
||||
wuffs_base__parse_number_f64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
// In practice, almost all "dd.ddddE±xxx" numbers can be represented
|
||||
// losslessly by a uint64_t mantissa "dddddd" and an int32_t base-10
|
||||
// exponent, adjusting "xxx" for the position (if present) of the decimal
|
||||
@@ -11548,7 +11556,7 @@ static const uint8_t wuffs_base__parse_number__hexadecimal_digits[256] = {
|
||||
// --------
|
||||
|
||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__result_i64 //
|
||||
wuffs_base__parse_number_i64(wuffs_base__slice_u8 s) {
|
||||
wuffs_base__parse_number_i64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
uint8_t* p = s.ptr;
|
||||
uint8_t* q = s.ptr + s.len;
|
||||
|
||||
@@ -11567,7 +11575,7 @@ wuffs_base__parse_number_i64(wuffs_base__slice_u8 s) {
|
||||
|
||||
do {
|
||||
wuffs_base__result_u64 r = wuffs_base__parse_number_u64(
|
||||
wuffs_base__make_slice_u8(p, (size_t)(q - p)));
|
||||
wuffs_base__make_slice_u8(p, (size_t)(q - p)), options);
|
||||
if (r.status.repr != NULL) {
|
||||
wuffs_base__result_i64 ret;
|
||||
ret.status.repr = r.status.repr;
|
||||
@@ -11609,7 +11617,7 @@ fail_out_of_bounds:
|
||||
}
|
||||
|
||||
WUFFS_BASE__MAYBE_STATIC wuffs_base__result_u64 //
|
||||
wuffs_base__parse_number_u64(wuffs_base__slice_u8 s) {
|
||||
wuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {
|
||||
uint8_t* p = s.ptr;
|
||||
uint8_t* q = s.ptr + s.len;
|
||||
|
||||
|
||||
Reference in new issue
Block a user