[FFmpeg-devel] [PATCH v2 07/13] avpriv_find_start_code(): constify pointer parameters
Scott Theisen
scott.the.elm at gmail.com
Thu Feb 3 20:44:44 EET 2022
Have the compiler enforce not changing the addresses these parameters point to.
No functional change.
---
libavcodec/internal.h | 6 +++---
libavcodec/utils.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 94c41aef0b..dadd8d4a10 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -313,7 +313,7 @@ static av_always_inline int avpriv_start_code_is_valid(uint32_t start_code) {
* @param[in] end A pointer to the past-the-end memory address for the buffer
* given by @p p. <b>@p p</b> must be ≤ <b>@p end</b>.
*
- * @param[in,out] start_code A reference to a mutable @c uint32_t.<br>
+ * @param[in,out] start_code A constant pointer (reference) to a mutable @c uint32_t.<br>
* As input: For no history preset to <b>@c ~0 </b>, otherwise preset to the last
* returned start code to enable detecting start codes across
* buffer boundaries.<br>
@@ -325,8 +325,8 @@ static av_always_inline int avpriv_start_code_is_valid(uint32_t start_code) {
* if no start code was found.
*/
const uint8_t *avpriv_find_start_code(const uint8_t *p,
- const uint8_t *end,
- uint32_t *start_code);
+ const uint8_t * const end,
+ uint32_t * const start_code);
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 80ccde023f..cf92d29f67 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -941,8 +941,8 @@ void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, in
#endif
const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
- const uint8_t *end,
- uint32_t *av_restrict start_code)
+ const uint8_t * const end,
+ uint32_t * const av_restrict start_code)
{
av_assert0(p <= end);
if (p >= end)
--
2.32.0
More information about the ffmpeg-devel
mailing list