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;
}
}
int oc = buf[i];
buf[i] = c;
- a += c - oc;
+ a += c - oc;
if (bshift)
b += a - (oc << bshift);
else
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)
{
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])
* 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;
};
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
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())
{
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);
{
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])