diff options
-rwxr-xr-x | Makefile | 2 | ||||
-rwxr-xr-x | httpclient.c | 2 | ||||
-rwxr-xr-x | httpresource.c | 14 | ||||
-rw-r--r-- | mngurls.c | 6 | ||||
-rw-r--r-- | mp4.c | 8 | ||||
-rwxr-xr-x | responsebase.c | 1 | ||||
-rwxr-xr-x | responsememblk.c | 12 | ||||
-rwxr-xr-x | responsevdrdir.c | 2 | ||||
-rwxr-xr-x | smarttvfactory.c | 2 | ||||
-rwxr-xr-x | stvw_cfg.c | 2 | ||||
-rw-r--r-- | url.c | 20 |
11 files changed, 37 insertions, 34 deletions
@@ -27,7 +27,7 @@ TMPDIR ?= /tmp ### The compiler options: export CFLAGS = $(call PKGCFG,cflags) -export CXXFLAGS = $(call PKGCFG,cxxflags) +export CXXFLAGS = -std=c++11 $(call PKGCFG,cxxflags) ### The version number of VDR's plugin API: diff --git a/httpclient.c b/httpclient.c index 83e9de9..54e813b 100755 --- a/httpclient.c +++ b/httpclient.c @@ -322,7 +322,7 @@ int cHttpClientBase::checkTransactionCompletion() { return ERROR; } - if ((mRespBdyLen <= mResponseBdy.size()) || (mRespBdyLen == 0)) { + if ((mRespBdyLen <= (int)mResponseBdy.size()) || (mRespBdyLen == 0)) { *(mLog->log()) << DEBUGPREFIX << " Transaction completed. mTransCount= " << mTransCount diff --git a/httpresource.c b/httpresource.c index 367a897..a809059 100755 --- a/httpresource.c +++ b/httpresource.c @@ -166,15 +166,15 @@ int cHttpResource::handleRead() { #endif char buf[MAXLEN]; - int buflen = sizeof(buf); + //int buflen = sizeof(buf); int line_count = 0; // bool is_req = true; string rem_hdr = ""; - buflen = read(mFd, buf, sizeof(buf)); + int nread = read(mFd, buf, sizeof(buf)); - if (buflen == -1) { + if (nread <0) { *(mLog->log())<< " Some Error, no data received" << endl; return ERROR; // Nothing to read } @@ -189,12 +189,12 @@ int cHttpResource::handleRead() { return ERROR; // Nothing to read } - if (buflen == 0) { + if (!nread) { return OKAY; // Nothing to read } if (mConnState == READPAYLOAD) { - mPayload += string(buf, buflen); + mPayload += string(buf, nread); if (mPayload.size() == mReqContentLength) { //Done mConnState = SERVING; @@ -207,8 +207,8 @@ int cHttpResource::handleRead() { mConnState = READHDR; } - string req_line = mReadBuffer + string(buf, buflen); - buflen += rem_hdr.size(); + std::string req_line = mReadBuffer + std::string(buf, nread); + size_t buflen = nread + rem_hdr.size(); size_t last_pos = 0; // Parse http header lines @@ -50,7 +50,7 @@ void cManageUrls::appendEntry(string type, string url) { if (type.compare("YT") !=0) { return; } - for (int i = 0; i < mEntries.size(); i ++) { + for (size_t i = 0; i < mEntries.size(); i ++) { if (url.compare(mEntries[i]->mEntry) == 0) { found = true; break; @@ -73,7 +73,7 @@ bool cManageUrls::deleteEntry(string type, string url) { return false; } - for (int i = 0; i < mEntries.size(); i ++) { + for (size_t i = 0; i < mEntries.size(); i ++) { if (url.compare(mEntries[i]->mEntry) == 0) { // delete the entry here *(mLog->log()) << " cManageUrls::deleteEntry ... " << endl; @@ -91,7 +91,7 @@ bool cManageUrls::deleteEntry(string type, string url) { } mFile = new ofstream(mFilename.c_str(), ios::out); - for (int i = 0; i < mEntries.size(); i ++) { + for (size_t i = 0; i < mEntries.size(); i ++) { appendToFile(mEntries[i]->mType+"|"+mEntries[i]->mEntry); } @@ -104,9 +104,9 @@ void cBoxHdr::reset() { bool cBoxHdr::readFullHdr (FILE* ifd) { uint8_t p[4]; - size_t res; + //size_t res; - res = fread (p, 1, 4, ifd); + fread (p, 1, 4, ifd); mVersion = p[0]; mFlags = (((uint32_t) p[1]) << 16) | (((uint32_t) p[2]) << 8) | @@ -284,7 +284,7 @@ bool cMp4Metadata::findMetadata(FILE* ifd, eBoxes parent) { *(mLog->log())<< DEBUGPREFIX << " end reached" << endl; return false; } - if (pos >= mFilesize) { + if (pos >= (ssize_t)mFilesize) { *(mLog->log())<< DEBUGPREFIX << " end reached. pos larger filesize - done" << endl; return true; } @@ -414,7 +414,7 @@ bool cMp4Metadata::findMetadata(FILE* ifd, eBoxes parent) { << " size= " << mCovrSize << endl; mCovr = new char[mCovrSize]; res = fread (mCovr, 1, m_box.mSize - m_box.mHdrLen -8, ifd); - if (res < (m_box.mSize - m_box.mHdrLen -8)) { + if (res < (ssize_t)(m_box.mSize - m_box.mHdrLen -8)) { *(mLog->log())<< DEBUGPREFIX << " covr read ERROR. res= " << res << endl; } break; diff --git a/responsebase.c b/responsebase.c index 5ee657e..0225af3 100755 --- a/responsebase.c +++ b/responsebase.c @@ -167,6 +167,7 @@ int cResponseBase::fillDataBlk() { mRequest->mConnState = TOCLOSE; return ERROR; } + return OKAY; } bool cResponseBase::isBlkWritten() { diff --git a/responsememblk.c b/responsememblk.c index 410ff1b..076f2c2 100755 --- a/responsememblk.c +++ b/responsememblk.c @@ -453,7 +453,7 @@ int cResponseMemBlk::sendMp4Covr() { mRequest->mConnState = SERVING; - char f[400]; + //char f[400]; cResumeEntry entry; string id; @@ -743,7 +743,7 @@ int cResponseMemBlk::sendDir(struct stat *statbuf) { hdr += f; if (strlen(de->d_name) < 32) { - snprintf(f, sizeof(f), "%*s", 32 - strlen(de->d_name), ""); + snprintf(f, sizeof(f), "%*s", 32 - (int)strlen(de->d_name), ""); hdr += f; } if (S_ISDIR(statbuf->st_mode)) { @@ -1433,7 +1433,7 @@ void cResponseMemBlk::sendTimersXml() { #endif #endif - for (uint i =0; i< s_timers.Size(); i++) { + for (int i =0; i< s_timers.Size(); i++) { // for (cTimer * ti = Timers.First(); ti; ti = Timers.Next(ti)){ // ti->Matches(); const cTimer *ti = s_timers[i]; @@ -1566,7 +1566,7 @@ void cResponseMemBlk::receiveExecRecCmdReq() { << " guid= " << guid << endl; vector<cCmd*>* r_cmds = mRequest->mFactory->getRecCmds(); - if ((cmdid <0 ) || ( cmdid > r_cmds->size())) { + if ( cmdid > r_cmds->size()) { // TODO (cmdid <0)? *(mLog->log())<< DEBUGPREFIX << " ERROR: cmd value out of range." << endl; sendError(400, "Bad Request", NULL, "016 Command (cmd) value out of range."); @@ -1631,7 +1631,7 @@ void cResponseMemBlk::receiveExecCmdReq() { << endl; vector<cCmd*>* r_cmds = mRequest->mFactory->getCmdCmds(); - if ((cmdid <0 ) || ( cmdid > r_cmds->size())) { + if ( cmdid > r_cmds->size()) { // TODO ((cmdid <0 ) || ? *(mLog->log())<< DEBUGPREFIX << " ERROR: cmd value out of range." << endl; sendError(400, "Bad Request", NULL, "016 Command (cmd) value out of range."); @@ -2260,7 +2260,7 @@ int cResponseMemBlk::sendBmlInstHtml() { << mRequest->getOwnIp() << ":" << mRequest->mServerPort; - *(mLog->log()) << " Ownhost= " << own_host << endl; + *(mLog->log()) << " Ownhost= " << own_host.str() << endl; *mResponseMessage = "<html><head>" "<title>SmartTVWeb Bookmarklets</title>" diff --git a/responsevdrdir.c b/responsevdrdir.c index 5727bd6..001946b 100755 --- a/responsevdrdir.c +++ b/responsevdrdir.c @@ -290,7 +290,7 @@ bool cResponseVdrDir::isTimeRequest(struct stat *statbuf) { << endl; if ((mRequest->rangeHdr).isRangeRequest) { - snprintf(pathbuf, sizeof(pathbuf), "Content-Range: bytes 0-%lld/%lld", (mRemLength -1), mRemLength); + snprintf(pathbuf, sizeof(pathbuf), "Content-Range: bytes 0-%zu/%zu", (mRemLength -1), mRemLength); sendHeaders(206, "Partial Content", pathbuf, "video/mpeg", mRemLength, statbuf->st_mtime); } else { diff --git a/smarttvfactory.c b/smarttvfactory.c index ac29a45..10af7c4 100755 --- a/smarttvfactory.c +++ b/smarttvfactory.c @@ -1168,7 +1168,7 @@ string SmartTvServer::processNestedItemList(string pref, cList<cNestedItem> *cmd cCmd *itm = new cCmd(c->Text()); cmd_list->push_back(itm); - snprintf(f, sizeof(f), "<item cmd=\"%d\" confirm=\"%s\">%s</item>\n", cmd_list->size()-1, ((itm->mConfirm)?"true":"false"), + snprintf(f, sizeof(f), "<item cmd=\"%zu\" confirm=\"%s\">%s</item>\n", cmd_list->size()-1, ((itm->mConfirm)?"true":"false"), (pref + itm->mTitle).c_str()); msg += f; } @@ -69,6 +69,8 @@ void cSmartTvConfig::Store(cPlugin *mPlugin) { case EMPTYFOLDERDOWN: mPlugin->SetupStore("GroupSeparators", "EmptyFolderDown"); break; + case IGNORE: + break; } mPlugin->SetupStore("ServerAddress", mServerAddress.c_str()); mPlugin->SetupStore("ServerPort", mServerPort); @@ -255,15 +255,15 @@ string cUrlEncode::removeEtChar(string line, bool xml) { res += line.substr(cur_pos); break; } - if (pos >= 0) { - if (xml) - res += line.substr(cur_pos, (pos-cur_pos)) + "&"; // xml save encoding - else - res += line.substr(cur_pos, (pos-cur_pos)) + "%26"; // url save encoding - // cur_pos = cur_pos+ pos +1; - cur_pos = pos +1; - end_after_done ++; - } + //if (pos >= 0) { + if (xml) + res += line.substr(cur_pos, (pos-cur_pos)) + "&"; // xml save encoding + else + res += line.substr(cur_pos, (pos-cur_pos)) + "%26"; // url save encoding + // cur_pos = cur_pos+ pos +1; + cur_pos = pos +1; + end_after_done ++; + //} } return res; } @@ -274,7 +274,7 @@ string cUrlEncode::hexDump(char *line, int line_len) { char buf[10]; int line_count = 0; - for (unsigned int i = 0; i < line_len; i++) { + for (int i = 0; i < line_len; i++) { unsigned char num = line[i]; sprintf (buf, "%02hhX", num); res += buf; |