[warnings] silence and fix unused results

This commit is contained in:
akallabeth 2024-09-14 20:55:48 +02:00
parent 65de25205b
commit a1cef8dd85
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
16 changed files with 40 additions and 30 deletions

View File

@ -1021,9 +1021,9 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_
return FALSE;
}
_fseeki64(fp, 0, SEEK_END);
(void)_fseeki64(fp, 0, SEEK_END);
file_size = _ftelli64(fp);
_fseeki64(fp, 0, SEEK_SET);
(void)_fseeki64(fp, 0, SEEK_SET);
if (file_size < 1)
{

View File

@ -286,12 +286,12 @@ static BYTE* test_progressive_load_file(const char* path, const char* file, size
if (!fp)
return NULL;
_fseeki64(fp, 0, SEEK_END);
(void)_fseeki64(fp, 0, SEEK_END);
const INT64 pos = _ftelli64(fp);
WINPR_ASSERT(pos >= 0);
WINPR_ASSERT(pos <= SIZE_MAX);
*size = (size_t)pos;
_fseeki64(fp, 0, SEEK_SET);
(void)_fseeki64(fp, 0, SEEK_SET);
BYTE* buffer = (BYTE*)malloc(*size);
if (!buffer)

View File

@ -1246,9 +1246,9 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
return -1;
}
_fseeki64(fp, 0, SEEK_END);
(void)_fseeki64(fp, 0, SEEK_END);
fileSize.i64 = _ftelli64(fp);
_fseeki64(fp, 0, SEEK_SET);
(void)_fseeki64(fp, 0, SEEK_SET);
if (fileSize.i64 < 1)
{

View File

@ -624,9 +624,11 @@ static BYTE* loadCalFile(const rdpSettings* settings, const char* hostname, size
if (!fp)
goto error_open;
_fseeki64(fp, 0, SEEK_END);
if (_fseeki64(fp, 0, SEEK_END) != 0)
goto error_malloc;
length = _ftelli64(fp);
_fseeki64(fp, 0, SEEK_SET);
if (_fseeki64(fp, 0, SEEK_SET) != 0)
goto error_malloc;
if (length < 0)
goto error_malloc;

View File

@ -85,7 +85,7 @@ state_run_t multitransport_recv_request(rdpMultitransport* multi, wStream* s)
WLog_WARN(TAG,
"reserved is %" PRIu16 " instead of 0, skipping %" PRIuz "bytes of unknown data",
reserved, Stream_GetRemainingLength(s));
Stream_SafeSeek(s, Stream_GetRemainingLength(s));
(void)Stream_SafeSeek(s, Stream_GetRemainingLength(s));
}
WINPR_ASSERT(multi->MtRequest);

View File

@ -57,7 +57,7 @@ static void delete_file(char* path)
int rs = _fseeki64(fp, 0, SEEK_END);
if (rs == 0)
size = _ftelli64(fp);
_fseeki64(fp, 0, SEEK_SET);
(void)_fseeki64(fp, 0, SEEK_SET);
for (INT64 x = 0; x < size; x += sizeof(buffer))
{

View File

@ -80,7 +80,7 @@ static
return FALSE;
if (pOffset)
_fseeki64(fp, *pOffset, SEEK_SET);
(void)_fseeki64(fp, *pOffset, SEEK_SET);
r = fread(&ts, 1, sizeof(ts), fp);
if (r != sizeof(ts))

View File

@ -221,9 +221,9 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
return 0;
if (arg1)
fcntl((int)ptr->socket, F_SETFL, flags | O_NONBLOCK);
(void)fcntl((int)ptr->socket, F_SETFL, flags | O_NONBLOCK);
else
fcntl((int)ptr->socket, F_SETFL, flags & ~(O_NONBLOCK));
(void)fcntl((int)ptr->socket, F_SETFL, flags & ~(O_NONBLOCK));
#else
/* the internal socket is always non-blocking */

View File

@ -401,7 +401,8 @@ static BOOL vgids_ef_read_do(vgidsEF* ef, UINT16 doID, BYTE** data, DWORD* dataS
else
{
/* Skip DO */
Stream_SafeSeek(ef->data, doSize);
if (!Stream_SafeSeek(ef->data, doSize))
return FALSE;
}
}

View File

@ -252,7 +252,7 @@ int freerdp_interruptible_getc(rdpContext* context, FILE* f)
const int fd = fileno(f);
const int orig = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, orig | O_NONBLOCK);
(void)fcntl(fd, F_SETFL, orig | O_NONBLOCK);
do
{
const int res = wait_for_fd(fd, 10);
@ -266,7 +266,7 @@ int freerdp_interruptible_getc(rdpContext* context, FILE* f)
}
} while (!freerdp_shall_disconnect_context(context));
fcntl(fd, F_SETFL, orig);
(void)fcntl(fd, F_SETFL, orig);
return rc;
}

View File

@ -225,9 +225,9 @@ rdpPcap* pcap_open(const char* name, BOOL write)
}
else
{
_fseeki64(pcap->fp, 0, SEEK_END);
(void)_fseeki64(pcap->fp, 0, SEEK_END);
pcap->file_size = _ftelli64(pcap->fp);
_fseeki64(pcap->fp, 0, SEEK_SET);
(void)_fseeki64(pcap->fp, 0, SEEK_SET);
if (!pcap_read_header(pcap, &pcap->header))
goto fail;
}

View File

@ -217,7 +217,7 @@ static HANDLE NamedPipeClientCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAcces
int flags = fcntl(pNamedPipe->clientfd, F_GETFL);
if (flags != -1)
fcntl(pNamedPipe->clientfd, F_SETFL, flags | O_NONBLOCK);
(void)fcntl(pNamedPipe->clientfd, F_SETFL, flags | O_NONBLOCK);
#endif
}

View File

@ -95,9 +95,11 @@ static BOOL reg_load_start(Reg* reg)
WINPR_ASSERT(reg);
WINPR_ASSERT(reg->fp);
_fseeki64(reg->fp, 0, SEEK_END);
if (_fseeki64(reg->fp, 0, SEEK_END) != 0)
return FALSE;
file_size = _ftelli64(reg->fp);
_fseeki64(reg->fp, 0, SEEK_SET);
if (_fseeki64(reg->fp, 0, SEEK_SET) != 0)
return FALSE;
reg->line = NULL;
reg->next_line = NULL;

View File

@ -139,9 +139,11 @@ static BOOL SamLookupStart(WINPR_SAM* sam)
if (!sam || !sam->fp)
return FALSE;
_fseeki64(sam->fp, 0, SEEK_END);
if (_fseeki64(sam->fp, 0, SEEK_END) != 0)
return FALSE;
fileSize = _ftelli64(sam->fp);
_fseeki64(sam->fp, 0, SEEK_SET);
if (_fseeki64(sam->fp, 0, SEEK_SET) != 0)
return FALSE;
if (fileSize < 1)
return FALSE;

View File

@ -99,11 +99,14 @@ static BOOL WLog_UdpAppender_WriteMessage(wLog* log, wLogAppender* appender, wLo
udpAppender = (wLogUdpAppender*)appender;
message->PrefixString = prefix;
WLog_Layout_GetMessagePrefix(log, appender->Layout, message);
_sendto(udpAppender->sock, message->PrefixString, (int)strnlen(message->PrefixString, INT_MAX),
0, &udpAppender->targetAddr, udpAppender->targetAddrLen);
_sendto(udpAppender->sock, message->TextString, (int)strnlen(message->TextString, INT_MAX), 0,
&udpAppender->targetAddr, udpAppender->targetAddrLen);
_sendto(udpAppender->sock, "\n", 1, 0, &udpAppender->targetAddr, udpAppender->targetAddrLen);
(void)_sendto(udpAppender->sock, message->PrefixString,
(int)strnlen(message->PrefixString, INT_MAX), 0, &udpAppender->targetAddr,
udpAppender->targetAddrLen);
(void)_sendto(udpAppender->sock, message->TextString,
(int)strnlen(message->TextString, INT_MAX), 0, &udpAppender->targetAddr,
udpAppender->targetAddrLen);
(void)_sendto(udpAppender->sock, "\n", 1, 0, &udpAppender->targetAddr,
udpAppender->targetAddrLen);
return TRUE;
}

View File

@ -1060,9 +1060,9 @@ int _ioctlsocket(SOCKET s, long cmd, u_long* argp)
return SOCKET_ERROR;
if (*argp)
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
(void)fcntl(fd, F_SETFL, flags | O_NONBLOCK);
else
fcntl(fd, F_SETFL, flags & ~(O_NONBLOCK));
(void)fcntl(fd, F_SETFL, flags & ~(O_NONBLOCK));
}
return 0;