diff mbox

[FFmpeg-devel] compat/strtod: Add missing const qualifiers

Message ID 201705011051.56803.cehoyos@ag.or.at
State Accepted
Commit 3624d45ddbe93d93bd9f808b525b0f91c3d7a8cf
Headers show

Commit Message

Carl Eugen Hoyos May 1, 2017, 8:51 a.m. UTC
Hi!

Even without the casts, the patch reduces the number of warnings shown when 
compiling compat/strtod from seven to three.

Please comment, Carl Eugen
From f376877bfabb6fba8f83acab7bd7fb76388d88fd Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Mon, 1 May 2017 10:49:31 +0200
Subject: [PATCH] compat/strtod: Add missing const qualifiers.

Fixes many warnings:
initialization discards 'const' qualifier from pointer target type
---
 compat/strtod.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Aaron Levinson May 2, 2017, 8:29 p.m. UTC | #1
On 5/1/2017 1:51 AM, Carl Eugen Hoyos wrote:
> Hi!
>
> Even without the casts, the patch reduces the number of warnings shown when
> compiling compat/strtod from seven to three.
>
> Please comment, Carl Eugen

LGTM

Aaron Levinson
Carl Eugen Hoyos May 4, 2017, 9:25 p.m. UTC | #2
2017-05-02 22:29 GMT+02:00 Aaron Levinson <alevinsn@aracnet.com>:
> On 5/1/2017 1:51 AM, Carl Eugen Hoyos wrote:
>>
>> Hi!
>>
>> Even without the casts, the patch reduces the number of warnings shown
>> when compiling compat/strtod from seven to three.
>>
>> Please comment, Carl Eugen
>
> LGTM

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/compat/strtod.c b/compat/strtod.c
index 3a9452e..8b4243b 100644
--- a/compat/strtod.c
+++ b/compat/strtod.c
@@ -25,9 +25,9 @@ 
 #include "libavutil/avstring.h"
 #include "libavutil/mathematics.h"
 
-static char *check_nan_suffix(char *s)
+static const char *check_nan_suffix(const char *s)
 {
-    char *start = s;
+    const char *start = s;
 
     if (*s++ != '(')
         return start;
@@ -44,7 +44,7 @@  double strtod(const char *, char **);
 
 double avpriv_strtod(const char *nptr, char **endptr)
 {
-    char *end;
+    const char *end;
     double res;
 
     /* Skip leading spaces */
@@ -81,13 +81,13 @@  double avpriv_strtod(const char *nptr, char **endptr)
                !av_strncasecmp(nptr, "+0x", 3)) {
         /* FIXME this doesn't handle exponents, non-integers (float/double)
          * and numbers too large for long long */
-        res = strtoll(nptr, &end, 16);
+        res = strtoll(nptr, (char **)&end, 16);
     } else {
-        res = strtod(nptr, &end);
+        res = strtod(nptr, (char **)&end);
     }
 
     if (endptr)
-        *endptr = end;
+        *endptr = (char *)end;
 
     return res;
 }