[vlc-commits] es_format: memset() the whole structure

Rémi Denis-Courmont git at videolan.org
Mon May 22 19:52:11 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 22 20:51:56 2017 +0300| [1fd77f6c0d1e964fd5c0e75c5aa9d51dbc4cb089] | committer: Rémi Denis-Courmont

es_format: memset() the whole structure

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

 src/misc/es_format.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/misc/es_format.c b/src/misc/es_format.c
index 80b4c914ab..a436599058 100644
--- a/src/misc/es_format.c
+++ b/src/misc/es_format.c
@@ -435,38 +435,21 @@ void video_format_Print( vlc_object_t *p_this,
 void es_format_Init( es_format_t *fmt,
                      int i_cat, vlc_fourcc_t i_codec )
 {
+    memset(fmt, 0, sizeof (*fmt));
     fmt->i_cat                  = i_cat;
     fmt->i_codec                = i_codec;
-    fmt->i_original_fourcc      = 0;
     fmt->i_profile              = -1;
     fmt->i_level                = -1;
     fmt->i_id                   = -1;
-    fmt->i_group                = 0;
     fmt->i_priority             = ES_PRIORITY_SELECTABLE_MIN;
     fmt->psz_language           = NULL;
     fmt->psz_description        = NULL;
-
-    fmt->i_extra_languages      = 0;
     fmt->p_extra_languages      = NULL;
 
-    switch (fmt->i_cat)
-    {
-        case AUDIO_ES:
-            memset(&fmt->audio, 0, sizeof (fmt->audio));
-            memset(&fmt->audio_replay_gain, 0,
-                   sizeof (fmt->audio_replay_gain));
-            break;
-        case VIDEO_ES:
-            video_format_Init(&fmt->video, 0);
-            break;
-        case SPU_ES:
-            memset(&fmt->subs, 0, sizeof (fmt->subs));
-            break;
-    }
+    if (fmt->i_cat == VIDEO_ES)
+        video_format_Init(&fmt->video, 0);
 
     fmt->b_packetized           = true;
-    fmt->i_bitrate              = 0;
-    fmt->i_extra                = 0;
     fmt->p_extra                = NULL;
 }
 



More information about the vlc-commits mailing list