Merge "Fix warnings in libziparchive" am: 91811d2d34 am: 6f5edc78d8
am: e3d8246c0b
Change-Id: I4737599a4245d4ed1b8c6c77ff939fee1e206f86
This commit is contained in:
commit
bcedc20a2e
3 changed files with 13 additions and 2 deletions
|
|
@ -43,8 +43,7 @@ struct ZipString {
|
||||||
/*
|
/*
|
||||||
* entry_name has to be an c-style string with only ASCII characters.
|
* entry_name has to be an c-style string with only ASCII characters.
|
||||||
*/
|
*/
|
||||||
explicit ZipString(const char* entry_name)
|
explicit ZipString(const char* entry_name);
|
||||||
: name(reinterpret_cast<const uint8_t*>(entry_name)), name_length(strlen(entry_name)) {}
|
|
||||||
|
|
||||||
bool operator==(const ZipString& rhs) const {
|
bool operator==(const ZipString& rhs) const {
|
||||||
return name && (name_length == rhs.name_length) &&
|
return name && (name_length == rhs.name_length) &&
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "android-base/file.h"
|
#include "android-base/file.h"
|
||||||
|
#include "android-base/logging.h"
|
||||||
#include "android-base/macros.h" // TEMP_FAILURE_RETRY may or may not be in unistd
|
#include "android-base/macros.h" // TEMP_FAILURE_RETRY may or may not be in unistd
|
||||||
#include "android-base/memory.h"
|
#include "android-base/memory.h"
|
||||||
#include "log/log.h"
|
#include "log/log.h"
|
||||||
|
|
@ -1073,3 +1074,10 @@ const char* ErrorCodeString(int32_t error_code) {
|
||||||
int GetFileDescriptor(const ZipArchiveHandle handle) {
|
int GetFileDescriptor(const ZipArchiveHandle handle) {
|
||||||
return reinterpret_cast<ZipArchive*>(handle)->fd;
|
return reinterpret_cast<ZipArchive*>(handle)->fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZipString::ZipString(const char* entry_name)
|
||||||
|
: name(reinterpret_cast<const uint8_t*>(entry_name)) {
|
||||||
|
size_t len = strlen(entry_name);
|
||||||
|
CHECK_LE(len, static_cast<size_t>(UINT16_MAX));
|
||||||
|
name_length = static_cast<uint16_t>(len);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -243,8 +243,12 @@ int32_t ZipWriter::PrepareDeflate() {
|
||||||
// Initialize the z_stream for compression.
|
// Initialize the z_stream for compression.
|
||||||
z_stream_ = std::unique_ptr<z_stream, void(*)(z_stream*)>(new z_stream(), DeleteZStream);
|
z_stream_ = std::unique_ptr<z_stream, void(*)(z_stream*)>(new z_stream(), DeleteZStream);
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
int zerr = deflateInit2(z_stream_.get(), Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS,
|
int zerr = deflateInit2(z_stream_.get(), Z_BEST_COMPRESSION, Z_DEFLATED, -MAX_WBITS,
|
||||||
DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
if (zerr != Z_OK) {
|
if (zerr != Z_OK) {
|
||||||
if (zerr == Z_VERSION_ERROR) {
|
if (zerr == Z_VERSION_ERROR) {
|
||||||
ALOGE("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION);
|
ALOGE("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue