aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2017-03-01 16:36:32 +0000
committerGravatar Yue Gan <yueg@google.com>2017-03-01 17:20:38 +0000
commit0dff43a2e3c566766f64fed597d143885d5d8368 (patch)
tree6c1a732569067d3dc009c28cf337ef806bde2dba /third_party
parent4af8f5bff567e7cad179fb803070764791353f8a (diff)
Fix int comparision warnings.
-- Change-Id: I6ce9c6afe14dfaff8a60ae90ee1504684d9cc61c Reviewed-on: https://cr.bazel.build/9117 PiperOrigin-RevId: 148891361 MOS_MIGRATED_REVID=148891361
Diffstat (limited to 'third_party')
-rw-r--r--third_party/ijar/ijar.cc2
-rw-r--r--third_party/ijar/platform_utils.cc4
2 files changed, 4 insertions, 2 deletions
diff --git a/third_party/ijar/ijar.cc b/third_party/ijar/ijar.cc
index af90fbbf3b..3c83b63764 100644
--- a/third_party/ijar/ijar.cc
+++ b/third_party/ijar/ijar.cc
@@ -62,7 +62,7 @@ class JarStripperProcessor : public ZipExtractorProcessor {
};
bool JarStripperProcessor::Accept(const char* filename, const u4 attr) {
- const int filename_len = strlen(filename);
+ const size_t filename_len = strlen(filename);
if (filename_len >= CLASS_EXTENSION_LENGTH) {
return strcmp(filename + filename_len - CLASS_EXTENSION_LENGTH,
CLASS_EXTENSION) == 0;
diff --git a/third_party/ijar/platform_utils.cc b/third_party/ijar/platform_utils.cc
index ce6fb54bd2..e1b46db5b5 100644
--- a/third_party/ijar/platform_utils.cc
+++ b/third_party/ijar/platform_utils.cc
@@ -95,7 +95,9 @@ bool write_file(const char* path, mode_t perm, const void* data, size_t size) {
return false;
}
bool result = true;
- if (write(fd, data, size) != size) {
+ int error = write(fd, data, size);
+ // Check for an error condition, or if we didn't write all of the data.
+ if (error < 0 || static_cast<size_t>(error) != size) {
fprintf(stderr, "Cannot write %zu bytes to file %s: %s\n", size, path,
strerror(errno));
result = false;