From e87ce9d7b5bb96956130b1bf16e6579ba8e9a50e Mon Sep 17 00:00:00 2001 From: phil <me@filou.se> Date: Mon, 19 Apr 2021 17:55:31 +0200 Subject: [PATCH] precompiler guard + renaming --- src/include/aes67/utils/rtsp-dsc.h | 8 ++++---- src/utils/rtsp-dsc.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/include/aes67/utils/rtsp-dsc.h b/src/include/aes67/utils/rtsp-dsc.h index 26a3dcf..9460748 100644 --- a/src/include/aes67/utils/rtsp-dsc.h +++ b/src/include/aes67/utils/rtsp-dsc.h @@ -37,9 +37,9 @@ extern "C" { #endif - -#define AES67_RTSP_BUFSIZE 1500 - +#ifndef AES67_RTSP_DSC_BUFSIZE +#define AES67_RTSP_DSC_BUFSIZE 1500 +#endif enum aes67_rtsp_dsc_state { aes67_rtsp_dsc_state_bored, @@ -54,7 +54,7 @@ struct aes67_rtsp_dsc_res_st { bool blocking; int sockfd; - u8_t buf[AES67_RTSP_BUFSIZE]; + u8_t buf[AES67_RTSP_DSC_BUFSIZE]; u16_t buflen; u8_t * line; diff --git a/src/utils/rtsp-dsc.c b/src/utils/rtsp-dsc.c index ecac35d..08ba746 100644 --- a/src/utils/rtsp-dsc.c +++ b/src/utils/rtsp-dsc.c @@ -110,16 +110,16 @@ int aes67_rtsp_dsc_start( } } - size_t len = aes67_strncpy((char*)res->buf, "DESCRIBE rtsp://", AES67_RTSP_BUFSIZE); + size_t len = aes67_strncpy((char*)res->buf, "DESCRIBE rtsp://", AES67_RTSP_DSC_BUFSIZE); len += aes67_net_ip2str(&res->buf[len], (enum aes67_net_ipver)ipver, (u8_t*)ip, (u16_t)port); - len += aes67_strncpy((char*)&res->buf[len], encoded_uri, AES67_RTSP_BUFSIZE - len); + len += aes67_strncpy((char*)&res->buf[len], encoded_uri, AES67_RTSP_DSC_BUFSIZE - len); len += aes67_strncpy((char*)&res->buf[len], " RTSP/1.0\r\n" "CSeq: 1\r\n" "Accept: application/sdp\r\n" - "\r\n", AES67_RTSP_BUFSIZE - len); + "\r\n", AES67_RTSP_DSC_BUFSIZE - len); res->buflen = len; @@ -242,7 +242,7 @@ void aes67_rtsp_dsc_process(struct aes67_rtsp_dsc_res_st * res) // read complete header if (res->hdrlen == 0){ - while( res->buflen < AES67_RTSP_BUFSIZE ){ + while(res->buflen < AES67_RTSP_DSC_BUFSIZE ){ r = read(res->sockfd, &c, 1); @@ -317,7 +317,7 @@ void aes67_rtsp_dsc_process(struct aes67_rtsp_dsc_res_st * res) } } // fail if using too much memory - if (res->buflen >= AES67_RTSP_BUFSIZE){ + if (res->buflen >= AES67_RTSP_DSC_BUFSIZE){ close(res->sockfd); res->sockfd = -1; res->contentlen = 0; @@ -337,7 +337,7 @@ void aes67_rtsp_dsc_process(struct aes67_rtsp_dsc_res_st * res) } // sanity check - if (res->hdrlen + res->contentlen > AES67_RTSP_BUFSIZE){ + if (res->hdrlen + res->contentlen > AES67_RTSP_DSC_BUFSIZE){ printf("too small buffer to receive complete content!\n"); close(res->sockfd); // mark as no content; -- GitLab