readium / readium-lcp-client

This repository is for the Readium Licenced Content Protection (LCP) client side implementation work.
BSD 3-Clause "New" or "Revised" License
17 stars 12 forks source link

third-party lib ZIP (different in Readium SDK) #8

Open danielweck opened 8 years ago

danielweck commented 8 years ago

See: https://github.com/readium/readium-sdk/issues/232

danielweck commented 8 years ago

https://github.com/readium/readium-sdk/blob/develop/ePub3/ThirdParty/libzip/zip_add_dir.c

zip_add_dir(struct zip *za, const char *name)

https://github.com/readium/readium-sdk/blob/develop/ePub3/ePub/zip_archive.cpp#L226

bool ZipArchive::CreateFolder(const string & path)
{
    return (zip_add_dir(_zip, Sanitized(path).c_str()) >= 0);
}

https://github.com/readium/readium-sdk/blob/develop/ePub3/ePub/zip_archive.h#L74

    virtual bool CreateFolder(const string & path);

https://github.com/readium/readium-sdk/blob/develop/ePub3/ePub/archive.h#L168

    /**
     Creates a folder in an archive.
     @param path The path within the archive for the new folder.
     @result Returns `true` if the polder was created, `false` otherwise.
     */
    virtual bool CreateFolder(const string & path) = 0;
danielweck commented 8 years ago

https://github.com/readium/readium-lcp-client/blob/develop/src/lcp-client-lib/Acquisition.cpp#L173

            ZipFile::AddFile(m_publicationPath, licenseStream, "META-INF/license.lcpl");

https://github.com/readium/readium-lcp-client/blob/develop/src/third-parties/ziplib/Source/ZipLib/ZipFile.cpp#L99

void ZipFile::AddFile(const std::string& zipPath, std::istream& dataStream, const std::string& inArchiveName, ICompressionMethod::Ptr method)

https://github.com/readium/readium-sdk/blob/develop/ePub3/ThirdParty/libzip/zip_add.c

zip_add(struct zip *za, const char *name, struct zip_source *source)
danielweck commented 8 years ago

TODO: replace ZipFile::AddFile in LCP client lib with zip_add from ReadiumSDK's built-in static zip lib. (as per above code snippets, zip_add_dir illustrates the usage of the C API from the CPP "archive" logical layer)

danielweck commented 8 years ago

Also note that CryptoPP Crypto++ has its own zip lib: https://github.com/weidai11/cryptopp/blob/master/zdeflate.h https://github.com/weidai11/cryptopp/blob/master/zinflate.h

https://github.com/weidai11/cryptopp/blob/master/zlib.h https://github.com/weidai11/cryptopp/blob/master/gzip.h

https://github.com/readium/readium-lcp-client/tree/develop/src/third-parties/cryptopp/

danielweck commented 8 years ago

Note existing issues: https://bitbucket.org/wbenny/ziplib/issues?status=new&status=open (mirror: https://github.com/kypp/ziplib )

In particular: 64-bit support: https://bitbucket.org/wbenny/ziplib/issues/32/zip64-support no-file support: https://bitbucket.org/wbenny/ziplib/issues/35/add-encode-deconde-decode-encode-stream