diff mbox series

[FFmpeg-devel] avdevice/alldevices: constify some function parameters

Message ID 20220103123719.1166-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avdevice/alldevices: constify some function parameters | expand

Checks

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 fail Make fate failed

Commit Message

James Almer Jan. 3, 2022, 12:37 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavdevice/alldevices.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt Jan. 3, 2022, 2 p.m. UTC | #1
James Almer:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavdevice/alldevices.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
> index fbbe187a51..3db489b83c 100644
> --- a/libavdevice/alldevices.c
> +++ b/libavdevice/alldevices.c
> @@ -68,7 +68,7 @@ void avdevice_register_all(void)
>      avpriv_register_devices(outdev_list, indev_list);
>  }
>  
> -static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
> +static const void *next_input(const AVInputFormat *prev, const AVClassCategory c2)
>  {
>      const AVClass *pc;
>      const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT;
> @@ -94,7 +94,7 @@ static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
>      return fmt;
>  }
>  
> -static const void *next_output(const AVOutputFormat *prev, AVClassCategory c2)
> +static const void *next_output(const AVOutputFormat *prev, const AVClassCategory c2)
>  {
>      const AVClass *pc;
>      const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_OUTPUT;
> 

AVClassCategory is an ordinary arithmetic type, not a pointer type; due
to call-by-value you can't change the caller's value at all. We
typically don't constify such parameters and doing so is highly unusual.
That being said, I am not against changing this policy.

- Andreas
diff mbox series

Patch

diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index fbbe187a51..3db489b83c 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -68,7 +68,7 @@  void avdevice_register_all(void)
     avpriv_register_devices(outdev_list, indev_list);
 }
 
-static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
+static const void *next_input(const AVInputFormat *prev, const AVClassCategory c2)
 {
     const AVClass *pc;
     const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT;
@@ -94,7 +94,7 @@  static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
     return fmt;
 }
 
-static const void *next_output(const AVOutputFormat *prev, AVClassCategory c2)
+static const void *next_output(const AVOutputFormat *prev, const AVClassCategory c2)
 {
     const AVClass *pc;
     const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_OUTPUT;