rtsp: avoid const warnings from strtol() call
authorMans Rullgard <mans@mansr.com>
Wed, 25 Apr 2012 22:37:29 +0000 (23:37 +0100)
committerMans Rullgard <mans@mansr.com>
Sun, 6 May 2012 11:04:25 +0000 (12:04 +0100)
The strtol() interface makes it difficult to use with
const-qualified pointers.  With this change, although
the const is still lost, the compiler does not warn
about it.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavformat/rtsp.c

index 9ee7a75..2ad2c4d 100644 (file)
@@ -637,16 +637,17 @@ static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
 #if CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER
 static void rtsp_parse_range(int *min_ptr, int *max_ptr, const char **pp)
 {
-    const char *p;
+    const char *q;
+    char *p;
     int v;
 
-    p = *pp;
-    p += strspn(p, SPACE_CHARS);
-    v = strtol(p, (char **)&p, 10);
+    q = *pp;
+    q += strspn(q, SPACE_CHARS);
+    v = strtol(q, &p, 10);
     if (*p == '-') {
         p++;
         *min_ptr = v;
-        v = strtol(p, (char **)&p, 10);
+        v = strtol(p, &p, 10);
         *max_ptr = v;
     } else {
         *min_ptr = v;