changeset 594:c850f3433454

Deal with signed/unsigned comparison, again. Mingw's off_t appears to be 32-bit always.
author mas01cr
date Tue, 11 Aug 2009 21:42:39 +0000
parents 70acfcb5010a
children 31a1556fc2d6
files insert.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/insert.cpp	Tue Aug 11 21:42:34 2009 +0000
+++ b/insert.cpp	Tue Aug 11 21:42:39 2009 +0000
@@ -346,8 +346,13 @@
      * will do the right thing for us on all platforms.
      *
      * I hate C.
+     *
+     * Addendum: the above reasoning is skewered on Win32, where off_t
+     * is apparently signed 32-bit always (i.e. no large-file
+     * support).  So now, we cast datum->dim to size_t, so that our
+     * types are the same on both sides.  I hate C even more.
      */
-    if(((off_t) (st.st_size - sizeof(uint32_t))) != (size / datum->dim)) {
+    if((st.st_size - sizeof(uint32_t)) != (size / (size_t) datum->dim)) {
       goto error;
     }
     read_or_goto_error(fd, &dim, sizeof(uint32_t));