Message ID | 20210917145259.3564-1-jamrial@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] avutil/buffer: constify some function parameters | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
James Almer: > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavutil/buffer.c | 6 +++--- > libavutil/buffer.h | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/libavutil/buffer.c b/libavutil/buffer.c > index b13eeadffb..a32b7deb89 100644 > --- a/libavutil/buffer.c > +++ b/libavutil/buffer.c > @@ -90,7 +90,7 @@ AVBufferRef *av_buffer_allocz(size_t size) > return ret; > } > > -AVBufferRef *av_buffer_ref(AVBufferRef *buf) > +AVBufferRef *av_buffer_ref(const AVBufferRef *buf) > { > AVBufferRef *ret = av_mallocz(sizeof(*ret)); > > @@ -216,7 +216,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, size_t size) > return 0; > } > > -int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src) > +int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src) > { > AVBufferRef *dst = *pdst; > AVBufferRef *tmp; > @@ -395,7 +395,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) > return ret; > } > > -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref) > +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref) > { > BufferPoolEntry *buf = ref->buffer->opaque; > av_assert0(buf); > diff --git a/libavutil/buffer.h b/libavutil/buffer.h > index 2c0ce1a108..e1ef5b7f07 100644 > --- a/libavutil/buffer.h > +++ b/libavutil/buffer.h > @@ -145,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); > * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on > * failure. > */ > -AVBufferRef *av_buffer_ref(AVBufferRef *buf); > +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); > > /** > * Free a given reference and automatically free the buffer if there are no more > @@ -212,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); > * @return 0 on success > * AVERROR(ENOMEM) on memory allocation failure. > */ > -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); > +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); > > /** > * @} > @@ -313,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); > * therefore you have to use this function to access the original opaque > * parameter of an allocated buffer. > */ > -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); > +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); > > /** > * @} > LGTM. (Presuming that adding const to the outermost pointed-to-type is not considered an API break.) - Andreas
On 9/17/2021 12:13 PM, Andreas Rheinhardt wrote: > James Almer: >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavutil/buffer.c | 6 +++--- >> libavutil/buffer.h | 6 +++--- >> 2 files changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c >> index b13eeadffb..a32b7deb89 100644 >> --- a/libavutil/buffer.c >> +++ b/libavutil/buffer.c >> @@ -90,7 +90,7 @@ AVBufferRef *av_buffer_allocz(size_t size) >> return ret; >> } >> >> -AVBufferRef *av_buffer_ref(AVBufferRef *buf) >> +AVBufferRef *av_buffer_ref(const AVBufferRef *buf) >> { >> AVBufferRef *ret = av_mallocz(sizeof(*ret)); >> >> @@ -216,7 +216,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, size_t size) >> return 0; >> } >> >> -int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src) >> +int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src) >> { >> AVBufferRef *dst = *pdst; >> AVBufferRef *tmp; >> @@ -395,7 +395,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) >> return ret; >> } >> >> -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref) >> +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref) >> { >> BufferPoolEntry *buf = ref->buffer->opaque; >> av_assert0(buf); >> diff --git a/libavutil/buffer.h b/libavutil/buffer.h >> index 2c0ce1a108..e1ef5b7f07 100644 >> --- a/libavutil/buffer.h >> +++ b/libavutil/buffer.h >> @@ -145,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); >> * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on >> * failure. >> */ >> -AVBufferRef *av_buffer_ref(AVBufferRef *buf); >> +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); >> >> /** >> * Free a given reference and automatically free the buffer if there are no more >> @@ -212,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); >> * @return 0 on success >> * AVERROR(ENOMEM) on memory allocation failure. >> */ >> -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); >> +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); >> >> /** >> * @} >> @@ -313,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); >> * therefore you have to use this function to access the original opaque >> * parameter of an allocated buffer. >> */ >> -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); >> +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); >> >> /** >> * @} >> > > LGTM. (Presuming that adding const to the outermost pointed-to-type is > not considered an API break.) Applied, thanks.
diff --git a/libavutil/buffer.c b/libavutil/buffer.c index b13eeadffb..a32b7deb89 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -90,7 +90,7 @@ AVBufferRef *av_buffer_allocz(size_t size) return ret; } -AVBufferRef *av_buffer_ref(AVBufferRef *buf) +AVBufferRef *av_buffer_ref(const AVBufferRef *buf) { AVBufferRef *ret = av_mallocz(sizeof(*ret)); @@ -216,7 +216,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, size_t size) return 0; } -int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src) +int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src) { AVBufferRef *dst = *pdst; AVBufferRef *tmp; @@ -395,7 +395,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) return ret; } -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref) +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref) { BufferPoolEntry *buf = ref->buffer->opaque; av_assert0(buf); diff --git a/libavutil/buffer.h b/libavutil/buffer.h index 2c0ce1a108..e1ef5b7f07 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -145,7 +145,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data); * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on * failure. */ -AVBufferRef *av_buffer_ref(AVBufferRef *buf); +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); /** * Free a given reference and automatically free the buffer if there are no more @@ -212,7 +212,7 @@ int av_buffer_realloc(AVBufferRef **buf, size_t size); * @return 0 on success * AVERROR(ENOMEM) on memory allocation failure. */ -int av_buffer_replace(AVBufferRef **dst, AVBufferRef *src); +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); /** * @} @@ -313,7 +313,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); * therefore you have to use this function to access the original opaque * parameter of an allocated buffer. */ -void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref); +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); /** * @}
Signed-off-by: James Almer <jamrial@gmail.com> --- libavutil/buffer.c | 6 +++--- libavutil/buffer.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)