diff mbox series

[FFmpeg-devel] avcodec/dvdsub: Fix warning about incompatible pointer type

Message ID 20200214112403.18370-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/dvdsub: Fix warning about incompatible pointer type | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 14, 2020, 11:24 a.m. UTC
Fixes "passing argument 2 of ‘strtoul’ from incompatible pointer
type [-Wincompatible-pointer-types]" ("expected ‘char ** restrict’ but
argument is of type ‘const char **’") for GCC and "passing 'const char
**' to parameter of type 'char **' discards qualifiers in nested pointer
types [-Wincompatible-pointer-types-discards-qualifiers]" for Clang.

The cast itself is safe; it is only needed because strtoul itself is not
const-correct.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/dvdsub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Feb. 14, 2020, 11:46 a.m. UTC | #1
LGTM

On 2/14/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> Fixes "passing argument 2 of ‘strtoul’ from incompatible pointer
> type [-Wincompatible-pointer-types]" ("expected ‘char ** restrict’ but
> argument is of type ‘const char **’") for GCC and "passing 'const char
> **' to parameter of type 'char **' discards qualifiers in nested pointer
> types [-Wincompatible-pointer-types-discards-qualifiers]" for Clang.
>
> The cast itself is safe; it is only needed because strtoul itself is not
> const-correct.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/dvdsub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/dvdsub.c b/libavcodec/dvdsub.c
> index a03ff27754..87215d2bd1 100644
> --- a/libavcodec/dvdsub.c
> +++ b/libavcodec/dvdsub.c
> @@ -26,7 +26,7 @@
>  void ff_dvdsub_parse_palette(uint32_t *palette, const char *p)
>  {
>      for (int i = 0; i < 16; i++) {
> -        palette[i] = strtoul(p, &p, 16);
> +        palette[i] = strtoul(p, (char **)&p, 16);
>          while (*p == ',' || av_isspace(*p))
>              p++;
>      }
> --
> 2.20.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
James Almer Feb. 14, 2020, 1:21 p.m. UTC | #2
On 2/14/2020 8:46 AM, Paul B Mahol wrote:
> LGTM
> 
> On 2/14/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
>> Fixes "passing argument 2 of ‘strtoul’ from incompatible pointer
>> type [-Wincompatible-pointer-types]" ("expected ‘char ** restrict’ but
>> argument is of type ‘const char **’") for GCC and "passing 'const char
>> **' to parameter of type 'char **' discards qualifiers in nested pointer
>> types [-Wincompatible-pointer-types-discards-qualifiers]" for Clang.
>>
>> The cast itself is safe; it is only needed because strtoul itself is not
>> const-correct.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>>  libavcodec/dvdsub.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/dvdsub.c b/libavcodec/dvdsub.c
>> index a03ff27754..87215d2bd1 100644
>> --- a/libavcodec/dvdsub.c
>> +++ b/libavcodec/dvdsub.c
>> @@ -26,7 +26,7 @@
>>  void ff_dvdsub_parse_palette(uint32_t *palette, const char *p)
>>  {
>>      for (int i = 0; i < 16; i++) {
>> -        palette[i] = strtoul(p, &p, 16);
>> +        palette[i] = strtoul(p, (char **)&p, 16);
>>          while (*p == ',' || av_isspace(*p))
>>              p++;
>>      }

Pushed.
diff mbox series

Patch

diff --git a/libavcodec/dvdsub.c b/libavcodec/dvdsub.c
index a03ff27754..87215d2bd1 100644
--- a/libavcodec/dvdsub.c
+++ b/libavcodec/dvdsub.c
@@ -26,7 +26,7 @@ 
 void ff_dvdsub_parse_palette(uint32_t *palette, const char *p)
 {
     for (int i = 0; i < 16; i++) {
-        palette[i] = strtoul(p, &p, 16);
+        palette[i] = strtoul(p, (char **)&p, 16);
         while (*p == ',' || av_isspace(*p))
             p++;
     }