aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar
diff options
context:
space:
mode:
authorGravatar cushon <cushon@google.com>2018-03-29 13:31:46 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-29 13:32:58 -0700
commita29da01b360b778d15ed735222d0f1d247954acf (patch)
tree2961500fb84e8aa2ac4342f3c97d530ef425a29c /third_party/ijar
parenta76f7db51a90cc2e35c1d66782056c310729eef0 (diff)
Fix a warning about comparing signed and unsigned values
PiperOrigin-RevId: 190977545
Diffstat (limited to 'third_party/ijar')
-rw-r--r--third_party/ijar/mapped_file.h6
-rw-r--r--third_party/ijar/mapped_file_unix.cc8
-rw-r--r--third_party/ijar/mapped_file_windows.cc4
-rw-r--r--third_party/ijar/zip.cc20
-rw-r--r--third_party/ijar/zip.h2
5 files changed, 20 insertions, 20 deletions
diff --git a/third_party/ijar/mapped_file.h b/third_party/ijar/mapped_file.h
index 7653638d5f..874db8b836 100644
--- a/third_party/ijar/mapped_file.h
+++ b/third_party/ijar/mapped_file.h
@@ -62,10 +62,10 @@ class MappedOutputFile {
const char* errmsg_;
bool opened_;
u1* buffer_;
- u8 estimated_size_;
+ size_t estimated_size_;
public:
- MappedOutputFile(const char* name, u8 estimated_size);
+ MappedOutputFile(const char* name, size_t estimated_size);
virtual ~MappedOutputFile();
// If opening the file succeeded or not.
@@ -76,7 +76,7 @@ class MappedOutputFile {
// The mapped contents of the file.
u1* Buffer() const { return buffer_; }
- int Close(int size);
+ int Close(size_t size);
};
} // namespace devtools_ijar
diff --git a/third_party/ijar/mapped_file_unix.cc b/third_party/ijar/mapped_file_unix.cc
index ccb8787cd5..ced7d8726f 100644
--- a/third_party/ijar/mapped_file_unix.cc
+++ b/third_party/ijar/mapped_file_unix.cc
@@ -90,7 +90,7 @@ struct MappedOutputFileImpl {
int mmap_length_;
};
-MappedOutputFile::MappedOutputFile(const char* name, u8 estimated_size)
+MappedOutputFile::MappedOutputFile(const char* name, size_t estimated_size)
: estimated_size_(estimated_size) {
impl_ = NULL;
opened_ = false;
@@ -111,7 +111,7 @@ MappedOutputFile::MappedOutputFile(const char* name, u8 estimated_size)
// Ensure that any buffer overflow in JarStripper will result in
// SIGSEGV or SIGBUS by over-allocating beyond the end of the file.
size_t mmap_length = std::min(estimated_size + sysconf(_SC_PAGESIZE),
- (u8) std::numeric_limits<size_t>::max());
+ std::numeric_limits<size_t>::max());
void* mapped = mmap(NULL, mmap_length, PROT_WRITE, MAP_SHARED, fd, 0);
if (mapped == MAP_FAILED) {
snprintf(errmsg, MAX_ERROR, "mmap(): %s", strerror(errno));
@@ -131,9 +131,9 @@ MappedOutputFile::~MappedOutputFile() {
delete impl_;
}
-int MappedOutputFile::Close(int size) {
+int MappedOutputFile::Close(size_t size) {
if (size > estimated_size_) {
- snprintf(errmsg, MAX_ERROR, "size %d > estimated size %lld", size,
+ snprintf(errmsg, MAX_ERROR, "size %zu > estimated size %zu", size,
estimated_size_);
errmsg_ = errmsg;
return -1;
diff --git a/third_party/ijar/mapped_file_windows.cc b/third_party/ijar/mapped_file_windows.cc
index 6fb8b369d6..6292605e86 100644
--- a/third_party/ijar/mapped_file_windows.cc
+++ b/third_party/ijar/mapped_file_windows.cc
@@ -125,7 +125,7 @@ struct MappedOutputFileImpl {
}
};
-MappedOutputFile::MappedOutputFile(const char* name, u8 estimated_size) {
+MappedOutputFile::MappedOutputFile(const char* name, size_t estimated_size) {
impl_ = NULL;
opened_ = false;
errmsg_ = errmsg;
@@ -169,7 +169,7 @@ MappedOutputFile::~MappedOutputFile() {
delete impl_;
}
-int MappedOutputFile::Close(int size) {
+int MappedOutputFile::Close(size_t size) {
if (!UnmapViewOfFile(buffer_)) {
blaze_util::die(255, "MappedOutputFile::Close: UnmapViewOfFile failed: %s",
blaze_util::GetLastErrorString().c_str());
diff --git a/third_party/ijar/zip.cc b/third_party/ijar/zip.cc
index 9a719dbac3..93136e5b17 100644
--- a/third_party/ijar/zip.cc
+++ b/third_party/ijar/zip.cc
@@ -71,7 +71,7 @@
namespace devtools_ijar {
// In the absence of ZIP64 support, zip files are limited to 4GB.
// http://www.info-zip.org/FAQ.html#limits
-static const u8 kMaximumOutputSize = std::numeric_limits<uint32_t>::max();
+static const size_t kMaximumOutputSize = std::numeric_limits<uint32_t>::max();
static const u4 kDefaultTimestamp =
30 << 25 | 1 << 21 | 1 << 16; // January 1, 2010 in DOS time
@@ -199,11 +199,11 @@ class InputZipFile : public ZipExtractor {
//
class OutputZipFile : public ZipBuilder {
public:
- OutputZipFile(const char* filename, u8 estimated_size) :
- output_file_(NULL),
- filename_(filename),
- estimated_size_(estimated_size),
- finished_(false) {
+ OutputZipFile(const char *filename, size_t estimated_size)
+ : output_file_(NULL),
+ filename_(filename),
+ estimated_size_(estimated_size),
+ finished_(false) {
errmsg[0] = 0;
}
@@ -257,7 +257,7 @@ class OutputZipFile : public ZipBuilder {
MappedOutputFile* output_file_;
const char* filename_;
- u8 estimated_size_;
+ size_t estimated_size_;
bool finished_;
// OutputZipFile is responsible for maintaining the following
@@ -1078,8 +1078,8 @@ int OutputZipFile::FinishFile(size_t filelength, bool compress,
bool OutputZipFile::Open() {
if (estimated_size_ > kMaximumOutputSize) {
fprintf(stderr,
- "Uncompressed input jar has size %llu, "
- "which exceeds the maximum supported output size %llu.\n"
+ "Uncompressed input jar has size %lu, "
+ "which exceeds the maximum supported output size %lu.\n"
"Assuming that ijar will be smaller and hoping for the best.\n",
estimated_size_, kMaximumOutputSize);
estimated_size_ = kMaximumOutputSize;
@@ -1099,7 +1099,7 @@ bool OutputZipFile::Open() {
return true;
}
-ZipBuilder* ZipBuilder::Create(const char* zip_file, u8 estimated_size) {
+ZipBuilder *ZipBuilder::Create(const char *zip_file, size_t estimated_size) {
OutputZipFile* result = new OutputZipFile(zip_file, estimated_size);
if (!result->Open()) {
fprintf(stderr, "%s\n", result->GetError());
diff --git a/third_party/ijar/zip.h b/third_party/ijar/zip.h
index dfd3595ad5..b41d07c3cb 100644
--- a/third_party/ijar/zip.h
+++ b/third_party/ijar/zip.h
@@ -93,7 +93,7 @@ class ZipBuilder {
// ZipExtractor::CalculateOuputLength() to have an estimated_size depending on
// a list of file to store.
// On failure, returns NULL. Refer to errno for error code.
- static ZipBuilder* Create(const char* zip_file, u8 estimated_size);
+ static ZipBuilder* Create(const char* zip_file, size_t estimated_size);
// Estimate the maximum size of the ZIP files containing files in the "files"
// null-terminated array.