]> git.mxchange.org Git - simgear.git/commitdiff
Fix some signed/unsigned comparisoms.
authorJames Turner <zakalawe@mac.com>
Thu, 28 Feb 2013 19:45:19 +0000 (19:45 +0000)
committerJames Turner <zakalawe@mac.com>
Thu, 28 Feb 2013 19:45:19 +0000 (19:45 +0000)
simgear/io/HTTPClient.cxx
simgear/package/Catalog.cxx
simgear/package/Catalog.hxx
simgear/package/Install.cxx

index 7a32ab4903090c0a128511416dde86b7e7a48ec2..5e32d2cb8a32263e459a675d5bea0575dccfda92 100644 (file)
@@ -338,7 +338,7 @@ public:
         }
         
         char flags = zlibInflateBuffer[3];
-        int gzipHeaderSize =  GZIP_HEADER_SIZE;
+        unsigned int gzipHeaderSize =  GZIP_HEADER_SIZE;
         if (flags & GZIP_HEADER_FEXTRA) {
           gzipHeaderSize += 2;
           if (zlib.avail_in < gzipHeaderSize) {
index bc9b6e59bbe2797863f8f32de9e7acf4f1bd79fb..92164fd125f510822114f46c4e47445e01b46b3a 100644 (file)
@@ -238,11 +238,12 @@ void Catalog::writeTimestamp()
     f << m_retrievedTime << std::endl;
 }
 
-int Catalog::ageInSeconds() const
+unsigned int Catalog::ageInSeconds() const
 {
     time_t now;
     time(&now);
-    return ::difftime(now, m_retrievedTime);
+    int diff = ::difftime(now, m_retrievedTime);
+    return (diff < 0) ? 0 : diff;
 }
 
 std::string Catalog::getLocalisedString(const SGPropertyNode* aRoot, const char* aName) const
index 49fd2af65bba4a5ed1a4a5b88e024da8a42bac7b..d49f725ad01fd1dafa40e2bb22600bce4c37222c 100644 (file)
@@ -64,7 +64,7 @@ public:
     
     Package* getPackageById(const std::string& aId) const;
     
-    int ageInSeconds() const;
+    unsigned int ageInSeconds() const;
 private:
     Catalog(Root* aRoot);
     
index eb186dc91b6bff201a0e94cd3a80651975105bb5..b471d965259bf8efe3c8def993426005dfaf41d8 100644 (file)
@@ -119,8 +119,8 @@ private:
         unz_file_info fileInfo;
         unzGetCurrentFileInfo(zip, &fileInfo, 
             buffer, bufferSize, 
-            NULL, NULL,  /* extra field */
-            NULL, NULL /* comment field */);
+            NULL, 0,  /* extra field */
+            NULL, 0 /* comment field */);
             
         std::string name(buffer);
     // no absolute paths, no 'up' traversals