Files
sizzletracker-android/ios/core/src/io/Zip.hpp
T
ReactorcoremeltdownandClaude Opus 5.5 64e21e0bcc iOS 0.6.0: milestone 5 (recording, MIDI, input bindings, themes, bundles, backups)
- Master recording (MasterSink ring + writer thread) and the sample recorder
- CoreMIDI in/out: sound module, clock send/follow, virtual "Sizzle" ports;
  platform-free parser/module/clock in core (midi_test)
- Hardware keyboard and gamepads via GameController; rebindable keyboard,
  gamepad and MIDI CC actions; per-parameter MIDI learn
- Colour themes (.szt), project bundles (.szgz), backup & restore;
  ZIP in core with zlib (zip_test against jar and unzip)
- Persistent app settings; audio pauses in the background unless sound module

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 14:26:01 +01:00

41 lines
1.4 KiB
C++

// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
// SPDX-License-Identifier: GPL-3.0-or-later
// A small ZIP reader/writer (zlib) for project bundles (.szgz) and backups, the
// archives java.util.zip writes and reads on Android. Whole archives in memory.
// Writes deflated entries with sizes and CRC in the local headers (no data
// descriptors), so ZipInputStream reads them. Reads through the central directory,
// so entries with data descriptors (what ZipOutputStream writes) are fine. No
// Zip64, no encryption.
#pragma once
#include <cstddef>
#include <cstdint>
#include <string>
#include <vector>
namespace sizzle::io::zip {
struct Entry {
std::string name;
std::vector<uint8_t> data;
};
/** An archive of [entries], deflated. */
std::vector<uint8_t> write(const std::vector<Entry> &entries);
/**
* Every file entry of the archive in [bytes] (directories skipped). False, with
* [out] cleared, if it isn't a ZIP, is damaged (a CRC mismatch too), uses a
* method other than stored/deflate, has more than [maxEntries] entries or more
* than [maxTotal] bytes uncompressed (Android's ZipLimits budgets).
*/
bool read(const uint8_t *bytes, size_t size, std::vector<Entry> &out,
uint64_t maxTotal = 512ull << 20, size_t maxEntries = 20000);
/** A name that is safe to extract: relative, no "..", no backslashes or NULs. */
bool safeName(const std::string &name);
} // namespace sizzle::io::zip