Q-W1 pt1: extract core/json (json::Reader/Writer), collapse wire Cursor family into core/wire, shared readFileBytes — five JSON decoders and three cursor copies deleted, byte-identical formats, 59/59 green

This commit is contained in:
2026-07-28 19:59:02 -04:00
parent 88e7765ee5
commit 67a41728f3
25 changed files with 1695 additions and 1696 deletions
+21
View File
@@ -0,0 +1,21 @@
// core/util/file_bytes implementation — see file_bytes.h.
#include "core/util/file_bytes.h"
#include <fstream>
namespace reasampler {
std::vector<std::uint8_t> readFileBytes(const std::string& path) {
std::ifstream f(path, std::ios::binary | std::ios::ate);
if (!f) return {};
const std::streamoff size = f.tellg();
if (size <= 0) return {};
std::vector<std::uint8_t> bytes(static_cast<std::size_t>(size));
f.seekg(0);
f.read(reinterpret_cast<char*>(bytes.data()), size);
if (!f) return {};
return bytes;
}
} // namespace reasampler
+19
View File
@@ -0,0 +1,19 @@
// core/util/file_bytes — the ONE whole-file byte loader (Q-W1; audit T2-03).
// Pure standard library — NO REAPER, NO SWELL, NO VST3 — but it does blocking
// file I/O: NEVER call it on the audio thread (off-thread only, the same rule
// every prior hand-rolled copy carried). Linked by both artifacts.
#pragma once
#include <cstdint>
#include <string>
#include <vector>
namespace reasampler {
// Reads the whole file at `path` into a byte buffer. Empty on ANY failure —
// unopenable, empty file, or short read — so the caller has exactly one
// "nothing to work with" branch.
std::vector<std::uint8_t> readFileBytes(const std::string& path);
} // namespace reasampler