From ad7d6624de2b8de1e2fafcdf0a28655926782942 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 28 Feb 2013 19:45:19 +0000 Subject: [PATCH] Fix some signed/unsigned comparisoms. --- simgear/io/HTTPClient.cxx | 2 +- simgear/package/Catalog.cxx | 5 +++-- simgear/package/Catalog.hxx | 2 +- simgear/package/Install.cxx | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/simgear/io/HTTPClient.cxx b/simgear/io/HTTPClient.cxx index 7a32ab49..5e32d2cb 100644 --- a/simgear/io/HTTPClient.cxx +++ b/simgear/io/HTTPClient.cxx @@ -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) { diff --git a/simgear/package/Catalog.cxx b/simgear/package/Catalog.cxx index bc9b6e59..92164fd1 100644 --- a/simgear/package/Catalog.cxx +++ b/simgear/package/Catalog.cxx @@ -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 diff --git a/simgear/package/Catalog.hxx b/simgear/package/Catalog.hxx index 49fd2af6..d49f725a 100644 --- a/simgear/package/Catalog.hxx +++ b/simgear/package/Catalog.hxx @@ -64,7 +64,7 @@ public: Package* getPackageById(const std::string& aId) const; - int ageInSeconds() const; + unsigned int ageInSeconds() const; private: Catalog(Root* aRoot); diff --git a/simgear/package/Install.cxx b/simgear/package/Install.cxx index eb186dc9..b471d965 100644 --- a/simgear/package/Install.cxx +++ b/simgear/package/Install.cxx @@ -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