More initialize parser structure fixes. (bnc#705181)
authorMichael Andres <ma@suse.de>
Mon, 18 Jul 2011 09:35:42 +0000 (11:35 +0200)
committerMichael Andres <ma@suse.de>
Mon, 18 Jul 2011 09:35:42 +0000 (11:35 +0200)
zypp/media/MediaBlockList.cc
zypp/media/MediaBlockList.h
zypp/media/MediaMultiCurl.cc
zypp/media/MetaLinkParser.cc

index a0161eb..c33673a 100644 (file)
@@ -44,9 +44,7 @@ size_t
 MediaBlockList::addBlock(off_t off, size_t size)
 {
   haveblocks = true;
-  blocks.push_back(MediaBlock());
-  blocks.back().off = off;
-  blocks.back().size = size;
+  blocks.push_back(MediaBlock( off, size ));
   return blocks.size() - 1;
 }
 
@@ -350,7 +348,7 @@ MediaBlockList::reuseBlocks(FILE *wfp, string filename)
                }
              int oc = buf[i];
              buf[i] = c;
-             a += c - oc; 
+             a += c - oc;
              if (bshift)
                b += a - (oc << bshift);
              else
@@ -370,7 +368,7 @@ MediaBlockList::reuseBlocks(FILE *wfp, string filename)
                r = ((unsigned int)a & 255) << 16 | ((unsigned int)b & 65535);
              else
                r = ((unsigned int)a & 65535) << 16 | ((unsigned int)b & 65535);
-             unsigned int h = r & hm; 
+             unsigned int h = r & hm;
              unsigned int hh = 7;
              for (; ht[h]; h = (h + hh++) & hm)
                {
@@ -466,7 +464,7 @@ MediaBlockList::reuseBlocks(FILE *wfp, string filename)
   std::vector<MediaBlock> nblocks;
   std::vector<unsigned char> nchksums;
   std::vector<unsigned int> nrsums;
-  
+
   for (size_t blkno = 0; blkno < blocks.size(); ++blkno)
     {
       if (!found[blkno])
index b3b3c94..e870c74 100644 (file)
@@ -24,6 +24,10 @@ namespace zypp {
  * a single block from the blocklist, consisting of an offset and a size
  **/
 struct MediaBlock {
+  MediaBlock( off_t off_r, size_t size_r )
+  : off( off_r )
+  , size( size_r )
+  {}
   off_t off;
   size_t size;
 };
@@ -103,7 +107,7 @@ public:
   inline bool haveRsum(size_t blkno) const {
     return rsumlen && rsums.size() >= blkno + 1;
   }
-  
+
   /**
    * scan a file for blocks from our blocklist. if we find a suitable block,
    * it is removed from the list
index 48626c8..c0b14ce 100644 (file)
@@ -720,7 +720,7 @@ multifetchworker::nextjob()
   else
     {
       MediaBlock blk = blklist->getBlock(_request->_blkno);
-      while (_request->_blkoff >= blk.off + blk.size)
+      while (_request->_blkoff >= (off_t)(blk.off + blk.size))
        {
          if (++_request->_blkno == blklist->numBlocks())
            {
@@ -850,7 +850,7 @@ multifetchrequest::run(std::vector<Url> &urllist)
          break;
        }
 
-      if (_activeworkers < _maxworkers && urliter != urllist.end() && _workers.size() < MAXURLS)
+      if ((int)_activeworkers < _maxworkers && urliter != urllist.end() && _workers.size() < MAXURLS)
        {
          // spawn another worker!
          multifetchworker *worker = new multifetchworker(workerno++, *this, *urliter);
index 528f02b..bf937db 100644 (file)
@@ -113,6 +113,8 @@ struct ml_parsedata : private zypp::base::NonCopyable {
   {
     struct stateswitch *sw;
     int i;
+    memset( swtab, 0, sizeof(swtab) );
+    memset( sbtab, 0, sizeof(sbtab) );
     for (i = 0, sw = stateswitches; sw->from != NUMSTATES; i++, sw++)
     {
       if (!swtab[sw->from])