From 515bea6fb444099a9354a2feee6ab975d5ce8471 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 15 Sep 2023 22:03:27 -0500 Subject: [PATCH] Fix GCC static analysis warnings --- src/ControlStream.c | 4 ++-- src/RtpVideoQueue.c | 4 ++-- src/RtspParser.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ControlStream.c b/src/ControlStream.c index db7cfb7b..c8e21b56 100644 --- a/src/ControlStream.c +++ b/src/ControlStream.c @@ -1233,7 +1233,7 @@ static void requestIdrFrame(void) { // Send the reference frame invalidation request and read the response if (!sendMessageAndDiscardReply(packetTypes[IDX_INVALIDATE_REF_FRAMES], - payloadLengths[IDX_INVALIDATE_REF_FRAMES], + sizeof(payload), payload, CTRL_CHANNEL_URGENT, ENET_PACKET_FLAG_RELIABLE, @@ -1272,7 +1272,7 @@ static void requestInvalidateReferenceFrames(int startFrame, int endFrame) { // Send the reference frame invalidation request and read the response if (!sendMessageAndDiscardReply(packetTypes[IDX_INVALIDATE_REF_FRAMES], - payloadLengths[IDX_INVALIDATE_REF_FRAMES], + sizeof(payload), payload, CTRL_CHANNEL_URGENT, ENET_PACKET_FLAG_RELIABLE, false)) { diff --git a/src/RtpVideoQueue.c b/src/RtpVideoQueue.c index 419070d6..6662d76a 100644 --- a/src/RtpVideoQueue.c +++ b/src/RtpVideoQueue.c @@ -459,7 +459,7 @@ static void stageCompleteFecBlock(PRTP_VIDEO_QUEUE queue) { unsigned int lowestRtpSequenceNumber = entry->packet->sequenceNumber; - while (entry != NULL) { + do { // We should never encounter a packet that's lower than our next seq num LC_ASSERT(!isBefore16(entry->packet->sequenceNumber, nextSeqNum)); @@ -499,7 +499,7 @@ static void stageCompleteFecBlock(PRTP_VIDEO_QUEUE queue) { } entry = entry->next; - } + } while (entry != NULL); if (entry == NULL) { // Start at the lowest we found last enumeration diff --git a/src/RtspParser.c b/src/RtspParser.c index 54f83273..208d8533 100644 --- a/src/RtspParser.c +++ b/src/RtspParser.c @@ -104,11 +104,11 @@ int parseRtspMessage(PRTSP_MESSAGE msg, char* rtspMessage, int length) { // Get the status code token = strtok_r(NULL, delim, &strtokCtx); - statusCode = atoi(token); if (token == NULL) { exitCode = RTSP_ERROR_MALFORMED; goto ExitFailure; } + statusCode = atoi(token); // Get the status string statusStr = strtok_r(NULL, end, &strtokCtx);