diff options
author | Laszlo Csomor <laszlocsomor@google.com> | 2016-12-01 12:56:43 +0000 |
---|---|---|
committer | Irina Iancu <elenairina@google.com> | 2016-12-01 13:31:42 +0000 |
commit | 645dbc4e24f3c5b08cf4701906f4a1e54db3583b (patch) | |
tree | 1a6b780f85b94c597de2db6fcade40183b6dad90 /third_party/ijar/zip.cc | |
parent | ec1cc8fa6cbdbba6e2689d3a814e095bb068e15e (diff) |
Ijar: extract file stating logic to platform_utils
This change takes us closer to compiling ijar,
thus Bazel, with MSVC.
See https://github.com/bazelbuild/bazel/issues/2107 and https://github.com/bazelbuild/bazel/issues/2157
--
MOS_MIGRATED_REVID=140717828
Diffstat (limited to 'third_party/ijar/zip.cc')
-rw-r--r-- | third_party/ijar/zip.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/third_party/ijar/zip.cc b/third_party/ijar/zip.cc index 7b34151b52..6fd95909f0 100644 --- a/third_party/ijar/zip.cc +++ b/third_party/ijar/zip.cc @@ -35,6 +35,7 @@ #include <vector> #include "third_party/ijar/mapped_file.h" +#include "third_party/ijar/platform_utils.h" #include "third_party/ijar/zip.h" #include "third_party/ijar/zlib_client.h" @@ -1119,18 +1120,18 @@ ZipBuilder* ZipBuilder::Create(const char* zip_file, u8 estimated_size) { u8 ZipBuilder::EstimateSize(char const* const* files, char const* const* zip_paths, int nb_entries) { - struct stat statst; + Stat file_stat; // Digital signature field size = 6, End of central directory = 22, Total = 28 u8 size = 28; // Count the size of all the files in the input to estimate the size of the // output. for (int i = 0; i < nb_entries; i++) { - statst.st_size = 0; - if (files[i] != NULL && stat(files[i], &statst) != 0) { + file_stat.total_size = 0; + if (files[i] != NULL && !stat_file(files[i], &file_stat)) { fprintf(stderr, "File %s does not seem to exist.", files[i]); return 0; } - size += statst.st_size; + size += file_stat.total_size; // Add sizes of Zip meta data // local file header = 30 bytes // data descriptor = 12 bytes |