Replaced zlib with minizip which uses zlib from the operating system.

This commit is contained in:
Alex Zolotarev 2015-08-18 22:35:19 +03:00
parent 877ee1ec3f
commit a01c79c08f
19 changed files with 26 additions and 108 deletions

View file

@ -2,7 +2,7 @@
TEMPLATE = subdirs
SUBDIRS = freetype fribidi zlib jansson tomcrypt protobuf osrm expat \
SUBDIRS = freetype fribidi minizip jansson tomcrypt protobuf osrm expat \
succinct \
!linux* {

View file

@ -101,7 +101,7 @@ LOCAL_SRC_FILES := \
nv_event/nv_event.cpp \
nv_time/nv_time.cpp \
LOCAL_LDLIBS := -llog -lGLESv2 -latomic
LOCAL_LDLIBS := -llog -lGLESv2 -latomic -lz
LOCAL_LDLIBS += -Wl,--gc-sections

View file

@ -7,7 +7,7 @@ ROOT_DIR = ..
include($$ROOT_DIR/common.pri)
INCLUDEPATH *= $$ROOT_DIR/3party/tomcrypt/src/headers $$ROOT_DIR/3party/zlib $$ROOT_DIR/3party/expat/lib
INCLUDEPATH *= $$ROOT_DIR/3party/tomcrypt/src/headers $$ROOT_DIR/3party/expat/lib
SOURCES += \
arithmetic_codec.cpp \
@ -20,7 +20,6 @@ SOURCES += \
file_name_utils.cpp \
file_reader.cpp \
file_writer.cpp \
gzip_compressor.cpp \
hex.cpp \
huffman.cpp \
internal/file_data.cpp \
@ -62,7 +61,6 @@ HEADERS += \
file_sort.hpp \
file_writer.hpp \
file_writer_stream.hpp \
gzip_compressor.hpp \
hex.hpp \
huffman.hpp \
internal/expat_impl.h \

View file

@ -5,7 +5,7 @@ CONFIG -= app_bundle
TEMPLATE = app
ROOT_DIR = ../..
DEPENDENCIES = coding base zlib tomcrypt
DEPENDENCIES = coding base minizip tomcrypt
include($$ROOT_DIR/common.pri)
@ -27,7 +27,6 @@ SOURCES += ../../testing/testingmain.cpp \
file_data_test.cpp \
file_sort_test.cpp \
file_utils_test.cpp \
gzip_test.cpp \
hex_test.cpp \
huffman_test.cpp \
mem_file_reader_test.cpp \

View file

@ -1,27 +0,0 @@
#include "base/SRC_FIRST.hpp"
#include "testing/testing.hpp"
#include "coding/coding_tests/coder_test.hpp"
#include "coding/gzip_compressor.hpp"
namespace
{
void CompressGZipLevel1(char const * pSrc, size_t srcSize, string & dst)
{
return CompressGZip(1, pSrc, srcSize, dst);
}
void CompressGZipLevel9(char const * pSrc, size_t srcSize, string & dst)
{
return CompressGZip(1, pSrc, srcSize, dst);
}
}
UNIT_TEST(AaaaGZipCompressionLevel1)
{
CoderAaaaTest(&CompressGZipLevel1, &DecompressGZip);
}
UNIT_TEST(AaaaGZipCompressionLevel9)
{
CoderAaaaTest(&CompressGZipLevel9, &DecompressGZip);
}

View file

@ -1,39 +0,0 @@
#include "coding/gzip_compressor.hpp"
#include "coding/coder_util.hpp"
#include "base/assert.hpp"
#include "3party/zlib/zlib.h"
size_t DecompressGZipIntoFixedSize(char const * pSrc, size_t srcSize, char * pDst, size_t dstSize)
{
unsigned long dstUsed = dstSize;
int error = uncompress(reinterpret_cast<unsigned char *>(pDst), &dstUsed,
reinterpret_cast<unsigned char const *>(pSrc), srcSize);
switch (error)
{
case Z_OK:
return dstUsed;
case Z_BUF_ERROR:
return size_t(-1);
default:
MYTHROW(DecompressGZipException, (error, srcSize, dstSize, dstUsed));
}
}
void DecompressGZip(char const * pSrc, size_t srcSize, string & dst)
{
FixedDstSizeCodeToString(&DecompressGZipIntoFixedSize, pSrc, srcSize, dst);
}
void CompressGZip(int level, char const * pSrc, size_t srcSize, string & dst)
{
ASSERT(level >= 1 && level <= 9, (level));
dst.resize(compressBound(srcSize));
unsigned long dstUsed = dst.size();
int error = compress2(reinterpret_cast<unsigned char *>(&dst[0]), &dstUsed,
reinterpret_cast<unsigned char const *>(pSrc), srcSize, level);
if (error == Z_OK)
dst.resize(dstUsed);
else
MYTHROW(CompressGZipException, (error, srcSize, dst.size(), dstUsed));
}

View file

@ -1,17 +0,0 @@
#pragma once
#include "coding/coder.hpp"
#include "base/base.hpp"
#include "base/exception.hpp"
DECLARE_EXCEPTION(CompressGZipException, StringCodingException);
DECLARE_EXCEPTION(DecompressGZipException, StringCodingException);
// Throws CompressGZipException on error.
void CompressGZip(int level, char const * pSrc, size_t srcSize, string & dst);
// Throws DecompressGZipException on error.
void DecompressGZip(char const * pSrc, size_t srcSize, string & dst);
// Returns -1 if dstSize is too small, otherwise the size of pDst used.
// Throws DecompressGZipException on error.
size_t DecompressGZipIntoFixedSize(char const * pSrc, size_t srcSize, char * pDst, size_t dstSize);

View file

@ -15,7 +15,7 @@
#include "std/algorithm.hpp"
#include "std/unique_ptr.hpp"
#include "3party/zlib/contrib/minizip/zip.h"
#include "3party/minizip/zip.h"
namespace

View file

@ -8,7 +8,7 @@
#include "std/bind.hpp"
#include "3party/zlib/contrib/minizip/unzip.h"
#include "3party/minizip/unzip.h"
ZipFileReader::ZipFileReader(string const & container, string const & file,

View file

@ -82,6 +82,8 @@ for(project, DEPENDENCIES) {
LIBS += -l$$project
}
unix : LIBS *= -lz
#INCLUDEPATH += $$ROOT_DIR/3party/protobuf/src/
# Windows-specific options for all projects

View file

@ -1,7 +1,7 @@
# Head project for drape develop and debuging
ROOT_DIR = ..
DEPENDENCIES = map render drape_frontend anim drape indexer platform geometry coding base \
freetype expat protobuf jansson zlib fribidi tomcrypt
freetype expat protobuf jansson fribidi tomcrypt
include($$ROOT_DIR/common.pri)

View file

@ -11,7 +11,7 @@ CONFIG -= app_bundle
TEMPLATE = app
ROOT_DIR = ..
DEPENDENCIES = map routing search storage indexer platform geometry coding base osrm jansson protobuf tomcrypt succinct stats_client zlib
DEPENDENCIES = map routing search storage indexer platform geometry coding base osrm jansson protobuf tomcrypt succinct stats_client
macx-*: LIBS *= "-framework Foundation" "-framework IOKit" "-framework SystemConfiguration"

View file

@ -112,6 +112,7 @@
4A7D89C81B2EBF3B00AC843E /* resources-xxhdpi_dark in Resources */ = {isa = PBXBuildFile; fileRef = 4A7D89C41B2EBF3B00AC843E /* resources-xxhdpi_dark */; };
5605022F1B6211E100169CAD /* sound-strings in Resources */ = {isa = PBXBuildFile; fileRef = 5605022E1B6211E100169CAD /* sound-strings */; };
560634F21B78806100F3D670 /* MWMTextToSpeech.mm in Sources */ = {isa = PBXBuildFile; fileRef = 560634F11B78806100F3D670 /* MWMTextToSpeech.mm */; };
6B53A1B21B83C25400E4CDAD /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 34570A3A1B13222600E6D4FD /* libz.dylib */; };
6B8A738A1B2616E90085EFE6 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA87151A12B1518F00592DAF /* SystemConfiguration.framework */; };
6BA0BCD11B74DDBA00CC9969 /* MWMCustomFacebookEvents.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6BA0BCD01B74DDBA00CC9969 /* MWMCustomFacebookEvents.mm */; };
6C24A3AD1AD7CA1000A47B99 /* MWMNoMapInterfaceController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6C47C8C81AD6C825000C52C1 /* MWMNoMapInterfaceController.mm */; };
@ -812,6 +813,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6B53A1B21B83C25400E4CDAD /* libz.dylib in Frameworks */,
6B8A738A1B2616E90085EFE6 /* SystemConfiguration.framework in Frameworks */,
348E578E1B0F3752000FA02A /* CoreLocation.framework in Frameworks */,
454040761AD2DD73007A9B12 /* UIKit.framework in Frameworks */,
@ -2477,7 +2479,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",
@ -2589,7 +2591,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",
@ -3095,7 +3097,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",
@ -3203,7 +3205,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",
@ -3314,7 +3316,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",
@ -3426,7 +3428,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",
@ -3537,7 +3539,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",
@ -3646,7 +3648,7 @@
"-lbase",
"-lfreetype",
"-lfribidi",
"-lzlib",
"-lminizip",
"-ljansson",
"-ltomcrypt",
"-lexpat",

View file

@ -7,7 +7,7 @@ TEMPLATE = app
ROOT_DIR = ../..
DEPENDENCIES = map render gui routing search storage graphics indexer platform anim geometry coding base \
freetype fribidi expat protobuf tomcrypt jansson osrm stats_client zlib succinct
freetype fribidi expat protobuf tomcrypt jansson osrm stats_client minizip succinct
!linux* {
DEPENDENCIES *= opening_hours

View file

@ -7,7 +7,7 @@ TEMPLATE = app
ROOT_DIR = ../..
DEPENDENCIES = map gui search storage graphics indexer platform anim geometry coding base \
freetype fribidi expat protobuf tomcrypt jansson zlib
freetype fribidi expat protobuf tomcrypt jansson
include($$ROOT_DIR/common.pri)

View file

@ -4,7 +4,7 @@ CONFIG -= app_bundle
TEMPLATE = app
ROOT_DIR = ../..
DEPENDENCIES = platform_tests_support platform coding base zlib tomcrypt jansson
DEPENDENCIES = platform_tests_support platform coding base minizip tomcrypt jansson
include($$ROOT_DIR/common.pri)

View file

@ -1,7 +1,7 @@
# Main application in qt.
ROOT_DIR = ..
DEPENDENCIES = map render gui routing search storage indexer graphics platform anim geometry coding base \
freetype expat fribidi tomcrypt jansson protobuf osrm stats_client zlib succinct
freetype expat fribidi tomcrypt jansson protobuf osrm stats_client minizip succinct
drape {
DEPENDENCIES *= drape_frontend drape

View file

@ -6,7 +6,7 @@ CONFIG -= app_bundle
TEMPLATE = app
ROOT_DIR = ../..
DEPENDENCIES = generator routing search storage stats_client jansson zlib indexer platform geometry coding sgitess base protobuf tomcrypt
DEPENDENCIES = generator routing search storage stats_client jansson indexer platform geometry coding sgitess base protobuf tomcrypt
include($$ROOT_DIR/common.pri)

View file

@ -6,7 +6,7 @@ CONFIG -= app_bundle
TEMPLATE = app
ROOT_DIR = ../..
DEPENDENCIES = storage indexer platform_tests_support platform geometry coding base jansson tomcrypt stats_client zlib
DEPENDENCIES = storage indexer platform_tests_support platform geometry coding base jansson tomcrypt stats_client
include($$ROOT_DIR/common.pri)