diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 60d9a896a..120109a3c 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -112,7 +112,7 @@ void gethotlist() if (!fgets(line, sizeof(line), hl)) break; - if (1 == sscanf(line, "%x", (unsigned int*)&hotlist[maxhotlist+1])) + if (sscanf(line, "%x", (unsigned int*)&hotlist[maxhotlist+1]) == 1) { if (hotlist[maxhotlist+1] >= 0x100 && hotlist[maxhotlist+1] <= 0x899) { @@ -366,7 +366,7 @@ void dump_page() /* out: 18 bit triplet data, <0 if invalid number, not cached, or hamming error */ int iTripletNumber2Data(int iONr, tstCachedPage *pstCachedPage, unsigned char* pagedata) { - if (iONr > 506 || 0 == pstCachedPage) + if (iONr > 506 || pstCachedPage == 0) return -1; unsigned char *p; @@ -377,16 +377,16 @@ int iTripletNumber2Data(int iONr, tstCachedPage *pstCachedPage, unsigned char* p p = pagedata + 40*(packet-1) + packetoffset + 1; else if (packet <= 25) { - if (0 == pstCachedPage->pageinfo.p24) + if (pstCachedPage->pageinfo.p24 == 0) return -1; p = pstCachedPage->pageinfo.p24 + 40*(packet-24) + packetoffset + 1; } else { int descode = packet - 26; - if (0 == pstCachedPage->pageinfo.ext) + if (pstCachedPage->pageinfo.ext == 0) return -1; - if (0 == pstCachedPage->pageinfo.ext->p26[descode]) + if (pstCachedPage->pageinfo.ext->p26[descode] == 0) return -1; p = pstCachedPage->pageinfo.ext->p26[descode] + packetoffset; /* first byte (=designation code) is not cached */ } @@ -451,7 +451,7 @@ void eval_object(int iONr, tstCachedPage *pstCachedPage, } iONr++; } - while (0 == eval_triplet(iOData, pstCachedPage, pAPx, pAPy, pAPx0, pAPy0, &drcssubp, &gdrcssubp, &endcol, &attrPassive, pagedata) + while (eval_triplet(iOData, pstCachedPage, pAPx, pAPy, pAPx0, pAPy0, &drcssubp, &gdrcssubp, &endcol, &attrPassive, pagedata) == 0 || iONr1 == iONr); /* repeat until termination reached */ } @@ -459,7 +459,7 @@ void eval_NumberedObject(int p, int s, int packet, int triplet, int high, unsigned char *pAPx, unsigned char *pAPy, unsigned char *pAPx0, unsigned char *pAPy0) { - if (!packet || 0 == tuxtxt_cache.astCachetable[p][s]) + if (!packet || tuxtxt_cache.astCachetable[p][s] == 0) return; unsigned char pagedata[23*40]; tuxtxt_decompress_page(p, s,pagedata); @@ -511,7 +511,7 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, switch (iMode) { case 0x00: - if (0 == (iData>>5)) + if ((iData>>5) == 0) { int newcolor = iData & 0x1f; if (*endcol < 0) /* passive object */ @@ -578,7 +578,7 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, page_atrb[offset].charset = C_G3; break; case 0x03: - if (0 == (iData>>5)) + if ((iData>>5) == 0) { int newcolor = iData & 0x1f; if (*endcol < 0) /* passive object */ @@ -817,7 +817,7 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, switch (iMode) { case 0x00: - if (0 == (iData>>5)) + if ((iData>>5) == 0) { #if TUXTXT_DEBUG if (dumpl25) @@ -838,15 +838,15 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, if (dumpl25) { printf(" AP=%d,0", RowAddress2Row(iAddress)); - if (0 == (iData>>5)) + if ((iData>>5) == 0) printf(" FRowCol T%x#%x", (iData>>3)&0x03, iData&0x07); - else if (3 == (iData>>5)) + else if ((iData>>5) == 3) printf(" FRowCol++ T%x#%x", (iData>>3)&0x03, iData&0x07); } #endif - if (row <= 24 && 0 == (iData>>5)) + if (row <= 24 && (iData>>5) == 0) maxrow = row; - else if (3 == (iData>>5)) + else if ((iData>>5) == 3) maxrow = 24; else maxrow = -1; @@ -871,9 +871,9 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, { if (iAddress == 0x3f) printf(" AP=0,0"); - if (0 == (iData>>5)) + if ((iData>>5) == 0) printf(" Address Display R0 FRowCol T%x#%x", (iData>>3)&0x03, iData&0x07); - else if (3 == (iData>>5)) + else if ((iData>>5) == 0) printf(" Address Display R0->24 FRowCol T%x#%x", (iData>>3)&0x03, iData&0x07); } #endif @@ -886,9 +886,9 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, int row = *pAPy0; // + *pAPy; int maxrow; - if (row <= 24 && 0 == (iData>>5)) + if (row <= 24 && (iData>>5) == 0) maxrow = row; - else if (3 == (iData>>5)) + else if ((iData>>5) == 0) maxrow = 24; else maxrow = -1; @@ -986,7 +986,7 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, case 0x15: case 0x16: case 0x17: - if (0 == (iAddress & 0x08)) /* Object Definition illegal or only level 3.5 */ + if ((iAddress & 0x08) == 0) /* Object Definition illegal or only level 3.5 */ break; /* ignore */ #if TUXTXT_DEBUG if (dumpl25) @@ -1016,7 +1016,7 @@ int eval_triplet(int iOData, tstCachedPage *pstCachedPage, return 0xFF; /* termination by object definition */ break; case 0x18: - if (0 == (iData & 0x10)) /* DRCS Mode reserved or only level 3.5 */ + if ((iData & 0x10) == 0) /* DRCS Mode reserved or only level 3.5 */ break; /* ignore */ #if TUXTXT_DEBUG if (dumpl25) @@ -1111,7 +1111,7 @@ void eval_l25() { if (p[i] == 0xff) break; - if (0 == (i % 40)) + if ((i % 40) == 0) printf("\n%x ", i / 20); putchar(number2char(p[i])); } @@ -1181,7 +1181,7 @@ void eval_l25() int idata = dehamming[*ptriplet]; int triplet; - if (idata == 0xff || 0 == (idata & 1)) /* hamming error or no pointer data: ignore packet */ + if (idata == 0xff || (idata & 1) == 0) /* hamming error or no pointer data: ignore packet */ continue; for (triplet = 1; triplet <= 12; triplet++) { @@ -1968,58 +1968,58 @@ int Init(int source) if (!fgets(line, sizeof(line), conf)) break; - if (1 == sscanf(line, "ScreenMode16x9Normal %i", &ival)) + if (sscanf(line, "ScreenMode16x9Normal %i", &ival) == 1) screen_mode1 = ival & 1; - else if (1 == sscanf(line, "Brightness %i", &ival)) + else if (sscanf(line, "Brightness %i", &ival) == 1) color_mode = ival; - else if (1 == sscanf(line, "AutoNational %i", &ival)) + else if (sscanf(line, "AutoNational %i", &ival) == 1) auto_national = ival & 1; - else if (1 == sscanf(line, "NationalSubset %i", &ival)) + else if (sscanf(line, "NationalSubset %i", &ival) == 1) { if (ival >= 0 && ival <= (int) MAX_NATIONAL_SUBSET) national_subset = ival; } - else if (1 == sscanf(line, "MenuLanguage %i", &ival)) + else if (sscanf(line, "MenuLanguage %i", &ival) == 1) { if (ival >= 0 && ival <= MAXMENULANGUAGE) menulanguage = ival; } - else if (1 == sscanf(line, "SwapUpDown %i", &ival)) + else if (sscanf(line, "SwapUpDown %i", &ival) == 1) swapupdown = ival & 1; - else if (1 == sscanf(line, "ShowHexPages %i", &ival)) + else if (sscanf(line, "ShowHexPages %i", &ival) == 1) showhex = ival & 1; - else if (1 == sscanf(line, "Transparency %i", &ival)) + else if (sscanf(line, "Transparency %i", &ival) == 1) trans_mode = ival; - else if (1 == sscanf(line, "TTFWidthFactor16 %i", &ival)) + else if (sscanf(line, "TTFWidthFactor16 %i", &ival) == 1) TTFWidthFactor16 = ival; - else if (1 == sscanf(line, "TTFHeightFactor16 %i", &ival)) + else if (sscanf(line, "TTFHeightFactor16 %i", &ival) == 1) TTFHeightFactor16 = ival; - else if (1 == sscanf(line, "TTFShiftX %i", &ival)) + else if (sscanf(line, "TTFShiftX %i", &ival) == 1) TTFShiftX = ival; - else if (1 == sscanf(line, "TTFShiftY %i", &ival)) + else if (sscanf(line, "TTFShiftY %i", &ival) == 1) TTFShiftY = ival; - else if (1 == sscanf(line, "Screenmode %i", &ival)) + else if (sscanf(line, "Screenmode %i", &ival) == 1) screenmode[0] = ival; - else if (1 == sscanf(line, "ScreenmodeBoxed %i", &ival)) + else if (sscanf(line, "ScreenmodeBoxed %i", &ival) == 1) screenmode[1] = ival; - else if (1 == sscanf(line, "ShowFLOF %i", &ival)) + else if (sscanf(line, "ShowFLOF %i", &ival) == 1) showflof = ival & 1; - else if (1 == sscanf(line, "Show39 %i", &ival)) + else if (sscanf(line, "Show39 %i", &ival) == 1) show39 = ival & 1; - else if (1 == sscanf(line, "ShowLevel2p5 %i", &ival)) + else if (sscanf(line, "ShowLevel2p5 %i", &ival) == 1) showl25 = ival & 1; - else if (1 == sscanf(line, "DumpLevel2p5 %i", &ival)) + else if (sscanf(line, "DumpLevel2p5 %i", &ival) == 1) dumpl25 = ival & 1; - else if (1 == sscanf(line, "UseTTF %i", &ival)) + else if (sscanf(line, "UseTTF %i", &ival) == 1) usettf = ival & 1; #if 0 - else if (1 == sscanf(line, "StartX %i", &ival)) + else if (sscanf(line, "StartX %i", &ival) == 1) sx = ival; - else if (1 == sscanf(line, "EndX %i", &ival)) + else if (sscanf(line, "EndX %i", &ival) == 1) ex = ival; - else if (1 == sscanf(line, "StartY %i", &ival)) + else if (sscanf(line, "StartY %i", &ival) == 1) sy = ival; - else if (1 == sscanf(line, "EndY %i", &ival)) + else if (sscanf(line, "EndY %i", &ival) == 1) ey = ival; #endif } diff --git a/lib/libtuxtxt/tuxtxt_common.h b/lib/libtuxtxt/tuxtxt_common.h index 0251dd7a4..72ed934d8 100644 --- a/lib/libtuxtxt/tuxtxt_common.h +++ b/lib/libtuxtxt/tuxtxt_common.h @@ -188,7 +188,7 @@ void tuxtxt_decode_btt() int i, current, b1, b2, b3, b4; unsigned char btt[23*40] = {0}; - if (tuxtxt_cache.subpagetable[0x1f0] == 0xff || 0 == tuxtxt_cache.astCachetable[0x1f0][tuxtxt_cache.subpagetable[0x1f0]]) /* not yet received */ + if (tuxtxt_cache.subpagetable[0x1f0] == 0xff || tuxtxt_cache.astCachetable[0x1f0][tuxtxt_cache.subpagetable[0x1f0]] == 0) /* not yet received */ return; tuxtxt_decompress_page(0x1f0,tuxtxt_cache.subpagetable[0x1f0],btt); if (btt[799] == ' ') /* not completely received or error */ @@ -255,7 +255,7 @@ void tuxtxt_decode_adip() /* additional information table */ for (i = 0; i <= tuxtxt_cache.maxadippg; i++) { p = tuxtxt_cache.adippg[i]; - if (!p || tuxtxt_cache.subpagetable[p] == 0xff || 0 == tuxtxt_cache.astCachetable[p][tuxtxt_cache.subpagetable[p]]) /* not cached (avoid segfault) */ + if (!p || tuxtxt_cache.subpagetable[p] == 0xff || tuxtxt_cache.astCachetable[p][tuxtxt_cache.subpagetable[p]] == 0) /* not cached (avoid segfault) */ continue; tuxtxt_decompress_page(p,tuxtxt_cache.subpagetable[p],padip); @@ -530,7 +530,7 @@ void tuxtxt_clear_p26(tstExtData* extData) for(int i = 0; i < 16; ++i) { - if(0 != extData->p26[i]) + if(extData->p26[i] != 0) { memset(extData->p26[i], 0x00, 13 * 3); } @@ -858,7 +858,7 @@ void *tuxtxt_CacheThread(void * /*arg*/) do { for (; - l >= 2 && 0 == tuxtxt_cache.flofpages[tuxtxt_cache.current_page[magazine]][l]; + l >= 2 && tuxtxt_cache.flofpages[tuxtxt_cache.current_page[magazine]][l] == 0; l--) ; /* find used linkindex */ for (; diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 7096e5a7f..a37521a7b 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -1035,8 +1035,7 @@ static size_t getCachedMemSize(void) while (fgets(buf, sizeof(buf), procmeminfo)) { char unit[10]; *unit = 0; - if ((3 == sscanf(buf, "%[^:]: %zu %s", a, &v, unit)) - || (2 == sscanf(buf, "%[^:]: %zu", a, &v))) { + if ((sscanf(buf, "%[^:]: %zu %s", a, &v, unit) == 3) || (sscanf(buf, "%[^:]: %zu", a, &v) == 2)) { if (*unit == 'k') v <<= 10; if (!strcasecmp(a, "Cached")){ diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 7c67732e6..feaf20788 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2228,7 +2228,7 @@ bool CStreamRec::Open(CZapitChannel * channel) if (!headers.empty())//add cookies av_dict_set(&options, "headers", headers.c_str(), 0); - if (0 == strncmp(url.c_str(), "http://", 7) || 0 == strncmp(url.c_str(), "https://", 8)) + if (strncmp(url.c_str(), "http://", 7) == 0 || strncmp(url.c_str(), "https://", 8) == 0) { av_dict_set(&options, "timeout", "20000000", 0); //20sec av_dict_set(&options, "reconnect", "1", 0); diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index a216f1552..d35a9a2b8 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -874,7 +874,7 @@ bool CStreamStream::Open() if (!headers.empty()) av_dict_set(&options, "headers", headers.c_str(), 0); - if (0 == strncmp(url.c_str(), "http://", 7) || 0 == strncmp(url.c_str(), "https://", 8)) + if (strncmp(url.c_str(), "http://", 7) == 0 || strncmp(url.c_str(), "https://", 8) == 0) { av_dict_set(&options, "timeout", "20000000", 0); //20sec av_dict_set(&options, "reconnect", "1", 0); diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 2c3b660df..e3ed66bdc 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2717,14 +2717,14 @@ void CChannelList::showdescription(int index) if (nPosDot < epgData.info2.length() && nPosDot < epgData.info1.length()) { // Make sure we don't overrun the buffer // Check if the stuff after the dot equals the beginning of info2 - if (0 == epgData.info2.find(epgData.info1.substr(nPosDot, epgData.info1.length() - nPosDot))) { + if (epgData.info2.find(epgData.info1.substr(nPosDot, epgData.info1.length() - nPosDot)) == 0) { strEpisode = epgData.info1.substr(0, nPosDot) + "\n"; bHide = true; } } } // Compare strings normally if not positively found to be equal before - if (false == bHide && 0 == epgData.info2.find(epgData.info1)) { + if (false == bHide && epgData.info2.find(epgData.info1) == 0) { bHide = true; } } diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index e417a7135..b87f03162 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -282,8 +282,7 @@ void CDBoxInfoWidget::paint() while (fgets(buf, sizeof(buf), procmeminfo)) { char unit[10]; *unit = 0; - if ((3 == sscanf(buf, "%[^:]: %llu %s", a, &v, unit)) - || (2 == sscanf(buf, "%[^:]: %llu", a, &v))) { + if ((sscanf(buf, "%[^:]: %llu %s", a, &v, unit) == 3) || (sscanf(buf, "%[^:]: %llu", a, &v) == 2)) { if (*unit == 'k') v <<= 10; if (!strcasecmp(a, "MemTotal")) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index ac570a9d1..83345593d 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -94,7 +94,7 @@ void reformatExtendedEvents(std::string strItem, std::string strLabel, bool bUse sprintf(index, "%d", nItem); // Look for matching items int nPos = findItem(std::string(strItem) + std::string(index), vecDescriptions); - if (-1 != nPos) { + if (nPos != -1) { std::string item = std::string(vecItems[nPos]); vecDescriptions.erase(vecDescriptions.begin() + nPos); vecItems.erase(vecItems.begin() + nPos); @@ -115,7 +115,7 @@ void reformatExtendedEvents(std::string strItem, std::string strLabel, bool bUse } else { // Single string event (e.g. Director) // Look for matching items int nPos = findItem(strItem, vecDescriptions); - if (-1 != nPos) { + if (nPos != -1) { vecDescriptions[nPos] = strLabel; } } @@ -782,14 +782,14 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if (nPosDot < epgData.info2.length() && nPosDot < epgData.info1.length()) { // Make sure we don't overrun the buffer // Check if the stuff after the dot equals the beginning of info2 - if (0 == epgData.info2.find(epgData.info1.substr(nPosDot, epgData.info1.length() - nPosDot))) { + if (epgData.info2.find(epgData.info1.substr(nPosDot, epgData.info1.length() - nPosDot)) == 0) { strEpisode = epgData.info1.substr(0, nPosDot) + "\n"; bHide = true; } } } // Compare strings normally if not positively found to be equal before - if (false == bHide && 0 == epgData.info2.find(epgData.info1)) { + if (false == bHide && epgData.info2.find(epgData.info1) == 0) { bHide = true; } } diff --git a/src/gui/nfs.cpp b/src/gui/nfs.cpp index 385c23736..07de0f434 100644 --- a/src/gui/nfs.cpp +++ b/src/gui/nfs.cpp @@ -140,7 +140,7 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey ) if (arptable) { char line[120], ip[120], mac[120]; while (fgets(line, sizeof(line), arptable)) { - if (2 == sscanf(line, "%s %*s %*s %s %*[^\n]", ip, mac)) { + if (sscanf(line, "%s %*s %*s %s %*[^\n]", ip, mac) == 2) { if (!strcmp(ip, h.c_str())) { g_settings.network_nfs[nr].mac = std::string(mac); break; diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index cbe096d19..9943d4501 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -1428,7 +1428,7 @@ void CStreamInfo2::paintCASystem(int xpos, int ypos, bool fake) { col = COL_MENUCONTENTINACTIVE_TEXT; int id; - if (1 == sscanf(casys[ca_id].substr(last_pos, pos - last_pos).c_str(), "%X", &id) && acaid == id) + if (sscanf(casys[ca_id].substr(last_pos, pos - last_pos).c_str(), "%X", &id) == 1 && acaid == id) col = COL_MENUCONTENT_TEXT; } if (!fake) diff --git a/src/nhttpd/yhttpd_core/ysocket.cpp b/src/nhttpd/yhttpd_core/ysocket.cpp index 2f5575bc5..705926101 100644 --- a/src/nhttpd/yhttpd_core/ysocket.cpp +++ b/src/nhttpd/yhttpd_core/ysocket.cpp @@ -90,7 +90,7 @@ bool CySocket::initAsSSL(void) return false; } SSL_set_accept_state(ssl); // accept connection - if(1 != (SSL_set_fd(ssl, sock))) // associate socket descriptor + if((SSL_set_fd(ssl, sock)) != 1) // associate socket descriptor if (NULL == (ssl = SSL_new(CySocket::SSL_ctx))) { aprintf("ySocket:SSL Error: Create SSL_new : %s\n", ERR_error_string(ERR_get_error(), NULL) ); @@ -106,7 +106,7 @@ bool CySocket::initSSL(void) { SSL_load_error_strings(); // Load SSL Error Strings SSL_library_init(); // Load SSL Library - if (0 == RAND_status()) // set Random + if (RAND_status() == 0) // set Random { aprintf("ySocket:SSL got no rand\n"); return false; @@ -122,7 +122,7 @@ bool CySocket::initSSL(void) return false; } if(!SSL_CA_file.empty()) // have a CA? - if(1 != SSL_CTX_load_verify_locations(SSL_ctx, SSL_CA_file.c_str(), NULL)) + if(SSL_CTX_load_verify_locations(SSL_ctx, SSL_CA_file.c_str(), NULL) != 1) { aprintf("ySocket:SSL Error: %s CA-File:%s\n",ERR_error_string(ERR_get_error(), NULL), SSL_CA_file.c_str()); return false; diff --git a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp index b7efb6d4c..fe77f3687 100644 --- a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp +++ b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp @@ -119,8 +119,8 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) { hh->RangeEnd = hh->ContentLength - 1; const char *range = (hh->HeaderList["Range"].empty()) ? NULL : hh->HeaderList["Range"].c_str(); if ((range && - (2 != sscanf(range, "bytes=%" PRId64 "-%" PRId64, &hh->RangeStart, &hh->RangeEnd)) && - (1 != sscanf(range, "bytes=%" PRId64 "-", &hh->RangeStart))) + (sscanf(range, "bytes=%" PRId64 "-%" PRId64, &hh->RangeStart, &hh->RangeEnd) != 2) && + (sscanf(range, "bytes=%" PRId64 "-", &hh->RangeStart) != 1)) || (hh->RangeStart > hh->RangeEnd) || (hh->RangeEnd > hh->ContentLength - 1)) { hh->SetError(HTTP_REQUEST_RANGE_NOT_SATISFIABLE); diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index e06aae593..c6addf673 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -563,7 +563,7 @@ std::string CNetAdapter::getMacAddr(void) long stat; u_char addr[6]; stat = mac_addr_sys(addr); - if (0 == stat) + if (stat == 0) { std::stringstream mac_tmp; for (int i = 0; i < 6; ++i) diff --git a/src/system/sysload.cpp b/src/system/sysload.cpp index 341a8c189..89ca812f8 100644 --- a/src/system/sysload.cpp +++ b/src/system/sysload.cpp @@ -61,7 +61,7 @@ void *cSysLoad::Run(void *arg) std::string line; while (getline(in, line)) { unsigned long _stat_user, _stat_nice, _stat_system, _stat_idle; - if (4 == sscanf(line.c_str(), "cpu %lu %lu %lu %lu", &_stat_user, &_stat_nice, &_stat_system, &_stat_idle)) { + if (sscanf(line.c_str(), "cpu %lu %lu %lu %lu", &_stat_user, &_stat_nice, &_stat_system, &_stat_idle) == 4) { unsigned long _stat_total = _stat_user + _stat_nice + _stat_system + _stat_idle; if (stat_total) { unsigned long div = _stat_total - stat_total; diff --git a/src/zapit/src/udpstreampes.cpp b/src/zapit/src/udpstreampes.cpp index 9796fb766..37c9ab8e5 100644 --- a/src/zapit/src/udpstreampes.cpp +++ b/src/zapit/src/udpstreampes.cpp @@ -95,7 +95,7 @@ void RestartUdpSender() struct sched_param SchedParam; if ( Send.Socket != -1 ) { - if( -1 == close( Send.Socket ) ) { + if( close( Send.Socket ) == -1 ) { perror("ERROR: RestartUdpSender() - close"); fflush(stderr); } @@ -107,8 +107,7 @@ void RestartUdpSender() fflush(stderr); exit(-1); } - if( -1 == connect( Send.Socket, (struct sockaddr*)&(Send.Addr), - Send.AddrLen ) ) { + if( connect( Send.Socket, (struct sockaddr*)&(Send.Addr), Send.AddrLen ) == -1 ) { perror("ERROR: RestartUdpSender() - connect"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -121,8 +120,7 @@ void RestartUdpSender() pthread_attr_setschedparam(&ThreadAttr, &SchedParam); // bei Polling fuehrt die hohe Proritaet zu DmxBufferOverflows - if ( -1 == pthread_create(&(Send.Thread), 0, // &ThreadAttr, - UdpSender, 0 ) ) { + if ( pthread_create(&(Send.Thread), 0, /*&ThreadAttr*/, mUdpSender, 0 ) == -1 ) { perror("ERROR: RestartUdpSender() - pthread_create"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -158,10 +156,8 @@ void * UdpSender( void * Ptr ) Send.Packet = i; // MSG_DONTWAIT ist notwendig, weil bei blocking I/O send() // frueher oder spaeter haengen bleibt -> Watchdog - if ( -1 == write (Send.Socket, ReadPtr, - DATA_PER_PACKET ) ) { -// while ( -1 == send (Send.Socket, ReadPtr, -// DATA_PER_PACKET, MSG_DONTWAIT ) ) { + if ( write (Send.Socket, ReadPtr, DATA_PER_PACKET ) == -1 ) { +// while ( send (Send.Socket, ReadPtr, DATA_PER_PACKET, MSG_DONTWAIT ) == -1 ) { // if( errno != EAGAIN ) { // pselect(1, NULL, &wfds, NULL, &ts, NULL); // } else { @@ -198,7 +194,7 @@ void * DmxTSReader( void * /*Ptr*/ ) unsigned u; fd_dvr = open("/dev/dvb/adapter0/dvr0", O_RDONLY); - if (-1 == fd_dvr) { + if (fd_dvr == -1) { perror("ERROR: main() - dvr0 open"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -207,14 +203,13 @@ void * DmxTSReader( void * /*Ptr*/ ) for (u = 0; u < StreamNum; u++) { Stream[u].fd = open("/dev/dvb/adapter0/demux0", O_RDWR); - if (-1 == Stream[u].fd) { + if (Stream[u].fd == -1) { perror("ERROR: main() - demux0 open"); fprintf(stderr, "EXIT\n"); fflush(stderr); exit(-1); } - if ( -1 == ioctl(Stream[u].fd, DMX_SET_BUFFER_SIZE, //256*1024) ) { - Stream[u].BufPacketNum * NET_DATA_PER_PACKET * DMX_BUF_FACTOR) ) { + if (ioctl(Stream[u].fd, DMX_SET_BUFFER_SIZE, Stream[u].BufPacketNum * NET_DATA_PER_PACKET * DMX_BUF_FACTOR) == -1 ) { perror("ERROR: main() - dmx set buffer ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -234,14 +229,14 @@ void * DmxTSReader( void * /*Ptr*/ ) Stream[u].Filter.pes_type=DMX_PES_OTHER; Stream[u].Filter.flags=0; //Stream[u].Filter.flags=DMX_IMMEDIATE_START; - if (-1==ioctl(Stream[u].fd, DMX_SET_PES_FILTER, &(Stream[u].Filter)) ) { + if (ioctl(Stream[u].fd, DMX_SET_PES_FILTER, &(Stream[u].Filter)) == -1) { perror("ERROR: main() - DMX_SET_PES_FILTER ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); exit(-1); } - if ( -1==ioctl(Stream[u].fd, DMX_START, 0) ) { + if (ioctl(Stream[u].fd, DMX_START, 0) == -1) { perror("ERROR: DmxReader() - DMX_START ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -257,14 +252,14 @@ void * DmxTSReader( void * /*Ptr*/ ) Stream[u].Filter.pes_type=DMX_PES_OTHER; Stream[u].Filter.flags=0; //Stream[u].Filter.flags=DMX_IMMEDIATE_START; - if (-1==ioctl(Stream[u].fd, DMX_SET_PES_FILTER, &(Stream[u].Filter)) ) { + if (ioctl(Stream[u].fd, DMX_SET_PES_FILTER, &(Stream[u].Filter)) == -1) { perror("ERROR: main() - DMX_SET_PES_FILTER ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); exit(-1); } - if ( -1==ioctl(Stream[u].fd, DMX_START, 0) ) { + if (ioctl(Stream[u].fd, DMX_START, 0) == -1) { perror("ERROR: DmxReader() - DMX_START ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -307,7 +302,7 @@ void * DmxTSReader( void * /*Ptr*/ ) } for (u = 0; u < StreamNum; u++) { - if ( -1 == ioctl(Stream[u].fd, DMX_STOP, 0) ) { + if ( ioctl(Stream[u].fd, DMX_STOP, 0) == -1 ) { perror("ERROR: DmxReader() - dmx stop ioctl"); fprintf(stderr, "Pid %x\n", Stream[u].Filter.pid); fflush(stderr); @@ -330,15 +325,14 @@ void * DmxReader( void * Ptr ) BufSize = (CurStream->BufPacketNum) * NET_DATA_PER_PACKET; CurStream->fd = open("/dev/dvb/adapter0/demux0", O_RDWR); - if (-1 == CurStream->fd) { + if (CurStream->fd == -1) { perror("ERROR: main() - demux0 open"); fprintf(stderr, "EXIT\n"); fflush(stderr); exit(-1); } - if ( -1 == ioctl(CurStream->fd, DMX_SET_BUFFER_SIZE, // 1024*1024) ) { - CurStream->BufPacketNum * NET_DATA_PER_PACKET * DMX_BUF_FACTOR) ) { + if ( ioctl(CurStream->fd, DMX_SET_BUFFER_SIZE, CurStream->BufPacketNum * NET_DATA_PER_PACKET * DMX_BUF_FACTOR) == -1 ) { perror("ERROR: main() - dmx set buffer ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -351,14 +345,14 @@ void * DmxReader( void * Ptr ) //CurStream->Filter.flags=0; CurStream->Filter.flags=DMX_IMMEDIATE_START; - if (-1==ioctl(CurStream->fd, DMX_SET_PES_FILTER, &(CurStream->Filter)) ) { + if (ioctl(CurStream->fd, DMX_SET_PES_FILTER, &(CurStream->Filter)) == -1) { perror("ERROR: main() - DMX_SET_PES_FILTER ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); exit(-1); } - if ( -1==ioctl(CurStream->fd, DMX_START, 0) ) { + if (ioctl(CurStream->fd, DMX_START, 0) == -1) { perror("ERROR: DmxReader() - DMX_START ioctl"); fprintf(stderr, "EXIT\n"); fflush(stderr); @@ -403,7 +397,7 @@ void * DmxReader( void * Ptr ) BufLen = 0; } - if ( -1 == ioctl(CurStream->fd, DMX_STOP, 0) ) { + if ( ioctl(CurStream->fd, DMX_STOP, 0) == -1 ) { perror("ERROR: DmxReader() - dmx stop ioctl"); fprintf(stderr, "Pid %x\n", CurStream->Filter.pid); fflush(stderr); @@ -421,7 +415,7 @@ void ReadLine( char String[] ) StrPtr = String; while (StrPtr-String < STRING_SIZE-1 ) { - if ( 1 == read(STDIN_FILENO, &c, 1) ) { + if ( read(STDIN_FILENO, &c, 1) == 1 ) { if ((*StrPtr++=c)=='\n') break; } } @@ -439,7 +433,7 @@ void * TcpReceiver( void * Ptr ) while(true) { ReadLine( TcpString ); if( !strncmp(TcpString, "RESEND", 6)) { - if ( 2 != sscanf(TcpString, "RESEND %u %s", &SPktBuf, PacketString) ) { + if (sscanf(TcpString, "RESEND %u %s", &SPktBuf, PacketString) != 2) { fprintf(stderr, "ERROR: TcpReceiver - sscanf RESEND\n"); continue; } @@ -650,8 +644,7 @@ int main () // Adresse fuer Send.Socket ermitteln Send.AddrLen = sizeof(struct sockaddr_in); - if ( -1 == getpeername(STDIN_FILENO, - (struct sockaddr *)&(Send.Addr), &(Send.AddrLen)) ) { + if ( getpeername(STDIN_FILENO, (struct sockaddr *)&(Send.Addr), &(Send.AddrLen)) == -1 ) { perror("ERROR: main() - getpeername"); fprintf(stderr, "EXIT\n"); fflush(stderr);