From 3d4a3889aa213a5713a82b06a465e33f69340db0 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 25 Mar 2024 20:29:55 +0100 Subject: [PATCH] turn some comparsions for a better readability Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/bee4cb4959c36b1290486c656bafdd6a6b4f9307 Author: vanhofen Date: 2024-03-25 (Mon, 25 Mar 2024) Origin message was: ------------------ - turn some comparsions for a better readability ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/tuxtxt.cpp | 42 +++++++++++----------- lib/libtuxtxt/tuxtxt_common.h | 6 ++-- src/driver/pictureviewer/pictureviewer.cpp | 3 +- src/driver/record.cpp | 2 +- src/driver/streamts.cpp | 2 +- src/gui/channellist.cpp | 4 +-- src/gui/dboxinfo.cpp | 3 +- src/gui/epgview.cpp | 4 +-- src/gui/nfs.cpp | 2 +- src/gui/streaminfo2.cpp | 2 +- src/nhttpd/yhttpd_core/ysocket.cpp | 2 +- src/system/setting_helpers.cpp | 2 +- src/system/sysload.cpp | 2 +- src/zapit/src/udpstreampes.cpp | 35 ++++++++---------- 14 files changed, 51 insertions(+), 60 deletions(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 794470c05..7ce893f91 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -364,7 +364,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; @@ -375,16 +375,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 */ } @@ -449,7 +449,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 */ } @@ -457,7 +457,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); @@ -509,7 +509,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 */ @@ -576,7 +576,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 */ @@ -815,7 +815,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) @@ -836,15 +836,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; @@ -869,9 +869,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 @@ -884,9 +884,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; @@ -984,7 +984,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) @@ -1014,7 +1014,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) @@ -1109,7 +1109,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])); } @@ -1179,7 +1179,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++) { diff --git a/lib/libtuxtxt/tuxtxt_common.h b/lib/libtuxtxt/tuxtxt_common.h index 0251dd7a4..436a310b2 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); @@ -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 3de8c1bea..4eb256af9 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -1064,8 +1064,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 93aa28ae0..e424f32f7 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2301,7 +2301,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 e4be948ec..1ab16ddbe 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2718,14 +2718,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 787f28daf..7993f91d0 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -798,14 +798,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 7f9006d0a..c1e274a9e 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..9ac5d0a8d 100644 --- a/src/nhttpd/yhttpd_core/ysocket.cpp +++ b/src/nhttpd/yhttpd_core/ysocket.cpp @@ -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; diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index cc813df66..278b65ce7 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -601,7 +601,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..fcf043a39 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); @@ -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); @@ -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; } } @@ -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);