[vlc-commits] commit: Fix const warnings (Pierre Ynard )

git at videolan.org git at videolan.org
Sun Nov 14 10:23:51 CET 2010


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Nov 14 10:23:25 2010 +0100| [f3f203e5fd90f74850ffd0663e90e3f30cc05a29] | committer: Pierre Ynard 

Fix const warnings

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f3f203e5fd90f74850ffd0663e90e3f30cc05a29
---

 modules/access/rtp/xiph.c      |    2 +-
 modules/demux/avformat/demux.c |   10 +++++-----
 modules/demux/xiph.h           |    9 +++++----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/modules/access/rtp/xiph.c b/modules/access/rtp/xiph.c
index ecae060..fc54d80 100644
--- a/modules/access/rtp/xiph.c
+++ b/modules/access/rtp/xiph.c
@@ -115,7 +115,7 @@ static ssize_t vorbis_header (void **pextra, const uint8_t *buf, size_t len)
     unsigned sizes[3] = {
         idlen, cmtlen, setuplen
     };
-    void *payloads[3] = {
+    const void *payloads[3] = {
         buf + 0,
         buf + idlen,
         buf + cmtlen
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index b195d27..69d8108 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -392,14 +392,14 @@ int OpenDemux( vlc_object_t *p_this )
             if( cc->codec_id == CODEC_ID_THEORA && b_ogg )
             {
                 unsigned pi_size[3];
-                void     *pp_data[3];
+                const void *pp_data[3];
                 unsigned i_count;
                 for( i_count = 0; i_count < 3; i_count++ )
                 {
                     if( i_extra < 2 )
                         break;
                     pi_size[i_count] = GetWBE( p_extra );
-                    pp_data[i_count] = (uint8_t*)&p_extra[2];
+                    pp_data[i_count] = &p_extra[2];
                     if( i_extra < pi_size[i_count] + 2 )
                         break;
 
@@ -415,15 +415,15 @@ int OpenDemux( vlc_object_t *p_this )
             }
             else if( cc->codec_id == CODEC_ID_SPEEX && b_ogg )
             {
-                uint8_t p_dummy_comment[] = {
+                const uint8_t p_dummy_comment[] = {
                     0, 0, 0, 0,
                     0, 0, 0, 0,
                 };
                 unsigned pi_size[2];
-                void     *pp_data[2];
+                const void *pp_data[2];
 
                 pi_size[0] = i_extra;
-                pp_data[0] = (uint8_t*)p_extra;
+                pp_data[0] = p_extra;
 
                 pi_size[1] = sizeof(p_dummy_comment);
                 pp_data[1] = p_dummy_comment;
diff --git a/modules/demux/xiph.h b/modules/demux/xiph.h
index dc1df97..24e4ca9 100644
--- a/modules/demux/xiph.h
+++ b/modules/demux/xiph.h
@@ -69,7 +69,7 @@ static inline int xiph_SplitHeaders(unsigned packet_size[], void *packet[], unsi
 }
 
 static inline int xiph_PackHeaders(int *extra_size, void **extra,
-                                   unsigned packet_size[], void *packet[], unsigned packet_count )
+                                   unsigned packet_size[], const void *packet[], unsigned packet_count )
 {
     if (packet_count <= 0 || packet_count > XIPH_MAX_HEADER_COUNT)
         return VLC_EGENERIC;
@@ -117,7 +117,7 @@ static inline int xiph_PackHeaders(int *extra_size, void **extra,
 }
 
 static inline int xiph_AppendHeaders(int *extra_size, void **extra,
-                                     unsigned size, const void *data)
+                                     unsigned size, void *data)
 {
     unsigned packet_size[XIPH_MAX_HEADER_COUNT];
     void *packet[XIPH_MAX_HEADER_COUNT];
@@ -134,8 +134,9 @@ static inline int xiph_AppendHeaders(int *extra_size, void **extra,
     free(*extra);
 
     packet_size[count] = size;
-    packet[count]      = (void*)data;
-    if (xiph_PackHeaders(extra_size, extra, packet_size, packet, count + 1)) {
+    packet[count]      = data;
+    if (xiph_PackHeaders(extra_size, extra, packet_size,
+                         (const void **)packet, count + 1)) {
         *extra_size = 0;
         *extra      = NULL;
     }



More information about the vlc-commits mailing list