[vlc-devel] commit: RC: fix segmentation fault due to input state changes - fixes #1620 ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri Jun 20 21:19:26 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Fri Jun 20 22:21:24 2008 +0300| [f8763a6ca1881728dbc5025acfe3103536036ab7]

RC: fix segmentation fault due to input state changes - fixes #1620

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

 include/vlc_input.h  |    4 +++-
 modules/control/rc.c |   16 ++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7e155f7..13f19d6 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -525,6 +525,8 @@ static inline void vlc_input_attachment_Delete( input_attachment_t *a )
  *****************************************************************************/
 
 /* "state" value */
+/* NOTE: you need to update ppsz_input_state in the RC interface
+ * if you modify this list. */
 enum input_state_e
 {
     INIT_S = 0,
@@ -536,7 +538,7 @@ enum input_state_e
     FORWARD_S,
     BACKWARD_S,
     END_S,
-    ERROR_S
+    ERROR_S,
 };
 
 /* "rate" default, min/max
diff --git a/modules/control/rc.c b/modules/control/rc.c
index 25a3d71..5de88df 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -67,7 +67,19 @@
 #define MAX_LINE_LENGTH 256
 #define STATUS_CHANGE "status change: "
 
-static const char *ppsz_input_state[] = { N_("Initializing"), N_("Opening"), N_("Buffer"), N_("Play"), N_("Pause"), N_("Stop"), N_("Error") };
+/* input_state_e from <vlc_input.h> */
+static const char *ppsz_input_state[] = {
+    N_("Initializing"),
+    N_("Opening"),
+    N_("Buffer"),
+    N_("Play"),
+    N_("Pause"),
+    N_("Stop"),
+    N_("Forward"),
+    N_("Backward"),
+    N_("End"),
+    N_("Error"),
+};
 
 /*****************************************************************************
  * Local prototypes
@@ -1000,7 +1012,7 @@ static int StateChanged( vlc_object_t *p_this, char const *psz_cmd,
             cmd[0] = '\0';
         } /* var_GetInteger( p_input, "state" )  */
         msg_rc( STATUS_CHANGE "( %s state: %d ): %s",
-                              &cmd[0], newval.i_int,
+                              cmd, newval.i_int,
                               ppsz_input_state[ newval.i_int ] );
         vlc_object_release( p_playlist );
         vlc_object_release( p_input );




More information about the vlc-devel mailing list