diff mbox

[FFmpeg-devel] lavu/spherical: Make first parameter const

Message ID 201703162123.39814.cehoyos@ag.or.at
State Accepted
Commit 1cd58e915436ea84eb861327f3897ef54058ee42
Headers show

Commit Message

Carl Eugen Hoyos March 16, 2017, 8:23 p.m. UTC
Hi!

Attached patch silences a gcc warning when compiling ffprobe.

Please comment, Carl Eugen
From 5040ee6f7dd43c8d66a241aa0376839916cd3d9f Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Thu, 16 Mar 2017 21:19:48 +0100
Subject: [PATCH] lavu/spherical: Make AVSphericalMapping pointer parameter
 const.

Reflects the actual code and silences a gcc warning:
ffprobe.c:1797:42: warning: passing argument 1 of 'av_spherical_tile_bounds' discards 'const' qualifier from pointer target type
---
 libavutil/spherical.c |    2 +-
 libavutil/spherical.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

James Almer March 16, 2017, 8:26 p.m. UTC | #1
On 3/16/2017 5:23 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch silences a gcc warning when compiling ffprobe.
> 
> Please comment, Carl Eugen
> 
> 
> 0001-lavu-spherical-Make-AVSphericalMapping-pointer-param.patch
> 
> 
> From 5040ee6f7dd43c8d66a241aa0376839916cd3d9f Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> Date: Thu, 16 Mar 2017 21:19:48 +0100
> Subject: [PATCH] lavu/spherical: Make AVSphericalMapping pointer parameter
>  const.
> 
> Reflects the actual code and silences a gcc warning:
> ffprobe.c:1797:42: warning: passing argument 1 of 'av_spherical_tile_bounds' discards 'const' qualifier from pointer target type
> ---
>  libavutil/spherical.c |    2 +-
>  libavutil/spherical.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavutil/spherical.c b/libavutil/spherical.c
> index 0ca2dd3..f0b6221 100644
> --- a/libavutil/spherical.c
> +++ b/libavutil/spherical.c
> @@ -33,7 +33,7 @@ AVSphericalMapping *av_spherical_alloc(size_t *size)
>      return spherical;
>  }
>  
> -void av_spherical_tile_bounds(AVSphericalMapping *map,
> +void av_spherical_tile_bounds(const AVSphericalMapping *map,
>                                size_t width, size_t height,
>                                size_t *left, size_t *top,
>                                size_t *right, size_t *bottom)
> diff --git a/libavutil/spherical.h b/libavutil/spherical.h
> index db9bdc0..f4e0d60 100644
> --- a/libavutil/spherical.h
> +++ b/libavutil/spherical.h
> @@ -202,7 +202,7 @@ AVSphericalMapping *av_spherical_alloc(size_t *size);
>   * @param right  Pixels from the right edge.
>   * @param bottom Pixels from the bottom edge.
>   */
> -void av_spherical_tile_bounds(AVSphericalMapping *map,
> +void av_spherical_tile_bounds(const AVSphericalMapping *map,
>                                size_t width, size_t height,
>                                size_t *left, size_t *top,
>                                size_t *right, size_t *bottom);
> -- 1.7.10.4
> 

LGTM. The AVSphericalMapping struct is not modified by the function
so it should have been const since the beginning.
Vittorio Giovara March 16, 2017, 9:10 p.m. UTC | #2
On Thu, Mar 16, 2017 at 4:26 PM, James Almer <jamrial@gmail.com> wrote:
> On 3/16/2017 5:23 PM, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch silences a gcc warning when compiling ffprobe.
>>
>> Please comment, Carl Eugen
>>
>>
>> 0001-lavu-spherical-Make-AVSphericalMapping-pointer-param.patch
>>
>>
>> From 5040ee6f7dd43c8d66a241aa0376839916cd3d9f Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
>> Date: Thu, 16 Mar 2017 21:19:48 +0100
>> Subject: [PATCH] lavu/spherical: Make AVSphericalMapping pointer parameter
>>  const.
>>
>> Reflects the actual code and silences a gcc warning:
>> ffprobe.c:1797:42: warning: passing argument 1 of 'av_spherical_tile_bounds' discards 'const' qualifier from pointer target type
>> ---
>>  libavutil/spherical.c |    2 +-
>>  libavutil/spherical.h |    2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavutil/spherical.c b/libavutil/spherical.c
>> index 0ca2dd3..f0b6221 100644
>> --- a/libavutil/spherical.c
>> +++ b/libavutil/spherical.c
>> @@ -33,7 +33,7 @@ AVSphericalMapping *av_spherical_alloc(size_t *size)
>>      return spherical;
>>  }
>>
>> -void av_spherical_tile_bounds(AVSphericalMapping *map,
>> +void av_spherical_tile_bounds(const AVSphericalMapping *map,
>>                                size_t width, size_t height,
>>                                size_t *left, size_t *top,
>>                                size_t *right, size_t *bottom)
>> diff --git a/libavutil/spherical.h b/libavutil/spherical.h
>> index db9bdc0..f4e0d60 100644
>> --- a/libavutil/spherical.h
>> +++ b/libavutil/spherical.h
>> @@ -202,7 +202,7 @@ AVSphericalMapping *av_spherical_alloc(size_t *size);
>>   * @param right  Pixels from the right edge.
>>   * @param bottom Pixels from the bottom edge.
>>   */
>> -void av_spherical_tile_bounds(AVSphericalMapping *map,
>> +void av_spherical_tile_bounds(const AVSphericalMapping *map,
>>                                size_t width, size_t height,
>>                                size_t *left, size_t *top,
>>                                size_t *right, size_t *bottom);
>> -- 1.7.10.4
>>
>
> LGTM. The AVSphericalMapping struct is not modified by the function
> so it should have been const since the beginning.
>

lgtm too
Carl Eugen Hoyos March 16, 2017, 9:20 p.m. UTC | #3
2017-03-16 21:23 GMT+01:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:
> Hi!
>
> Attached patch silences a gcc warning when compiling ffprobe.

Patch applied.

Thank you both, Carl Eugen
diff mbox

Patch

diff --git a/libavutil/spherical.c b/libavutil/spherical.c
index 0ca2dd3..f0b6221 100644
--- a/libavutil/spherical.c
+++ b/libavutil/spherical.c
@@ -33,7 +33,7 @@  AVSphericalMapping *av_spherical_alloc(size_t *size)
     return spherical;
 }
 
-void av_spherical_tile_bounds(AVSphericalMapping *map,
+void av_spherical_tile_bounds(const AVSphericalMapping *map,
                               size_t width, size_t height,
                               size_t *left, size_t *top,
                               size_t *right, size_t *bottom)
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index db9bdc0..f4e0d60 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -202,7 +202,7 @@  AVSphericalMapping *av_spherical_alloc(size_t *size);
  * @param right  Pixels from the right edge.
  * @param bottom Pixels from the bottom edge.
  */
-void av_spherical_tile_bounds(AVSphericalMapping *map,
+void av_spherical_tile_bounds(const AVSphericalMapping *map,
                               size_t width, size_t height,
                               size_t *left, size_t *top,
                               size_t *right, size_t *bottom);