Avoid integer modulo by 1, to avoid warning
authorDavid Neto <dneto@google.com>
Mon, 15 Aug 2016 15:27:13 +0000 (11:27 -0400)
committerDavid Neto <dneto@google.com>
Mon, 15 Aug 2016 15:27:13 +0000 (11:27 -0400)
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/349

tools/io.h

index a6f6c47..cd92227 100644 (file)
@@ -50,7 +50,7 @@ bool ReadFile(const char* filename, const char* mode, std::vector<T>* data) {
         return false;
       }
     } else {
-      if (ftell(fp) % sizeof(T)) {
+      if (sizeof(T) != 1 && (ftell(fp) % sizeof(T))) {
         fprintf(stderr, "error: corrupted word found in file '%s'\n", filename);
         return false;
       }