llvm/lldb/source/Utility/ZipFile.cpp

//===-- ZipFile.cpp -------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Utility/ZipFile.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/Endian.h"

usingnamespacelldb_private;
usingnamespacellvm::support;

namespace {

// Zip headers.
// https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

// The end of central directory record.
struct EocdRecord {};

// Logical find limit for the end of central directory record.
const size_t kEocdRecordFindLimit =;

// Central directory record.
struct CdRecord {};
// Immediately after CdRecord,
// - file name (file_name_length)
// - extra field (extra_field_length)
// - comment (comment_length)

// Local file header.
struct LocalFileHeader {};
// Immediately after LocalFileHeader,
// - file name (file_name_length)
// - extra field (extra_field_length)
// - file data (should be compressed_size == uncompressed_size, page aligned)

const EocdRecord *FindEocdRecord(lldb::DataBufferSP zip_data) {}

bool GetFile(lldb::DataBufferSP zip_data, uint32_t local_file_header_offset,
             lldb::offset_t &file_offset, lldb::offset_t &file_size) {}

bool FindFile(lldb::DataBufferSP zip_data, const EocdRecord *eocd,
              const llvm::StringRef file_path, lldb::offset_t &file_offset,
              lldb::offset_t &file_size) {}

} // end anonymous namespace

bool ZipFile::Find(lldb::DataBufferSP zip_data, const llvm::StringRef file_path,
                   lldb::offset_t &file_offset, lldb::offset_t &file_size) {}