Fix Clang warnings

This commit is contained in:
Cameron Gutman 2020-12-05 23:20:02 -06:00
parent ac6630ef59
commit 3fddfc5557
6 changed files with 11 additions and 13 deletions

View File

@ -499,7 +499,7 @@ static int reed_solomon_decode(reed_solomon* rs, unsigned char **data_blocks, in
unsigned char* subShards[DATA_SHARDS_MAX];
unsigned char* outputs[DATA_SHARDS_MAX];
gf* m = rs->m;
int i, j, c, swap, subMatrixRow, dataShards, nos, nshards;
int i, j, c, swap, subMatrixRow, dataShards;
/* the erased_blocks should always sorted
* if sorted, nr_fec_blocks times to check it
@ -523,11 +523,9 @@ static int reed_solomon_decode(reed_solomon* rs, unsigned char **data_blocks, in
j = 0;
subMatrixRow = 0;
nos = 0;
nshards = 0;
dataShards = rs->data_shards;
for (i = 0; i < dataShards; i++) {
if (j < nr_fec_blocks && i == erased_blocks[j])
if (j < nr_fec_blocks && i == (int)erased_blocks[j])
j++;
else {
/* this row is ok */

View File

@ -169,7 +169,7 @@ static void ReceiveThreadProc(void* context) {
continue;
}
if (packet->size < sizeof(RTP_PACKET)) {
if (packet->size < (int)sizeof(RTP_PACKET)) {
// Runt packet
continue;
}

View File

@ -187,7 +187,7 @@ static void inputSendThreadProc(void* context) {
SOCK_RET err;
PPACKET_HOLDER holder;
char encryptedBuffer[MAX_INPUT_PACKET_SIZE];
int encryptedSize;
uint32_t encryptedSize;
while (!PltIsThreadInterrupted(&inputSendThread)) {
int encryptedLengthPrefix;
@ -323,7 +323,7 @@ static void inputSendThreadProc(void* context) {
// Encrypt the message into the output buffer while leaving room for the length
encryptedSize = sizeof(encryptedBuffer) - 4;
err = encryptData((const unsigned char*)&holder->packet, holder->packetLength,
(unsigned char*)&encryptedBuffer[4], &encryptedSize);
(unsigned char*)&encryptedBuffer[4], (int*)&encryptedSize);
free(holder);
if (err != 0) {
Limelog("Input: Encryption failed: %d\n", (int)err);
@ -332,7 +332,7 @@ static void inputSendThreadProc(void* context) {
}
// Prepend the length to the message
encryptedLengthPrefix = htonl((uint32_t)encryptedSize);
encryptedLengthPrefix = htonl(encryptedSize);
memcpy(&encryptedBuffer[0], &encryptedLengthPrefix, 4);
if (AppVersionQuad[0] < 5) {

View File

@ -27,7 +27,7 @@ typedef struct _RTP_FEC_QUEUE {
int fecPercentage;
int nextContiguousSequenceNumber;
int currentFrameNumber;
unsigned int currentFrameNumber;
} RTP_FEC_QUEUE, *PRTP_FEC_QUEUE;
#define RTPF_RET_QUEUED 0

View File

@ -16,7 +16,7 @@ typedef struct _RTP_QUEUE_ENTRY {
typedef struct _RTP_REORDER_QUEUE {
int maxSize;
int maxQueueTimeMs;
uint32_t maxQueueTimeMs;
PRTP_QUEUE_ENTRY queueHead;
PRTP_QUEUE_ENTRY queueTail;

View File

@ -123,7 +123,7 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
Limelog("Failed to read STUN binding response: %d\n", err);
goto Exit;
}
else if (bytesRead < sizeof(resp.hdr)) {
else if (bytesRead < (int)sizeof(resp.hdr)) {
Limelog("STUN message truncated: %d\n", bytesRead);
err = -3;
goto Exit;
@ -146,8 +146,8 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
attribute = (PSTUN_ATTRIBUTE_HEADER)(&resp.hdr + 1);
bytesRead -= sizeof(resp.hdr);
while (bytesRead > sizeof(*attribute)) {
if (bytesRead < sizeof(*attribute) + htons(attribute->length)) {
while (bytesRead > (int)sizeof(*attribute)) {
if (bytesRead < (int)(sizeof(*attribute) + htons(attribute->length))) {
Limelog("STUN attribute out of bounds: %d\n", htons(attribute->length));
err = -5;
goto Exit;