about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-04-16T12·03+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-04-16T12·03+0000
commit4e646b0ddb81e1fbf1159ad66a41de848fe93930 (patch)
tree1c7295c046c121069d2161f8dadba3672a5d54d6
parent0460ea4c395cc45e510d13fbf12930dd3d221305 (diff)
* Fix a few "comparison is always false/true due to limited range of
  data type" warnings on 64-bit platforms.  The one in parser.y is
  likely to be a real bug.

-rw-r--r--src/libexpr/parser.y2
-rw-r--r--src/libstore/local-store.cc2
-rw-r--r--src/libutil/archive.cc6
3 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 7bafd89d8860..05ba52e6875b 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -147,7 +147,7 @@ static Expr stripIndentation(ATermList es)
         /* Remove the last line if it is empty and consists only of
            spaces. */
         if (n == 1) {
-            unsigned int p = s2.find_last_of('\n');
+            string::size_type p = s2.find_last_of('\n');
             if (p != string::npos && s2.find_first_not_of(' ', p + 1) == string::npos)
                 s2 = string(s2, 0, p + 1);
         }
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 9f9c378c6a75..205ee3c25dc9 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -393,7 +393,7 @@ ValidPathInfo LocalStore::queryPathInfo(const Path & path, bool ignoreErrors)
     Strings lines = tokenizeString(info, "\n");
 
     for (Strings::iterator i = lines.begin(); i != lines.end(); ++i) {
-        unsigned int p = i->find(':');
+        string::size_type p = i->find(':');
         if (p == string::npos) continue; /* bad line */
         string name(*i, 0, p);
         string value(*i, p + 2);
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index 3142aa929b3e..8f100da4c3ed 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -50,7 +50,7 @@ static void dumpEntries(const Path & path, Sink & sink, PathFilter & filter)
 }
 
 
-static void dumpContents(const Path & path, off_t size, 
+static void dumpContents(const Path & path, size_t size, 
     Sink & sink)
 {
     writeString("contents", sink);
@@ -60,7 +60,7 @@ static void dumpContents(const Path & path, off_t size,
     if (fd == -1) throw SysError(format("opening file `%1%'") % path);
     
     unsigned char buf[65536];
-    off_t left = size;
+    size_t left = size;
 
     while (left > 0) {
         size_t n = left > sizeof(buf) ? sizeof(buf) : left;
@@ -88,7 +88,7 @@ static void dump(const Path & path, Sink & sink, PathFilter & filter)
             writeString("executable", sink);
             writeString("", sink);
         }
-        dumpContents(path, st.st_size, sink);
+        dumpContents(path, (size_t) st.st_size, sink);
     } 
 
     else if (S_ISDIR(st.st_mode)) {