Fixes Bazel build on Raspberry Pi 3 Raspbian GNU/Linux 9 (stetch). The portability bug is that sysconf() returns a long unsigned int but size_t is unsigned int (on the Pi 3) unsigned int causing a compilation failure (see below). Fixing the code to be portable, in this case, seems harmless in the common case where size_t is 64 bits AFAICT.

(I don't know your org so please feel free to reassign.)

The compilation error I received is:

ERROR: /home/hallorant/src/bazel-0.13.1/third_party/ijar/BUILD:10:1: C++ compilation of rule '//third_party/ijar:zip' failed (Exit 1): gcc failed: error executing command
  (cd /tmp/bazel_TMQ6Ae45/out/execroot/io_bazel && \
  exec env - \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/host/bin/third_party/ijar/_objs/zip/third_party/ijar/mapped_file_unix.d '-frandom-seed=bazel-out/host/bin/third_party/ijar/_objs/zip/third_party/ijar/mapped_file_unix.o' -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/host/genfiles -iquote external/bazel_tools -iquote bazel-out/host/genfiles/external/bazel_tools -isystem third_party/zlib -isystem bazel-out/host/genfiles/third_party/zlib -isystem bazel-out/host/bin/third_party/zlib -g0 -g0 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c third_party/ijar/mapped_file_unix.cc -o bazel-out/host/bin/third_party/ijar/_objs/zip/third_party/ijar/mapped_file_unix.o)
third_party/ijar/mapped_file_unix.cc: In constructor 'devtools_ijar::MappedOutputFile::MappedOutputFile(const char*, size_t)':
third_party/ijar/mapped_file_unix.cc:114:67: error: no matching function for call to 'min(long unsigned int, unsigned int)'
                                 std::numeric_limits<size_t>::max());
PiperOrigin-RevId: 198405201
diff --git a/third_party/ijar/mapped_file_unix.cc b/third_party/ijar/mapped_file_unix.cc
index ced7d87..fbfca42 100644
--- a/third_party/ijar/mapped_file_unix.cc
+++ b/third_party/ijar/mapped_file_unix.cc
@@ -110,8 +110,9 @@
 
   // 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),
-                                std::numeric_limits<size_t>::max());
+  size_t mmap_length =
+      std::min(static_cast<size_t>(estimated_size + sysconf(_SC_PAGESIZE)),
+               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));