Bug 886726 - Fix warnings in szip.cpp. r=nfroyd
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 27 Jun 2013 09:35:49 +0900
changeset 136635 476f3ffebc407a786017f67b7e7fcf214b631d7b
parent 136634 ba30d5bdaf222e51b28c1da52badcfc54b6bd797
child 136636 e307319bf2e4b2354e1e28a10fcd7e87656c30d7
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersnfroyd
bugs886726
milestone25.0a1
Bug 886726 - Fix warnings in szip.cpp. r=nfroyd
mozglue/linker/szip.cpp
--- a/mozglue/linker/szip.cpp
+++ b/mozglue/linker/szip.cpp
@@ -29,16 +29,18 @@ const char *filterName[] = {
 /* Maximum supported size for chunkSize */
 static const size_t maxChunkSize =
   1 << (8 * std::min(sizeof(((SeekableZStreamHeader *)NULL)->chunkSize),
                      sizeof(((SeekableZStreamHeader *)NULL)->lastChunkSize)) - 1);
 
 class Buffer: public MappedPtr
 {
 public:
+  virtual ~Buffer() { }
+
   virtual bool Resize(size_t size)
   {
     void *buf = mmap(NULL, size, PROT_READ | PROT_WRITE,
                      MAP_PRIVATE | MAP_ANON, -1, 0);
     if (buf == MAP_FAILED)
       return false;
     if (*this != MAP_FAILED)
       memcpy(buf, *this, std::min(size, GetLength()));
@@ -127,17 +129,17 @@ public:
   Dictionary(Buffer &inBuf, size_t size)
   {
     if (!size || !Resize(size))
       return;
     DEBUG_LOG("Creating dictionary");
     piece *origBufPieces = reinterpret_cast<piece *>(
                            static_cast<void *>(inBuf));
     std::map<piece, int> stats;
-    for (int i = 0; i < inBuf.GetLength() / sizeof(piece); i++) {
+    for (unsigned int i = 0; i < inBuf.GetLength() / sizeof(piece); i++) {
       stats[origBufPieces[i]]++;
     }
     std::vector<stat_pair> statsVec(stats.begin(), stats.end());
     std::sort(statsVec.begin(), statsVec.end(), stat_cmp);
 
     piece *dictPieces = reinterpret_cast<piece *>(
                         static_cast<void *>(*this));
     typename std::vector<stat_pair>::reverse_iterator it = statsVec.rbegin();
@@ -484,17 +486,17 @@ int main(int argc, char* argv[])
         return 1;
       }
     } else if (strcmp(firstArg[0], "-f") == 0) {
       firstArg++;
       argc--;
       if (!firstArg[0])
         break;
       bool matched = false;
-      for (int i = 0; i < sizeof(filterName) / sizeof(char *); ++i) {
+      for (unsigned int i = 0; i < sizeof(filterName) / sizeof(char *); ++i) {
         if (strcmp(firstArg[0], filterName[i]) == 0) {
           filter = static_cast<SeekableZStream::FilterId>(i);
           matched = true;
           break;
         }
       }
       if (!matched) {
         LOG("Invalid filter");