Commit f480cd0d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Dash: major warnings cleanup

All of them should be gone, except one.
parent 55f2b5d5
......@@ -51,7 +51,7 @@ Chunk* AlwaysBestAdaptationLogic::getNextChunk () throw(EOFException)
if(this->count == this->schedule.size())
throw EOFException();
for(int i = 0; i < this->schedule.size(); i++)
for(size_t i = 0; i < this->schedule.size(); i++)
{
if(this->count == i)
{
......@@ -69,14 +69,14 @@ void AlwaysBestAdaptationLogic::initSchedule ()
{
std::vector<Period *> periods = this->mpdManager->getPeriods();
for(int i = 0; i < periods.size(); i++)
for(size_t i = 0; i < periods.size(); i++)
{
Representation *best = this->mpdManager->getBestRepresentation(periods.at(i));
if(best != NULL)
{
std::vector<ISegment *> segments = this->mpdManager->getSegments(best);
for(int j = 0; j < segments.size(); j++)
for(size_t j = 0; j < segments.size(); j++)
{
this->schedule.push_back(segments.at(j));
}
......
......@@ -51,7 +51,7 @@ namespace dash
private:
std::vector<dash::mpd::ISegment *> schedule;
dash::mpd::IMPDManager *mpdManager;
int count;
size_t count;
void initSchedule();
};
......
......@@ -67,7 +67,7 @@ Chunk* RateBasedAdaptationLogic::getNextChunk () throw(EOFException)
return this->getNextChunk();
}
for(int i = 0; i < segments.size(); i++)
for(size_t i = 0; i < segments.size(); i++)
{
if(i == this->count)
{
......@@ -77,4 +77,5 @@ Chunk* RateBasedAdaptationLogic::getNextChunk () throw(EOFException)
return chunk;
}
}
return NULL;
}
......@@ -46,7 +46,7 @@ namespace dash
private:
dash::mpd::IMPDManager *mpdManager;
int count;
size_t count;
dash::mpd::Period *currentPeriod;
};
}
......
......@@ -109,13 +109,12 @@ std::string HTTPConnection::readLine ()
}
bool HTTPConnection::sendData (std::string data)
{
size_t size = 0;
size = net_Write(this->stream, this->httpSocket, NULL, data.c_str(), data.size());
ssize_t size = net_Write(this->stream, this->httpSocket, NULL, data.c_str(), data.size());
if (size == -1)
{
return false;
}
if (size != data.length())
if ((size_t)size != data.length())
{
this->sendData(data.substr(size, data.size()));
}
......
......@@ -75,7 +75,7 @@ bool HTTPConnectionManager::closeConnection (Chunk *chun
delete(chunk);
return ret;
}
bool HTTPConnectionManager::closeAllConnections ()
void HTTPConnectionManager::closeAllConnections ()
{
for(std::vector<HTTPConnection *>::iterator it = this->connections.begin(); it != this->connections.end(); ++it)
{
......@@ -134,7 +134,7 @@ int HTTPConnectionManager::read (Chunk *chun
this->bytesReadChunk = 0;
this->timeSecChunk = 0;
HTTPConnection *con = this->initConnection(chunk);
this->initConnection(chunk);
return this->read(chunk, p_buffer, len);
}
}
......@@ -143,7 +143,7 @@ int HTTPConnectionManager::peek (Chunk *chun
if(this->chunkMap.find(chunk) != this->chunkMap.end())
return this->chunkMap[chunk]->peek(pp_peek, i_peek);
HTTPConnection *con = this->initConnection(chunk);
this->initConnection(chunk);
return this->peek(chunk, pp_peek, i_peek);
}
HTTPConnection* HTTPConnectionManager::initConnection (Chunk *chunk)
......@@ -161,6 +161,6 @@ void HTTPConnectionManager::attach (IDownloadRa
}
void HTTPConnectionManager::notify ()
{
for(int i = 0; i < this->rateObservers.size(); i++)
for(size_t i = 0; i < this->rateObservers.size(); i++)
this->rateObservers.at(i)->downloadRateChanged(this->bpsAvg, this->bpsLastChunk);
}
......@@ -48,7 +48,7 @@ namespace dash
HTTPConnectionManager (stream_t *stream);
virtual ~HTTPConnectionManager ();
bool closeAllConnections ();
void closeAllConnections ();
bool closeConnection (IHTTPConnection *con);
IHTTPConnection* getConnection (std::string url);
int read (Chunk *chunk, void *p_buffer, size_t len);
......
......@@ -50,7 +50,7 @@ std::vector<ISegment*> BasicCMManager::getSegments (Representation
std::vector<Segment *> segments = info->getSegments();
for(int i = 0; i < segments.size(); i++)
for(size_t i = 0; i < segments.size(); i++)
retSegments.push_back(segments.at(i));
}
catch(ElementNotPresentException &e)
......@@ -71,10 +71,10 @@ Representation* BasicCMManager::getBestRepresentation (Period *period)
long bitrate = 0;
Representation *best = NULL;
for(int i = 0; i < groups.size(); i++)
for(size_t i = 0; i < groups.size(); i++)
{
std::vector<Representation *> reps = groups.at(i)->getRepresentations();
for(int j = 0; j < reps.size(); j++)
for(size_t j = 0; j < reps.size(); j++)
{
try
{
......@@ -110,10 +110,10 @@ Representation* BasicCMManager::getRepresentation (Period *period,
Representation *best = NULL;
long bestDif = -1;
for(int i = 0; i < groups.size(); i++)
for(size_t i = 0; i < groups.size(); i++)
{
std::vector<Representation *> reps = groups.at(i)->getRepresentations();
for(int j = 0; j < reps.size(); j++)
for(size_t j = 0; j < reps.size(); j++)
{
try
{
......@@ -148,7 +148,7 @@ Period* BasicCMManager::getNextPeriod (Period *period)
{
std::vector<Period *> periods = this->mpd->getPeriods();
for(int i = 0; i < periods.size(); i++)
for(size_t i = 0; i < periods.size(); i++)
{
if(periods.at(i) == period && (i + 1) < periods.size())
return periods.at(i + 1);
......
......@@ -53,7 +53,7 @@ void BasicCMParser::setMPDBaseUrl (Node *root)
{
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(root, "BaseURL");
for(int i = 0; i < baseUrls.size(); i++)
for(size_t i = 0; i < baseUrls.size(); i++)
{
BaseUrl *url = new BaseUrl(baseUrls.at(i)->getText());
this->mpd->addBaseUrl(url);
......@@ -63,7 +63,7 @@ void BasicCMParser::setPeriods (Node *root)
{
std::vector<Node *> periods = DOMHelper::getElementByTagName(root, "Period", false);
for(int i = 0; i < periods.size(); i++)
for(size_t i = 0; i < periods.size(); i++)
{
Period *period = new Period(periods.at(i)->getAttributes());
this->setGroups(periods.at(i), period);
......@@ -74,7 +74,7 @@ void BasicCMParser::setGroups (Node *root, Period *period)
{
std::vector<Node *> groups = DOMHelper::getElementByTagName(root, "Group", false);
for(int i = 0; i < groups.size(); i++)
for(size_t i = 0; i < groups.size(); i++)
{
Group *group = new Group(groups.at(i)->getAttributes());
this->setRepresentations(groups.at(i), group);
......@@ -85,7 +85,7 @@ void BasicCMParser::setRepresentations (Node *root, Group *group)
{
std::vector<Node *> representations = DOMHelper::getElementByTagName(root, "Representation", false);
for(int i = 0; i < representations.size(); i++)
for(size_t i = 0; i < representations.size(); i++)
{
Representation *rep = new Representation(representations.at(i)->getAttributes());
this->setSegmentInfo(representations.at(i), rep);
......@@ -96,7 +96,7 @@ void BasicCMParser::setSegmentInfo (Node *root, Representation *rep)
{
std::vector<Node *> segmentInfo = DOMHelper::getChildElementByTagName(root, "SegmentInfo");
for(int i = 0; i < segmentInfo.size(); i++)
for(size_t i = 0; i < segmentInfo.size(); i++)
{
SegmentInfo *info = new SegmentInfo(segmentInfo.at(i)->getAttributes());
this->setInitSegment(segmentInfo.at(i), info);
......@@ -109,7 +109,7 @@ void BasicCMParser::setInitSegment (Node *root, SegmentInfo *info)
{
std::vector<Node *> initSeg = DOMHelper::getChildElementByTagName(root, "InitialisationSegmentURL");
for(int i = 0; i < initSeg.size(); i++)
for(size_t i = 0; i < initSeg.size(); i++)
{
InitSegment *seg = new InitSegment(initSeg.at(i)->getAttributes());
info->setInitSegment(seg);
......@@ -120,7 +120,7 @@ void BasicCMParser::setSegments (Node *root, SegmentInfo *info)
{
std::vector<Node *> segments = DOMHelper::getElementByTagName(root, "Url", false);
for(int i = 0; i < segments.size(); i++)
for(size_t i = 0; i < segments.size(); i++)
{
Segment *seg = new Segment(segments.at(i)->getAttributes());
info->addSegment(seg);
......
......@@ -37,7 +37,7 @@ Group::Group (std::map<std::string, std::string> attributes)
}
Group::~Group ()
{
for(int i = 0; i < this->representations.size(); i++)
for(size_t i = 1; i < this->representations.size(); i++)
delete(this->representations.at(i));
delete(this->contentProtection);
......
......@@ -41,10 +41,10 @@ MPD::MPD ()
}
MPD::~MPD ()
{
for(int i = 0; i < this->periods.size(); i++)
for(size_t i = 0; i < this->periods.size(); i++)
delete(this->periods.at(i));
for(int i = 0; i < this->baseUrls.size(); i++)
for(size_t i = 0; i < this->baseUrls.size(); i++)
delete(this->baseUrls.at(i));
delete(this->programInfo);
......
......@@ -45,19 +45,19 @@ Period* NullManager::getFirstPeriod ()
{
return NULL;
}
Period* NullManager::getNextPeriod (Period *period)
Period* NullManager::getNextPeriod (Period *)
{
return NULL;
}
Representation* NullManager::getBestRepresentation (Period *period)
Representation* NullManager::getBestRepresentation (Period *)
{
return NULL;
}
std::vector<ISegment *> NullManager::getSegments (Representation *rep)
std::vector<ISegment *> NullManager::getSegments (Representation *)
{
return std::vector<ISegment *>();
}
Representation* NullManager::getRepresentation (Period *period, long bitrate)
Representation* NullManager::getRepresentation (Period *, long )
{
return NULL;
}
......@@ -35,7 +35,7 @@ Period::Period (std::map<std::string, std::string> attributes)
}
Period::~Period ()
{
for(int i = 0; i < this->groups.size(); i++)
for(size_t i = 0; i < this->groups.size(); i++)
delete(this->groups.at(i));
}
......
......@@ -37,7 +37,7 @@ SegmentInfo::SegmentInfo(std::map<std::string,std::string> attr)
}
SegmentInfo::~SegmentInfo ()
{
for(int i = 0; i < this->segments.size(); i++)
for(size_t i = 0; i < this->segments.size(); i++)
delete(this->segments.at(i));
delete(this->initSeg);
......
......@@ -33,7 +33,7 @@ std::vector<Node *> DOMHelper::getElementByTagName (Node *root, std::string
{
std::vector<Node *> elements;
for(int i = 0; i < root->getSubNodes().size(); i++)
for(size_t i = 0; i < root->getSubNodes().size(); i++)
{
getElementsByTagName(root->getSubNodes().at(i), name, &elements, selfContain);
}
......@@ -44,7 +44,7 @@ std::vector<Node *> DOMHelper::getChildElementByTagName (Node *root, std::string
{
std::vector<Node *> elements;
for(int i = 0; i < root->getSubNodes().size(); i++)
for(size_t i = 0; i < root->getSubNodes().size(); i++)
{
if(!root->getSubNodes().at(i)->getName().compare(name))
elements.push_back(root->getSubNodes().at(i));
......@@ -63,7 +63,7 @@ void DOMHelper::getElementsByTagName (Node *root, std::string
if(!root->getName().compare(name))
elements->push_back(root);
for(int i = 0; i < root->getSubNodes().size(); i++)
for(size_t i = 0; i < root->getSubNodes().size(); i++)
{
getElementsByTagName(root->getSubNodes().at(i), name, elements, selfContain);
}
......
......@@ -109,14 +109,14 @@ void DOMParser::print (Node *node, int offset)
std::vector<std::string> keys = node->getAttributeKeys();
for(int i = 0; i < keys.size(); i++)
for(size_t i = 0; i < keys.size(); i++)
msg_Dbg(this->stream, " %s=%s", keys.at(i).c_str(), node->getAttributeValue(keys.at(i)).c_str());
msg_Dbg(this->stream, "\n");
offset++;
for(int i = 0; i < node->getSubNodes().size(); i++)
for(size_t i = 0; i < node->getSubNodes().size(); i++)
{
this->print(node->getSubNodes().at(i), offset);
}
......
......@@ -34,7 +34,7 @@ Node::Node ()
}
Node::~Node ()
{
for(int i = 0; i < this->subNodes.size(); i++)
for(size_t i = 0; i < this->subNodes.size(); i++)
delete(this->subNodes.at(i));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment