diff --git a/internal/cgen/auxiliary/json.cc b/internal/cgen/auxiliary/json.cc index 8deda219..89908496 100644 --- a/internal/cgen/auxiliary/json.cc +++ b/internal/cgen/auxiliary/json.cc @@ -90,6 +90,7 @@ const char DecodeJson_NoMatch[] = "wuffs_aux::DecodeJson: no match"; goto done; \ } \ uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \ + (void)(token_ptr); \ cursor_index += token_len // -------- diff --git a/internal/cgen/data/data.go b/internal/cgen/data/data.go index 106e22f2..0d9df902 100644 --- a/internal/cgen/data/data.go +++ b/internal/cgen/data/data.go @@ -653,7 +653,7 @@ const AuxJsonCc = "" + "// --------\n\n#define WUFFS_AUX__DECODE_JSON__GET_THE_NEXT_TOKEN \\\n while (tok_buf.meta.ri >= tok_buf.meta.wi) { \\\n if (tok_status.repr == nullptr) { \\\n } else if (tok_status.repr == wuffs_base__suspension__short_write) { \\\n tok_buf.compact(); \\\n } else if (tok_status.repr == wuffs_base__suspension__short_read) { \\\n if (!io_error_message.empty()) { \\\n ret_error_message = std::move(io_error_message); \\\n goto done; \\\n } else if (cursor_index != io_buf->meta.ri) { \\\n ret_error_message = \\\n \"wuffs_aux::DecodeJson: internal error: bad cursor_index\"; \\\n goto done; \\\n } else if (io_buf->meta.closed" + ") { \\\n ret_error_message = \\\n \"wuffs_aux::DecodeJson: internal error: io_buf is closed\"; \\\n goto done; \\\n } \\\n io_buf->compact(); \\\n if (io_buf->meta.wi >= io_buf->data.len) { \\\n ret_error_message = \\\n \"wuffs_aux::DecodeJson: internal error: io_buf is full\"; \\\n goto done; \\\n } \\\n cursor_index = io_buf->meta.ri; \\\n io_error_message = input.CopyIn(io_buf); \\\n } else { \\\n ret_" + "error_message = tok_status.message(); \\\n goto done; \\\n } \\\n if (WUFFS_JSON__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE != 0) { \\\n ret_error_message = \\\n \"wuffs_aux::DecodeJson: internal error: bad WORKBUF_LEN\"; \\\n goto done; \\\n } \\\n wuffs_base__slice_u8 work_buf = wuffs_base__empty_slice_u8(); \\\n tok_status = dec->decode_tokens(&tok_buf, io_buf, work_buf); \\\n } \\\n wuffs_base__token token = tok_buf.data.ptr[tok_buf.meta.ri++]; \\\n uint64_t token_len = token.length(); \\\n if ((io_buf->meta.ri < cursor_index) || " + - " \\\n ((io_buf->meta.ri - cursor_index) < token_len)) { \\\n ret_error_message = \\\n \"wuffs_aux::DecodeJson: internal error: bad token indexes\"; \\\n goto done; \\\n } \\\n uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \\\n cursor_index += token_len\n\n" + + " \\\n ((io_buf->meta.ri - cursor_index) < token_len)) { \\\n ret_error_message = \\\n \"wuffs_aux::DecodeJson: internal error: bad token indexes\"; \\\n goto done; \\\n } \\\n uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \\\n (void)(token_ptr); \\\n cursor_index += token_len\n\n" + "" + "// --------\n\nnamespace {\n\n// DecodeJson_SplitJsonPointer returns (\"bar\", 8) for (\"/foo/bar/b~1z/qux\", 5,\n// etc). It returns a 0 size_t when s has invalid JSON Pointer syntax.\n//\n// The string returned is unescaped. If calling it again, this time with i=8,\n// the \"b~1z\" substring would be returned as \"b/z\".\nstd::pair //\nDecodeJson_SplitJsonPointer(std::string& s,\n size_t i,\n bool allow_tilde_r_tilde_n) {\n std::string fragment;\n while (i < s.size()) {\n char c = s[i];\n if (c == '/') {\n break;\n } else if (c != '~') {\n fragment.push_back(c);\n i++;\n continue;\n }\n i++;\n if (i >= s.size()) {\n return std::make_pair(std::string(), 0);\n }\n c = s[i];\n if (c == '0') {\n fragment.push_back('~');\n i++;\n continue;\n } else if (c == '1') {\n fragment.push_back('/');\n i++;\n continue;\n } else if (allow_tilde_r_tilde_n) {\n if (c == 'r') {\n fragment.push_ba" + "ck('\\r');\n i++;\n continue;\n } else if (c == 'n') {\n fragment.push_back('\\n');\n i++;\n continue;\n }\n }\n return std::make_pair(std::string(), 0);\n }\n return std::make_pair(std::move(fragment), i);\n}\n\nstd::string //\nDecodeJson_DecodeBackslashX(std::string& str,\n uint8_t* token_ptr,\n size_t token_len) {\n wuffs_base__slice_u8 encoded =\n wuffs_base__make_slice_u8(token_ptr, token_len);\n while (encoded.len > 0) {\n uint8_t decoded[64];\n constexpr bool src_closed = true;\n wuffs_base__transform__output o = wuffs_base__base_16__decode4(\n wuffs_base__make_slice_u8(&decoded[0], sizeof decoded), encoded,\n src_closed, WUFFS_BASE__BASE_16__DEFAULT_OPTIONS);\n if (o.status.is_error()) {\n return o.status.message();\n } else if ((o.num_dst > (sizeof decoded)) || (o.num_src > encoded.len)) {\n return \"wuffs_aux::DecodeJson: internal error: inconsistent base16 \"\n \"decodi" + diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 470639c9..7f91ad16 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -29435,6 +29435,7 @@ const char DecodeJson_NoMatch[] = "wuffs_aux::DecodeJson: no match"; goto done; \ } \ uint8_t* token_ptr = io_buf->data.ptr + cursor_index; \ + (void)(token_ptr); \ cursor_index += token_len // --------