changeset 36762:e788bcd9d49b

Avoid many pointer cast warnings. Fixes most occurrences of "cast from pointer to integer of different size" and "cast to pointer from integer of different size" warnings.
author reimar
date Sun, 16 Feb 2014 15:44:36 +0000
parents 726678f7ce60
children 7ac80299454d
files gui/dialog/equalizer.c gui/dialog/menu.c gui/dialog/playlist.c gui/dialog/preferences.c gui/dialog/skinbrowser.c gui/interface.c gui/ui/actions.c libmpdemux/demux_mpg.c libvo/vo_svga.c libvo/vo_xv.c mplayer.c
diffstat 11 files changed, 41 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/equalizer.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/gui/dialog/equalizer.c	Sun Feb 16 15:44:36 2014 +0000
@@ -133,7 +133,7 @@
  (void) widget;
  (void) event;
 
- switch ( (int)user_data )
+ switch ( (intptr_t)user_data )
   {
    case 0: eq.gain=A3125adj->value; break;
    case 1: eq.gain=A6250adj->value; break;
@@ -148,7 +148,7 @@
    default: return FALSE;
   }
  eq.gain=-eq.gain;
- eq.band=(int)user_data;
+ eq.band=(intptr_t)user_data;
  if ( Channel == -1 )
   {
    int i;
@@ -164,7 +164,7 @@
  (void) widget;
  (void) event;
 
- switch( (int)user_data )
+ switch( (intptr_t)user_data )
   {
    case 1: mplayer( MPLAYER_SET_CONTRAST,VContrastadj->value,0 );      break;
    case 2: mplayer( MPLAYER_SET_BRIGHTNESS,VBrightnessadj->value,0 );  break;
@@ -179,7 +179,7 @@
 {
  (void) button;
 
- switch( (int)user_data )
+ switch( (intptr_t)user_data )
   {
    case 0:
         gtk_widget_destroy( Equalizer );
@@ -565,7 +565,7 @@
 {
  (void) button;
 
- if ( (int)user_data )
+ if ( (intptr_t)user_data )
  { // if you pressed Ok
   nfree( gtkEquChannel1 ); gtkEquChannel1=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel1 ) ) );
   nfree( gtkEquChannel2 ); gtkEquChannel2=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel2 ) ) );
--- a/gui/dialog/menu.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/gui/dialog/menu.c	Sun Feb 16 15:44:36 2014 +0000
@@ -137,7 +137,7 @@
 
  gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state);
  gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
-   GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
+   GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)(intptr_t)Number );
  gtk_menu_item_right_justify (GTK_MENU_ITEM (Item));
  gtk_widget_show_all(Item);
 
@@ -168,7 +168,7 @@
 
  gtk_menu_append( GTK_MENU( SubMenu ),Item );
  gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
-   GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
+   GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)(intptr_t)Number );
 
  gtk_menu_item_right_justify (GTK_MENU_ITEM (Item));
  gtk_widget_show_all(Item);
--- a/gui/dialog/playlist.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/gui/dialog/playlist.c	Sun Feb 16 15:44:36 2014 +0000
@@ -97,7 +97,7 @@
  (void) column;
  (void) event;
 
- switch ( (int) user_data )
+ switch ( (intptr_t) user_data )
   {
    case 0: CLFileSelected[row]=True; break;
    case 1: CLListSelected[row]=True; break;
@@ -110,7 +110,7 @@
  (void) column;
  (void) event;
 
- switch ( (int) user_data )
+ switch ( (intptr_t) user_data )
   {
    case 0: CLFileSelected[row]=False; break;
    case 1: CLListSelected[row]=False; break;
@@ -121,7 +121,7 @@
 {
  (void) button;
 
- switch ( (int) user_data )
+ switch ( (intptr_t) user_data )
  {
   case 1: // ok
        {
@@ -158,7 +158,7 @@
 	    if ( old )
 	     {
 	      listMgr( PLAYLIST_ITEM_SET_CURR,old );
-	      guiInfo.Track = (int) listMgr( PLAYLIST_ITEM_GET_POS,old );
+	      guiInfo.Track = (intptr_t) listMgr( PLAYLIST_ITEM_GET_POS,old );
 	      item = NULL;
 	     }
 	   }
@@ -171,7 +171,7 @@
 	   }
 	 }
 	else if (isPlaylistStreamtype && !guiInfo.Playing) uiUnsetFile();
-	guiInfo.Tracks = (int) listMgr( PLAYLIST_ITEM_GET_POS,0 );
+	guiInfo.Tracks = (intptr_t) listMgr( PLAYLIST_ITEM_GET_POS,0 );
 	free(curr.path);
 	free(curr.name);
        }
@@ -254,7 +254,7 @@
    if ( GTK_WIDGET_TYPE( widget ) == GTK_TYPE_BUTTON ) plButtonReleased( NULL, user_data );
    else
     {
-     switch ( (int) user_data )
+     switch ( (intptr_t) user_data )
       {
        case 0:
             plButtonReleased( NULL, (void *) 3 );
@@ -281,7 +281,7 @@
   {
     if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) )
     {
-      switch ( (int) user_data )
+      switch ( (intptr_t) user_data )
       {
         case 0:
           CLFileSelected[row] = True;
--- a/gui/dialog/preferences.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/gui/dialog/preferences.c	Sun Feb 16 15:44:36 2014 +0000
@@ -226,7 +226,7 @@
 
  (void) editable;
 
- switch( (int)user_data )
+ switch( (intptr_t)user_data )
   {
 #ifdef CONFIG_FREETYPE
    case 0: // font encoding
@@ -281,7 +281,7 @@
 
  (void) button;
 
- switch ( (int)user_data )
+ switch ( (intptr_t)user_data )
   {
    case bOk:
 	/* 1st page */
@@ -433,7 +433,7 @@
  (void) widget;
  (void) event;
 
- switch ( (int)user_data )
+ switch ( (intptr_t)user_data )
   {
    case 0: // extra stereo coefficient
 	if ( !guiInfo.Playing ) break;
@@ -482,7 +482,7 @@
 
  (void) togglebutton;
 
- switch ( (int)user_data )
+ switch ( (intptr_t)user_data )
   {
    case 0: // extra stereo coefficient
 	if ( guiInfo.Playing )
@@ -505,7 +505,7 @@
    case 5:
    case 6:
    case 7:
-	mplayer( MPLAYER_SET_FONT_AUTOSCALE,(int)user_data - 4,0 );
+	mplayer( MPLAYER_SET_FONT_AUTOSCALE,(intptr_t)user_data - 4,0 );
 	break;
    case 8:
 	if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) gtk_widget_set_sensitive( SBCache,TRUE );
@@ -540,7 +540,7 @@
  (void) column;
  (void) event;
 
- switch ( (int)user_data )
+ switch ( (intptr_t)user_data )
   {
    case 0: // audio driver
 	gtk_clist_get_text( GTK_CLIST( CLADrivers ),row,0,(char **)&ao_driver );
@@ -1598,7 +1598,7 @@
 
   (void) button;
 
-  switch( (int)user_data ) {
+  switch( (intptr_t)user_data ) {
     case 1:
 #ifdef CONFIG_OSS_AUDIO
       if (strncmp(ao_driver[0], "oss", 3) == 0) {
@@ -1814,7 +1814,7 @@
 {
  (void) button;
 
- switch ( (int)user_data )
+ switch ( (intptr_t)user_data )
  {
   case 0: // Ok
        nfree( gtkDXR3Device ); gtkDXR3Device=strdup( gtk_entry_get_text( GTK_ENTRY( CEDXR3Device ) ) );
--- a/gui/dialog/skinbrowser.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/gui/dialog/skinbrowser.c	Sun Feb 16 15:44:36 2014 +0000
@@ -51,7 +51,7 @@
 
  if ( sbSelectedSkin )
  {
-  switch ( (int)user_data )
+  switch ( (intptr_t)user_data )
    {
     case 0: // cancel
 	if ( strcmp( sbSelectedSkin,gtkOldSkin ) ) uiChangeSkin( gtkOldSkin );
--- a/gui/interface.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/gui/interface.c	Sun Feb 16 15:44:36 2014 +0000
@@ -209,7 +209,7 @@
 
     if (playlist && !filename) {
         uiSetFile(playlist->path, playlist->name, STREAMTYPE_FILE);
-        guiInfo.Tracks = (int)listMgr(PLAYLIST_ITEM_GET_POS, 0);
+        guiInfo.Tracks = (intptr_t)listMgr(PLAYLIST_ITEM_GET_POS, 0);
         guiInfo.Track  = 1;
         filename       = NULL; // don't start playing
     }
@@ -332,12 +332,12 @@
 
     case GUI_SET_STATE:
 
-        switch ((int)data) {
+        switch ((intptr_t)data) {
         case GUI_STOP:
         case GUI_PLAY:
 // if ( !gtkShowVideoWindow ) wsWindowVisibility( &guiApp.videoWindow,wsHideWindow );
         case GUI_PAUSE:
-            guiInfo.Playing = (int)data;
+            guiInfo.Playing = (intptr_t)data;
             break;
         }
 
@@ -359,9 +359,9 @@
 
     case GUI_RUN_COMMAND:
 
-        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_COMMAND: %d\n", (int)data);
+        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_COMMAND: %d\n", (int)(intptr_t)data);
 
-        switch ((int)data) {
+        switch ((intptr_t)data) {
         case MP_CMD_VO_FULLSCREEN:
             uiEvent(evFullScreen, True);
             break;
@@ -619,7 +619,7 @@
         switch (guiInfo.StreamType) {
         case STREAMTYPE_FILE:
         case STREAMTYPE_STREAM:
-            guiInfo.Tracks = (int)listMgr(PLAYLIST_ITEM_GET_POS, 0);
+            guiInfo.Tracks = (intptr_t)listMgr(PLAYLIST_ITEM_GET_POS, 0);
             break;
 
         case STREAMTYPE_CDDA:
@@ -812,7 +812,7 @@
         if (next) {
             uiSetFile(next->path, next->name, STREAMTYPE_FILE);
             guiInfo.NewPlay = GUI_FILE_NEW;
-            guiInfo.Track   = (int)listMgr(PLAYLIST_ITEM_GET_POS, next);
+            guiInfo.Track   = (intptr_t)listMgr(PLAYLIST_ITEM_GET_POS, next);
         } else {
             if (guiInfo.NewPlay == GUI_FILE_NEW)
                 break;
--- a/gui/ui/actions.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/gui/ui/actions.c	Sun Feb 16 15:44:36 2014 +0000
@@ -745,7 +745,7 @@
         if (curr) {
             uiSetFile(curr->path, curr->name, STREAMTYPE_FILE);
             guiInfo.PlaylistNext = False;
-            guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, curr);
+            guiInfo.Track = (intptr_t)listMgr(PLAYLIST_ITEM_GET_POS, curr);
             break;
         }
 
@@ -815,7 +815,7 @@
         if (prev) {
             uiSetFile(prev->path, prev->name, STREAMTYPE_FILE);
             guiInfo.PlaylistNext = !guiInfo.Playing;
-            guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, prev);
+            guiInfo.Track = (intptr_t)listMgr(PLAYLIST_ITEM_GET_POS, prev);
             break;
         }
 
@@ -883,7 +883,7 @@
         if (next) {
             uiSetFile(next->path, next->name, STREAMTYPE_FILE);
             guiInfo.PlaylistNext = !guiInfo.Playing;
-            guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, next);
+            guiInfo.Track = (intptr_t)listMgr(PLAYLIST_ITEM_GET_POS, next);
             break;
         }
 
--- a/libmpdemux/demux_mpg.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/libmpdemux/demux_mpg.c	Sun Feb 16 15:44:36 2014 +0000
@@ -800,7 +800,7 @@
     return 0;
   }
   {
-    register uint32_t state = (uint32_t)demux->priv;
+    register uint32_t state = (uintptr_t)demux->priv;
     register int pos = -len;
     unsigned char *buf = &pack->buffer[len];
     do {
@@ -808,7 +808,7 @@
       if (unlikely((state | 3) == 0x1bf))
         pos = find_end(&buf, pos, demux->stream);
     } while (++pos < 0);
-    demux->priv = (void *)state;
+    demux->priv = (void *)(uintptr_t)state;
     len = buf - pack->buffer;
   }
   if (len < STREAM_BUFFER_SIZE)
--- a/libvo/vo_svga.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/libvo/vo_svga.c	Sun Feb 16 15:44:36 2014 +0000
@@ -243,7 +243,7 @@
 
     if(mpi->flags & MP_IMGFLAG_DIRECT){
         mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: drawing direct rendered surface\n");
-        cpage=(uint32_t)mpi->priv;
+        cpage=(uintptr_t)mpi->priv;
         assert((cpage>=0)&&(cpage<max_pages));
         return VO_TRUE; //it's already done
     }
@@ -703,7 +703,7 @@
             mpi->stride[0] = mode_stride;
             mpi->planes[0] = PageStore[page].vbase +
                              y_pos*mode_stride + (x_pos*mpi->bpp)/8;
-            mpi->priv=(void *)page;
+            mpi->priv=(void *)(uintptr_t)page;
             mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: direct render allocated! page=%d\n",page);
             return VO_TRUE;
         }
--- a/libvo/vo_xv.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/libvo/vo_xv.c	Sun Feb 16 15:44:36 2014 +0000
@@ -423,7 +423,7 @@
     if (mpi->flags & MP_IMGFLAG_DIRECT)
     {
         // direct rendering:
-        current_buf = (int) (mpi->priv);        // hack!
+        current_buf = (intptr_t)mpi->priv;        // hack!
         return VO_TRUE;
     }
     if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
@@ -508,7 +508,7 @@
             }
         }
         mpi->flags |= MP_IMGFLAG_DIRECT;
-        mpi->priv = (void *) current_buf;
+        mpi->priv = (void *)(intptr_t)current_buf;
 //      printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n");
         return VO_TRUE;
     }
--- a/mplayer.c	Sun Feb 16 15:44:34 2014 +0000
+++ b/mplayer.c	Sun Feb 16 15:44:36 2014 +0000
@@ -3061,7 +3061,7 @@
     if (use_gui) {
         guiInit();
         gui(GUI_SET_CONTEXT, mpctx);
-        gui(GUI_SET_STATE, (void *)(filename ? GUI_PLAY : GUI_STOP));
+        gui(GUI_SET_STATE, (void *)(intptr_t)(filename ? GUI_PLAY : GUI_STOP));
     }
 #endif
 
@@ -3103,7 +3103,7 @@
                 if (cmd->id == MP_CMD_GUI)
                     gui(GUI_RUN_MESSAGE, cmd->args[0].v.s);
                 else
-                    gui(GUI_RUN_COMMAND, (void *)cmd->id);
+                    gui(GUI_RUN_COMMAND, (void *)(intptr_t)cmd->id);
                 mp_cmd_free(cmd);
             }
         }