changeset 36779:f5320e43d458

Simplify code. Use a variable and cast once.
author ib
date Mon, 17 Feb 2014 14:33:03 +0000
parents 1045c5762718
children a5550a57a6cb
files gui/interface.c gui/win32/interface.c
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Mon Feb 17 13:57:24 2014 +0000
+++ b/gui/interface.c	Mon Feb 17 14:33:03 2014 +0000
@@ -319,7 +319,7 @@
 #ifdef CONFIG_DVDREAD
     dvd_priv_t *dvd;
 #endif
-    int msg, state;
+    int idata = (intptr_t)data, msg, state;
     stream_t *stream = NULL;
     sh_audio_t *sh_audio;
     mixer_t *mixer;
@@ -333,12 +333,12 @@
 
     case GUI_SET_STATE:
 
-        switch ((intptr_t)data) {
+        switch (idata) {
         case GUI_STOP:
         case GUI_PLAY:
 // if ( !gtkShowVideoWindow ) wsWindowVisibility( &guiApp.videoWindow,wsHideWindow );
         case GUI_PAUSE:
-            guiInfo.Playing = (intptr_t)data;
+            guiInfo.Playing = idata;
             break;
         }
 
@@ -360,9 +360,9 @@
 
     case GUI_RUN_COMMAND:
 
-        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_COMMAND: %d\n", (int)(intptr_t)data);
+        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_COMMAND: %d\n", idata);
 
-        switch ((intptr_t)data) {
+        switch (idata) {
         case MP_CMD_VO_FULLSCREEN:
             uiEvent(evFullScreen, True);
             break;
--- a/gui/win32/interface.c	Mon Feb 17 13:57:24 2014 +0000
+++ b/gui/win32/interface.c	Mon Feb 17 14:33:03 2014 +0000
@@ -556,6 +556,7 @@
 /* this function gets called by mplayer to update the gui */
 int gui(int what, void *data)
 {
+    int idata = (intptr_t) data;
     stream_t *stream = data;
 #ifdef CONFIG_DVDREAD
     dvd_priv_t *dvdp;
@@ -686,7 +687,7 @@
             break;
         case GUI_SET_STATE:
         {
-            guiInfo.Playing = (intptr_t) data;
+            guiInfo.Playing = idata;
             switch (guiInfo.Playing)
             {
                 case GUI_PLAY:
@@ -710,9 +711,9 @@
         }
         case GUI_RUN_COMMAND:
         {
-            mp_msg(MSGT_GPLAYER,MSGL_V, "cmd: %d\n", (int)(intptr_t) data);
+            mp_msg(MSGT_GPLAYER,MSGL_V, "cmd: %d\n", idata);
             /* MPlayer asks us to quit */
-            switch((intptr_t) data)
+            switch(idata)
             {
                 case MP_CMD_VO_FULLSCREEN:
                     uiFullScreen();