turn some comparsions for a better readability; pt. 3

Origin commit data
------------------
Branch: ni/coolstream
Commit: 99bbb95519
Author: vanhofen <vanhofen@gmx.de>
Date: 2024-03-27 (Wed, 27 Mar 2024)

Origin message was:
------------------
- turn some comparsions for a better readability; pt. 3

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2024-03-27 00:10:12 +01:00
parent 57ae2e0df5
commit 5f7e98c4a4
5 changed files with 8 additions and 8 deletions

View File

@@ -530,7 +530,7 @@ void tuxtxt_clear_p26(tstExtData* extData)
for(int i = 0; i < 16; ++i) for(int i = 0; i < 16; ++i)
{ {
if(0 != extData->p26[i]) if(extData->p26[i] != 0)
{ {
memset(extData->p26[i], 0x00, 13 * 3); memset(extData->p26[i], 0x00, 13 * 3);
} }

View File

@@ -94,7 +94,7 @@ void reformatExtendedEvents(std::string strItem, std::string strLabel, bool bUse
sprintf(index, "%d", nItem); sprintf(index, "%d", nItem);
// Look for matching items // Look for matching items
int nPos = findItem(std::string(strItem) + std::string(index), vecDescriptions); int nPos = findItem(std::string(strItem) + std::string(index), vecDescriptions);
if (-1 != nPos) { if (nPos != -1) {
std::string item = std::string(vecItems[nPos]); std::string item = std::string(vecItems[nPos]);
vecDescriptions.erase(vecDescriptions.begin() + nPos); vecDescriptions.erase(vecDescriptions.begin() + nPos);
vecItems.erase(vecItems.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) } else { // Single string event (e.g. Director)
// Look for matching items // Look for matching items
int nPos = findItem(strItem, vecDescriptions); int nPos = findItem(strItem, vecDescriptions);
if (-1 != nPos) { if (nPos != -1) {
vecDescriptions[nPos] = strLabel; vecDescriptions[nPos] = strLabel;
} }
} }

View File

@@ -90,7 +90,7 @@ bool CySocket::initAsSSL(void)
return false; return false;
} }
SSL_set_accept_state(ssl); // accept connection 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))) if (NULL == (ssl = SSL_new(CySocket::SSL_ctx)))
{ {
aprintf("ySocket:SSL Error: Create SSL_new : %s\n", ERR_error_string(ERR_get_error(), NULL) ); aprintf("ySocket:SSL Error: Create SSL_new : %s\n", ERR_error_string(ERR_get_error(), NULL) );
@@ -122,7 +122,7 @@ bool CySocket::initSSL(void)
return false; return false;
} }
if(!SSL_CA_file.empty()) // have a CA? 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()); aprintf("ySocket:SSL Error: %s CA-File:%s\n",ERR_error_string(ERR_get_error(), NULL), SSL_CA_file.c_str());
return false; return false;

View File

@@ -119,8 +119,8 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) {
hh->RangeEnd = hh->ContentLength - 1; hh->RangeEnd = hh->ContentLength - 1;
const char *range = (hh->HeaderList["Range"].empty()) ? NULL : hh->HeaderList["Range"].c_str(); const char *range = (hh->HeaderList["Range"].empty()) ? NULL : hh->HeaderList["Range"].c_str();
if ((range && if ((range &&
(2 != sscanf(range, "bytes=%" PRId64 "-%" PRId64, &hh->RangeStart, &hh->RangeEnd)) && (sscanf(range, "bytes=%" PRId64 "-%" PRId64, &hh->RangeStart, &hh->RangeEnd) != 2) &&
(1 != sscanf(range, "bytes=%" PRId64 "-", &hh->RangeStart))) (sscanf(range, "bytes=%" PRId64 "-", &hh->RangeStart) != 1))
|| (hh->RangeStart > hh->RangeEnd) || (hh->RangeStart > hh->RangeEnd)
|| (hh->RangeEnd > hh->ContentLength - 1)) { || (hh->RangeEnd > hh->ContentLength - 1)) {
hh->SetError(HTTP_REQUEST_RANGE_NOT_SATISFIABLE); hh->SetError(HTTP_REQUEST_RANGE_NOT_SATISFIABLE);

View File

@@ -433,7 +433,7 @@ void * TcpReceiver( void * Ptr )
while(true) { while(true) {
ReadLine( TcpString ); ReadLine( TcpString );
if( !strncmp(TcpString, "RESEND", 6)) { 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"); fprintf(stderr, "ERROR: TcpReceiver - sscanf RESEND\n");
continue; continue;
} }