chromium/third_party/perfetto/src/trace_processor/util/zip_reader.cc

/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#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 {

// Entry signatures.
constexpr uint32_t kFileHeaderSig =;
constexpr uint32_t kCentralDirectorySig =;
constexpr uint32_t kDataDescriptorSig =;

// 4 bytes each of: 1) signature, 2) crc, 3) compressed size 4) uncompressed
// size.
constexpr uint32_t kDataDescriptorSize =;

enum GeneralPurposeBitFlag : uint32_t {};

// Compression flags.
const uint16_t kNoCompression =;
const uint16_t kDeflate =;

template <typename T>
T ReadAndAdvance(const uint8_t** ptr) {}

}  // namespace

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() {}  // namespace perfetto::trace_processor::util

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 {}

// Common logic for both Decompress() and DecompressLines().
base::Status ZipFile::DoDecompressionChecks() const {}

// Returns a 64-bit version of time_t, that is, the num seconds since the
// Epoch.
int64_t ZipFile::GetDatetime() const {}

std::string ZipFile::GetDatetimeStr() const {}

}  // namespace perfetto::trace_processor::util