diff --git a/SystemTools.cxx b/SystemTools.cxx
index 9cbe47e2d5650281fb4570e9682f5f2973163b67..f3d0c6209eb395fdc4cbe4aa9689145f205d13b5 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -1597,7 +1597,8 @@ bool SystemTools::FilesDiffer(const char* source,
     finDestination.read(dest_buf, nnext);
 
     // If either failed to read assume they are different.
-    if(finSource.gcount() != nnext || finDestination.gcount() != nnext)
+    if(static_cast<kwsys_ios::streamsize>(finSource.gcount()) != nnext ||
+       static_cast<kwsys_ios::streamsize>(finDestination.gcount()) != nnext)
       {
       return true;
       }