#include "src/trace_processor/util/zip_reader.h"
#include <cstdint>
#include <cstring>
#include <ctime>
#include <limits>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "perfetto/base/build_config.h"
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/base/time.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/ext/base/utils.h"
#include "perfetto/trace_processor/trace_blob_view.h"
#include "src/trace_processor/util/gzip_utils.h"
#include "src/trace_processor/util/status_macros.h"
#include "src/trace_processor/util/streaming_line_reader.h"
#if PERFETTO_BUILDFLAG(PERFETTO_ZLIB)
#include <zconf.h>
#include <zlib.h>
#endif
namespace perfetto::trace_processor::util {
namespace {
constexpr uint32_t kFileHeaderSig = …;
constexpr uint32_t kCentralDirectorySig = …;
constexpr uint32_t kDataDescriptorSig = …;
constexpr uint32_t kDataDescriptorSize = …;
enum GeneralPurposeBitFlag : uint32_t { … };
const uint16_t kNoCompression = …;
const uint16_t kDeflate = …;
template <typename T>
T ReadAndAdvance(const uint8_t** ptr) { … }
}
ZipReader::ZipReader() = default;
ZipReader::~ZipReader() = default;
base::Status ZipReader::Parse(TraceBlobView tbv) { … }
base::Status ZipReader::TryParseHeader() { … }
base::Status ZipReader::TryParseFilename() { … }
base::Status ZipReader::TrySkipBytes() { … }
base::Status ZipReader::TryParseCompressedData() { … }
base::StatusOr<std::optional<TraceBlobView>>
ZipReader::TryParseUnsizedCompressedData() { … }
ZipFile* ZipReader::Find(const std::string& path) { … }
ZipFile::ZipFile() = default;
ZipFile::~ZipFile() = default;
ZipFile::ZipFile(ZipFile&& other) noexcept = default;
ZipFile& ZipFile::operator=(ZipFile&& other) noexcept = default;
base::Status ZipFile::Decompress(std::vector<uint8_t>* out_data) const { … }
base::Status ZipFile::DecompressLines(LinesCallback callback) const { … }
base::Status ZipFile::DoDecompressionChecks() const { … }
int64_t ZipFile::GetDatetime() const { … }
std::string ZipFile::GetDatetimeStr() const { … }
}