From 3bdef96abaf0f664dd737dc06d218576d22545e8 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 24 Jul 2025 02:34:39 +0200 Subject: [PATCH] servers: convert two macros to scoped static const strings Closes #18067 --- tests/server/rtspd.c | 10 +++++----- tests/server/sws.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index b6dd5ead1e..d046fdf420 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -716,19 +716,19 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req) default: case RCMD_NORMALREQ: break; /* continue with business as usual */ - case RCMD_STREAM: -#define STREAMTHIS "a string to stream 01234567890\n" - count = strlen(STREAMTHIS); + case RCMD_STREAM: { + static const char streamthis[] = "a string to stream 01234567890\n"; for(;;) { - written = swrite(sock, STREAMTHIS, count); + written = swrite(sock, streamthis, sizeof(streamthis)-1); if(got_exit_signal) return -1; - if(written != (ssize_t)count) { + if(written != (ssize_t)(sizeof(streamthis)-1)) { logmsg("Stopped streaming"); break; } } return -1; + } case RCMD_IDLE: /* Do nothing. Sit idle. Pretend it rains. */ return 0; diff --git a/tests/server/sws.c b/tests/server/sws.c index 4d43b38b1e..2ae4727ad6 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -959,19 +959,19 @@ static int sws_send_doc(curl_socket_t sock, struct sws_httprequest *req) default: case RCMD_NORMALREQ: break; /* continue with business as usual */ - case RCMD_STREAM: -#define STREAMTHIS "a string to stream 01234567890\n" - count = strlen(STREAMTHIS); + case RCMD_STREAM: { + static const char streamthis[] = "a string to stream 01234567890\n"; for(;;) { - written = swrite(sock, STREAMTHIS, count); + written = swrite(sock, streamthis, sizeof(streamthis)-1); if(got_exit_signal) return -1; - if(written != (ssize_t)count) { + if(written != (ssize_t)(sizeof(streamthis)-1)) { logmsg("Stopped streaming"); break; } } return -1; + } case RCMD_IDLE: /* Do nothing. Sit idle. Pretend it rains. */ return 0; -- 2.47.3