[vlc-commits] va: make the description pointer const

Rémi Denis-Courmont git at videolan.org
Sat Mar 22 19:46:22 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 22 20:45:34 2014 +0200| [313038e3e412af0d2741cb18f027855c307a5cf5] | committer: Rémi Denis-Courmont

va: make the description pointer const

4 out of 5 plugins expect it that way and the owner should not modify
the string anyway.

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

 modules/codec/avcodec/dxva2.c   |    2 +-
 modules/codec/avcodec/hwdummy.c |    2 +-
 modules/codec/avcodec/va.h      |    2 +-
 modules/codec/avcodec/vaapi.c   |    2 +-
 modules/codec/avcodec/vda.c     |    2 +-
 modules/hw/vdpau/avcodec.c      |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 49a98e2..8b6dc5f 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -478,7 +478,7 @@ static void Close(vlc_va_t *va)
     if (sys->hd3d9_dll)
         FreeLibrary(sys->hd3d9_dll);
 
-    free(va->description);
+    free((char *)va->description);
     free(sys);
 }
 
diff --git a/modules/codec/avcodec/hwdummy.c b/modules/codec/avcodec/hwdummy.c
index 112087d..9db27d2 100644
--- a/modules/codec/avcodec/hwdummy.c
+++ b/modules/codec/avcodec/hwdummy.c
@@ -124,7 +124,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const es_format_t *fmt)
     hwctx->render = Render;
 
     va->sys = (vlc_va_sys_t *)hwctx;
-    va->description = (char *)"Dummy video decoding accelerator";
+    va->description = "Dummy video decoding accelerator";
     va->pix_fmt = AV_PIX_FMT_VDPAU;
     va->setup = Setup;
     va->get = Lock;
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 27bfa48..4a376cb 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -32,7 +32,7 @@ struct vlc_va_t {
 
     vlc_va_sys_t *sys;
     module_t *module;
-    char *description;
+    const char *description;
     int pix_fmt;
 
     int  (*setup)(vlc_va_t *, void **hw, vlc_fourcc_t *output,
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 1190aef..3b7ccc0 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -239,7 +239,7 @@ static int Open( vlc_va_t *va, int i_codec_id, int i_thread_count )
     vlc_mutex_init(&sys->lock);
 
     va->sys = sys;
-    va->description = (char *)vaQueryVendorString( sys->p_display );
+    va->description = vaQueryVendorString( sys->p_display );
     return VLC_SUCCESS;
 
 error:
diff --git a/modules/codec/avcodec/vda.c b/modules/codec/avcodec/vda.c
index 85a94c5..c8e0c5f 100644
--- a/modules/codec/avcodec/vda.c
+++ b/modules/codec/avcodec/vda.c
@@ -115,7 +115,7 @@ static int Open( vlc_va_t *external, AVCodecContext *ctx,
     p_va->i_extradata = fmt->i_extra;
 
     external->sys = p_va;
-    external->description = (char *)"VDA";
+    external->description = "VDA";
     external->pix_fmt = PIX_FMT_VDA_VLD;
     external->setup = Setup;
     external->get = Get;
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 0b21f0f..fa7964e 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -278,7 +278,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const es_format_t *fmt)
         infos = "VDPAU";
 
     va->sys = sys;
-    va->description = (char *)infos;
+    va->description = infos;
     va->pix_fmt = AV_PIX_FMT_VDPAU;
     va->setup = Setup;
     va->get = Lock;



More information about the vlc-commits mailing list