2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
13 #include "ZipManager.h"
19 class CZipFile
: public IFile
25 int64_t GetPosition() override
;
26 int64_t GetLength() override
;
27 bool Open(const CURL
& url
) override
;
28 bool Exists(const CURL
& url
) override
;
29 int Stat(struct __stat64
* buffer
) override
;
30 int Stat(const CURL
& url
, struct __stat64
* buffer
) override
;
31 ssize_t
Read(void* lpBuf
, size_t uiBufSize
) override
;
32 //virtual bool ReadString(char *szLine, int iLineLength);
33 int64_t Seek(int64_t iFilePosition
, int iWhence
= SEEK_SET
) override
;
34 void Close() override
;
36 //NOTE: gzip doesn't work. use DecompressGzip() instead
37 int UnpackFromMemory(std::string
& strDest
, const std::string
& strInput
, bool isGZ
=false);
39 /*! Decompress gzip encoded buffer in-memory */
40 static bool DecompressGzip(const std::string
& in
, std::string
& out
);
43 bool InitDecompress();
45 void DestroyBuffer(void* lpBuffer
, int iBufSize
);
48 int64_t m_iFilePos
= 0; // position in _uncompressed_ data read
49 int64_t m_iZipFilePos
= 0; // position in _compressed_ data
50 int m_iAvailBuffer
= 0;
52 char m_szBuffer
[65535]; // 64k buffer for compressed data
53 char* m_szStringBuffer
;
54 char* m_szStartOfStringBuffer
; // never allocated!
55 size_t m_iDataInStringBuffer
;
57 bool m_bFlush
= false;