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