Fix -Werror=sign-conversion in intconv-submodule.c
diff --git a/internal/cgen/base/intconv-submodule.c b/internal/cgen/base/intconv-submodule.c
index 34a81f2..859594e 100644
--- a/internal/cgen/base/intconv-submodule.c
+++ b/internal/cgen/base/intconv-submodule.c
@@ -147,7 +147,7 @@
} else if (r.value == 0x8000000000000000) {
wuffs_base__result_i64 ret;
ret.status.repr = NULL;
- ret.value = -0x8000000000000000;
+ ret.value = INT64_MIN;
return ret;
}
goto fail_out_of_bounds;
diff --git a/internal/cgen/data/data.go b/internal/cgen/data/data.go
index aef0227..d35e719 100644
--- a/internal/cgen/data/data.go
+++ b/internal/cgen/data/data.go
@@ -524,11 +524,11 @@
"0, 0x00, 0x00, 0x00, // 0xF0 ..= 0xF7.\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF8 ..= 0xFF.\n // 0 1 2 3 4 5 6 7\n // 8 9 A B C D E F\n};\n\nstatic const uint8_t wuffs_base__private_implementation__encode_base16[16] = {\n 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, // 0x00 ..= 0x07.\n 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, // 0x08 ..= 0x0F.\n};\n\n" +
"" +
"// --------\n\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_i64 //\nwuffs_base__parse_number_i64(wuffs_base__slice_u8 s, uint32_t options) {\n uint8_t* p = s.ptr;\n uint8_t* q = s.ptr + s.len;\n\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n for (; (p < q) && (*p == '_'); p++) {\n }\n }\n\n bool negative = false;\n if (p >= q) {\n goto fail_bad_argument;\n } else if (*p == '-') {\n p++;\n negative = true;\n } else if (*p == '+') {\n p++;\n }\n\n do {\n wuffs_base__result_u64 r = wuffs_base__parse_number_u64(\n wuffs_base__make_slice_u8(p, (size_t)(q - p)), options);\n if (r.status.repr != NULL) {\n wuffs_base__result_i64 ret;\n ret.status.repr = r.status.repr;\n ret.value = 0;\n return ret;\n } else if (negative) {\n if (r.value < 0x8000000000000000) {\n wuffs_base__result_i64 ret;\n ret.status.repr = NULL;\n ret.value = -(int64_t)(r.value);\n return ret;\n } else if (r.value == 0x8000000000000000) {\n wuffs_base__re" +
- "sult_i64 ret;\n ret.status.repr = NULL;\n ret.value = -0x8000000000000000;\n return ret;\n }\n goto fail_out_of_bounds;\n } else if (r.value > 0x7FFFFFFFFFFFFFFF) {\n goto fail_out_of_bounds;\n } else {\n wuffs_base__result_i64 ret;\n ret.status.repr = NULL;\n ret.value = +(int64_t)(r.value);\n return ret;\n }\n } while (0);\n\nfail_bad_argument:\n do {\n wuffs_base__result_i64 ret;\n ret.status.repr = wuffs_base__error__bad_argument;\n ret.value = 0;\n return ret;\n } while (0);\n\nfail_out_of_bounds:\n do {\n wuffs_base__result_i64 ret;\n ret.status.repr = wuffs_base__error__out_of_bounds;\n ret.value = 0;\n return ret;\n } while (0);\n}\n\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_u64 //\nwuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {\n uint8_t* p = s.ptr;\n uint8_t* q = s.ptr + s.len;\n\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n for (; (p < q) && (*p == '_'); p++) {\n }\n }\n\n if (p >= q) " +
- "{\n goto fail_bad_argument;\n\n } else if (*p == '0') {\n p++;\n if (p >= q) {\n goto ok_zero;\n }\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n if (*p == '_') {\n p++;\n for (; p < q; p++) {\n if (*p != '_') {\n if (options &\n WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {\n goto decimal;\n }\n goto fail_bad_argument;\n }\n }\n goto ok_zero;\n }\n }\n\n if ((*p == 'x') || (*p == 'X')) {\n p++;\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n for (; (p < q) && (*p == '_'); p++) {\n }\n }\n if (p < q) {\n goto hexadecimal;\n }\n\n } else if ((*p == 'd') || (*p == 'D')) {\n p++;\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n for (; (p < q) && (*p == '_'); p++) {\n }\n }\n if (p < q) {\n goto decimal;\n }\n }\n\n if (options & WUFFS_BA" +
- "SE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {\n goto decimal;\n }\n goto fail_bad_argument;\n }\n\ndecimal:\n do {\n uint64_t v = wuffs_base__parse_number__decimal_digits[*p++];\n if (v == 0) {\n goto fail_bad_argument;\n }\n v &= 0x0F;\n\n // UINT64_MAX is 18446744073709551615, which is ((10 * max10) + max1).\n const uint64_t max10 = 1844674407370955161u;\n const uint8_t max1 = 5;\n\n for (; p < q; p++) {\n if ((*p == '_') &&\n (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES)) {\n continue;\n }\n uint8_t digit = wuffs_base__parse_number__decimal_digits[*p];\n if (digit == 0) {\n goto fail_bad_argument;\n }\n digit &= 0x0F;\n if ((v > max10) || ((v == max10) && (digit > max1))) {\n goto fail_out_of_bounds;\n }\n v = (10 * v) + ((uint64_t)(digit));\n }\n\n wuffs_base__result_u64 ret;\n ret.status.repr = NULL;\n ret.value = v;\n return ret;\n } while (0);\n\nhexadecimal:\n do {\n uint64_t v = wuffs" +
- "_base__parse_number__hexadecimal_digits[*p++];\n if (v == 0) {\n goto fail_bad_argument;\n }\n v &= 0x0F;\n\n for (; p < q; p++) {\n if ((*p == '_') &&\n (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES)) {\n continue;\n }\n uint8_t digit = wuffs_base__parse_number__hexadecimal_digits[*p];\n if (digit == 0) {\n goto fail_bad_argument;\n }\n digit &= 0x0F;\n if ((v >> 60) != 0) {\n goto fail_out_of_bounds;\n }\n v = (v << 4) | ((uint64_t)(digit));\n }\n\n wuffs_base__result_u64 ret;\n ret.status.repr = NULL;\n ret.value = v;\n return ret;\n } while (0);\n\nok_zero:\n do {\n wuffs_base__result_u64 ret;\n ret.status.repr = NULL;\n ret.value = 0;\n return ret;\n } while (0);\n\nfail_bad_argument:\n do {\n wuffs_base__result_u64 ret;\n ret.status.repr = wuffs_base__error__bad_argument;\n ret.value = 0;\n return ret;\n } while (0);\n\nfail_out_of_bounds:\n do {\n wuffs_base__result_u64 ret;\n ret.status.repr = " +
- "wuffs_base__error__out_of_bounds;\n ret.value = 0;\n return ret;\n } while (0);\n}\n\n" +
+ "sult_i64 ret;\n ret.status.repr = NULL;\n ret.value = INT64_MIN;\n return ret;\n }\n goto fail_out_of_bounds;\n } else if (r.value > 0x7FFFFFFFFFFFFFFF) {\n goto fail_out_of_bounds;\n } else {\n wuffs_base__result_i64 ret;\n ret.status.repr = NULL;\n ret.value = +(int64_t)(r.value);\n return ret;\n }\n } while (0);\n\nfail_bad_argument:\n do {\n wuffs_base__result_i64 ret;\n ret.status.repr = wuffs_base__error__bad_argument;\n ret.value = 0;\n return ret;\n } while (0);\n\nfail_out_of_bounds:\n do {\n wuffs_base__result_i64 ret;\n ret.status.repr = wuffs_base__error__out_of_bounds;\n ret.value = 0;\n return ret;\n } while (0);\n}\n\nWUFFS_BASE__MAYBE_STATIC wuffs_base__result_u64 //\nwuffs_base__parse_number_u64(wuffs_base__slice_u8 s, uint32_t options) {\n uint8_t* p = s.ptr;\n uint8_t* q = s.ptr + s.len;\n\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n for (; (p < q) && (*p == '_'); p++) {\n }\n }\n\n if (p >= q) {\n goto" +
+ " fail_bad_argument;\n\n } else if (*p == '0') {\n p++;\n if (p >= q) {\n goto ok_zero;\n }\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n if (*p == '_') {\n p++;\n for (; p < q; p++) {\n if (*p != '_') {\n if (options &\n WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {\n goto decimal;\n }\n goto fail_bad_argument;\n }\n }\n goto ok_zero;\n }\n }\n\n if ((*p == 'x') || (*p == 'X')) {\n p++;\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n for (; (p < q) && (*p == '_'); p++) {\n }\n }\n if (p < q) {\n goto hexadecimal;\n }\n\n } else if ((*p == 'd') || (*p == 'D')) {\n p++;\n if (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES) {\n for (; (p < q) && (*p == '_'); p++) {\n }\n }\n if (p < q) {\n goto decimal;\n }\n }\n\n if (options & WUFFS_BASE__PARSE_" +
+ "NUMBER_XXX__ALLOW_MULTIPLE_LEADING_ZEROES) {\n goto decimal;\n }\n goto fail_bad_argument;\n }\n\ndecimal:\n do {\n uint64_t v = wuffs_base__parse_number__decimal_digits[*p++];\n if (v == 0) {\n goto fail_bad_argument;\n }\n v &= 0x0F;\n\n // UINT64_MAX is 18446744073709551615, which is ((10 * max10) + max1).\n const uint64_t max10 = 1844674407370955161u;\n const uint8_t max1 = 5;\n\n for (; p < q; p++) {\n if ((*p == '_') &&\n (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES)) {\n continue;\n }\n uint8_t digit = wuffs_base__parse_number__decimal_digits[*p];\n if (digit == 0) {\n goto fail_bad_argument;\n }\n digit &= 0x0F;\n if ((v > max10) || ((v == max10) && (digit > max1))) {\n goto fail_out_of_bounds;\n }\n v = (10 * v) + ((uint64_t)(digit));\n }\n\n wuffs_base__result_u64 ret;\n ret.status.repr = NULL;\n ret.value = v;\n return ret;\n } while (0);\n\nhexadecimal:\n do {\n uint64_t v = wuffs_base__par" +
+ "se_number__hexadecimal_digits[*p++];\n if (v == 0) {\n goto fail_bad_argument;\n }\n v &= 0x0F;\n\n for (; p < q; p++) {\n if ((*p == '_') &&\n (options & WUFFS_BASE__PARSE_NUMBER_XXX__ALLOW_UNDERSCORES)) {\n continue;\n }\n uint8_t digit = wuffs_base__parse_number__hexadecimal_digits[*p];\n if (digit == 0) {\n goto fail_bad_argument;\n }\n digit &= 0x0F;\n if ((v >> 60) != 0) {\n goto fail_out_of_bounds;\n }\n v = (v << 4) | ((uint64_t)(digit));\n }\n\n wuffs_base__result_u64 ret;\n ret.status.repr = NULL;\n ret.value = v;\n return ret;\n } while (0);\n\nok_zero:\n do {\n wuffs_base__result_u64 ret;\n ret.status.repr = NULL;\n ret.value = 0;\n return ret;\n } while (0);\n\nfail_bad_argument:\n do {\n wuffs_base__result_u64 ret;\n ret.status.repr = wuffs_base__error__bad_argument;\n ret.value = 0;\n return ret;\n } while (0);\n\nfail_out_of_bounds:\n do {\n wuffs_base__result_u64 ret;\n ret.status.repr = wuffs_base" +
+ "__error__out_of_bounds;\n ret.value = 0;\n return ret;\n } while (0);\n}\n\n" +
"" +
"// --------\n\n// wuffs_base__render_number__first_hundred contains the decimal encodings of\n// the first one hundred numbers [0 ..= 99].\nstatic const uint8_t wuffs_base__render_number__first_hundred[200] = {\n '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', //\n '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', //\n '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', //\n '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', //\n '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', //\n '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', //\n '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', //\n '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', //\n '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', //\n '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', //\n '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', //\n '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', //\n '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', //\n '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', //\n '" +
"7', '0', '7', '1', '7', '2', '7', '3', '7', '4', //\n '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', //\n '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', //\n '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', //\n '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', //\n '9', '5', '9', '6', '9', '7', '9', '8', '9', '9', //\n};\n\nstatic size_t //\nwuffs_base__private_implementation__render_number_u64(wuffs_base__slice_u8 dst,\n uint64_t x,\n uint32_t options,\n bool neg) {\n uint8_t buf[WUFFS_BASE__U64__BYTE_LENGTH__MAX_INCL];\n uint8_t* ptr = &buf[0] + sizeof(buf);\n\n while (x >= 100) {\n size_t index = ((size_t)((x % 100) * 2));\n x /= 100;\n uint8_t s0 = wuffs_base__render_number__first_hundred[index + 0];\n uint8_t s1 = wuffs_base__render_number__first_hundred[index + 1];\n ptr -= 2;\n ptr[0] = s0;\n ptr[1] = s1;\n }\n\n if " +
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c
index 9370e9c..0d2f31e 100644
--- a/release/c/wuffs-unsupported-snapshot.c
+++ b/release/c/wuffs-unsupported-snapshot.c
@@ -14281,7 +14281,7 @@
} else if (r.value == 0x8000000000000000) {
wuffs_base__result_i64 ret;
ret.status.repr = NULL;
- ret.value = -0x8000000000000000;
+ ret.value = INT64_MIN;
return ret;
}
goto fail_out_of_bounds;