Add reusable strict JSON, rate limiting, and sealed secrets
This commit is contained in:
10 files changed
+778
-40
No files matched your search
@@ -606,7 +606,8 @@ namespace Void::Json
|
||||
// (\uD800-\uDBFF followed by \uDC00-\uDFFF)
|
||||
// into one code point, so astral characters
|
||||
// (emoji, …) become valid 4-byte UTF-8
|
||||
// instead of two invalid encoded surrogates.
|
||||
// instead of two invalid encoded
|
||||
// surrogates.
|
||||
if (cp >= 0xD800 && cp <= 0xDBFF) {
|
||||
unsigned lo = 0;
|
||||
if (pos + 1 < src.size() &&
|
||||
@@ -617,7 +618,8 @@ namespace Void::Json
|
||||
cp = 0x10000u +
|
||||
((cp - 0xD800u) << 10) +
|
||||
(lo - 0xDC00u);
|
||||
for (std::size_t i = 0; i < 6; ++i) {
|
||||
for (std::size_t i = 0; i < 6;
|
||||
++i) {
|
||||
advance();
|
||||
}
|
||||
}
|
||||
@@ -965,7 +967,8 @@ namespace Void::Json
|
||||
inline void escape_string(std::string& out, std::string_view s)
|
||||
{
|
||||
out += '"';
|
||||
for (const unsigned char c : s) {
|
||||
for (const char value : s) {
|
||||
const auto c = static_cast<unsigned char>(value);
|
||||
switch (c) {
|
||||
case '"':
|
||||
out += "\\\"";
|
||||
|
||||
Reference in new issue
Block a user