changeset 19718:e701a6eed5cb

ISO C90 warnings fixes
author vayne
date Wed, 06 Sep 2006 17:44:41 +0000
parents 0fb41010767d
children f34290cc5f69
files Gui/win32/dialogs.c Gui/win32/gui.c Gui/win32/interface.c Gui/win32/widgetrender.c
diffstat 4 files changed, 29 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/win32/dialogs.c	Wed Sep 06 17:40:55 2006 +0000
+++ b/Gui/win32/dialogs.c	Wed Sep 06 17:44:41 2006 +0000
@@ -374,11 +374,12 @@
 
 void display_openurlwindow(gui_t *gui, int add)
 {
-    if(add) addurl = 1;
     HWND hWnd;
     HINSTANCE hInstance = GetModuleHandle(NULL);
     WNDCLASS wc;
     int x, y;
+
+    if(add) addurl = 1;
     if(FindWindow(NULL, "MPlayer - Open URL...")) return;
     wc.style         = CS_HREDRAW | CS_VREDRAW;
     wc.lpfnWndProc   = OpenUrlWndProc;
@@ -632,16 +633,16 @@
 void display_playlistwindow(gui_t *gui)
 {
     HWND hWnd = FindWindow(NULL, "MPlayer Playlist");
+    HINSTANCE hInstance = GetModuleHandle(NULL);
+    WNDCLASS wc;
+    int x, y;
+
     if (hWnd)
     {
         SendMessage(hWnd, WM_CLOSE, 0, 0);
         return;
     }
 
-    HINSTANCE hInstance = GetModuleHandle(NULL);
-    WNDCLASS wc;
-    int x, y;
-
     wc.style         = CS_HREDRAW | CS_VREDRAW;
     wc.lpfnWndProc   = PlayListWndProc;
     wc.cbClsExtra    = 0;
@@ -683,6 +684,9 @@
     {
         case WM_CREATE:
         {
+            HANDLE skinHandle = INVALID_HANDLE_VALUE;
+            WIN32_FIND_DATA finddata;
+
             listbox = CreateWindow("listbox", NULL,
                                    WS_CHILD | WS_VISIBLE | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT |
                                    LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP,
@@ -695,9 +699,6 @@
             /* This opens the skins directory, lists the directory names, and adds them to the listbox */
             sprintf(skinspath, "%s/*.", get_path("skins"));
 
-            HANDLE skinHandle = INVALID_HANDLE_VALUE;
-            WIN32_FIND_DATA finddata;
-
             skinHandle = FindFirstFile(skinspath, &finddata);
             if (skinHandle != INVALID_HANDLE_VALUE)
             {
@@ -753,16 +754,16 @@
 void display_skinbrowser(gui_t* gui)
 {
     HWND hWnd = FindWindow(NULL, "Skin Browser");
+    HINSTANCE hInstance = GetModuleHandle(NULL);
+    WNDCLASS wc;
+    int x, y;
+
     if (hWnd)
     {
         SendMessage(hWnd, WM_CLOSE, 0, 0);
         return;
     }
 
-    HINSTANCE hInstance = GetModuleHandle(NULL);
-    WNDCLASS wc;
-    int x, y;
-
     wc.style         = CS_HREDRAW | CS_VREDRAW;
     wc.lpfnWndProc   = SkinBrowserWndProc;
     wc.cbClsExtra    = 0;
@@ -1106,12 +1107,12 @@
 
 void display_eqwindow(gui_t *gui)
 {
-    if(!guiIntfStruct.sh_video) return;
-
     HWND hWnd;
     HINSTANCE hInstance = GetModuleHandle(NULL);
     WNDCLASS wc;
     int x, y;
+
+    if(!guiIntfStruct.sh_video) return;
     if(FindWindow(NULL, "MPlayer - Equalizer")) return;
     wc.style         = CS_HREDRAW | CS_VREDRAW;
     wc.lpfnWndProc   = EqWndProc;
--- a/Gui/win32/gui.c	Wed Sep 06 17:40:55 2006 +0000
+++ b/Gui/win32/gui.c	Wed Sep 06 17:44:41 2006 +0000
@@ -269,10 +269,11 @@
 /* updates sliders and the display */
 static void updatedisplay(gui_t *gui, HWND hwnd)
 {
-    if(!hwnd) return;
-
     unsigned int i;
     window_priv_t *priv = NULL;
+    DWORD time = timeGetTime();
+
+    if(!hwnd) return;
 
     /* load all potmeters hpotmeters */
     for(i=0; i<gui->skin->widgetcount; i++)
@@ -308,7 +309,6 @@
     }
 
     /* updating the display once a 100.second is enough imo */
-    DWORD time = timeGetTime();
     if((time - oldtime) < 100) return;
     oldtime=time;
 
@@ -410,9 +410,10 @@
                 {
                     static char path[MAX_PATH];
                     BROWSEINFO bi;
+                    LPITEMIDLIST pidl;
                     memset(&bi, 0, sizeof(BROWSEINFO));
                     bi.lpszTitle = "Choose a Directory...";
-                    LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
+                    pidl = SHBrowseForFolder(&bi);
                     if (SHGetPathFromIDList(pidl, path))
                     {
                         gui->playlist->clear_playlist(gui->playlist);
@@ -536,9 +537,9 @@
         }
         case WM_MOUSEWHEEL:
         {
+            int x = GET_WHEEL_DELTA_WPARAM(wParam);
             if(vo_nomouse_input)
                 break;
-            int x = GET_WHEEL_DELTA_WPARAM(wParam);
             if (x > 0)
                 mplayer_put_key(MOUSE_BTN3);
             else
@@ -920,9 +921,10 @@
                 {
                     static char path[MAX_PATH];
                     BROWSEINFO bi;
+                    LPITEMIDLIST pidl;
                     memset(&bi, 0, sizeof(BROWSEINFO));
                     bi.lpszTitle = "Choose a Directory...";
-                    LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
+                    pidl = SHBrowseForFolder(&bi);
                     if (SHGetPathFromIDList(pidl, path))
                     {
                         gui->playlist->clear_playlist(gui->playlist);
@@ -1421,6 +1423,7 @@
     window *desc = NULL;
     char dir[MAX_PATH];
     unsigned int i;
+    int x = -1, y = -1;
 
     /* destroy the current main window */
     if(gui->skin) destroy_window(gui);
@@ -1457,7 +1460,6 @@
     /* load the icon from the executable */
     GetModuleFileName(NULL, dir, MAX_PATH);
     gui->icon = ExtractIcon(instance, dir, 0);
-    int x = -1, y = -1;
 
     /* create the window class */
     wc.style = CS_HREDRAW | CS_VREDRAW;
@@ -1539,8 +1541,9 @@
 gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event))
 {
     gui_t *gui = calloc(1, sizeof(gui_t));
+    char temp[MAX_PATH];
+    HWND runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
 
-    HWND runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
     if(runningmplayer)
     {
         free(gui);
@@ -1556,7 +1559,6 @@
     gui->playlist = create_playlist();
 
     if(!skinName) skinName = strdup("Blue");
-    char temp[MAX_PATH];
     sprintf(temp, "%s\\%s", skindir, skinName);
     if(create_window(gui, temp)) return NULL;
     if(create_subwindow(gui, temp)) return NULL;
--- a/Gui/win32/interface.c	Wed Sep 06 17:40:55 2006 +0000
+++ b/Gui/win32/interface.c	Wed Sep 06 17:44:41 2006 +0000
@@ -550,12 +550,11 @@
 /* this function gets called by mplayer to update the gui */
 int guiGetEvent(int type, char *arg)
 {
-    if(!mygui || !mygui->skin) return 0;
-
     stream_t *stream = (stream_t *) arg;
 #ifdef USE_DVDREAD
     dvd_priv_t *dvdp = (dvd_priv_t *) arg;
 #endif
+    if(!mygui || !mygui->skin) return 0;
 
     switch (type)
     {
--- a/Gui/win32/widgetrender.c	Wed Sep 06 17:40:55 2006 +0000
+++ b/Gui/win32/widgetrender.c	Wed Sep 06 17:44:41 2006 +0000
@@ -306,10 +306,11 @@
 
 void renderwidget(skin_t *skin, image *dest, widget *item, int state)
 {
-    if(!dest) return;
     image *img = NULL;
     int height;
     int y;
+
+    if(!dest) return;
     if((item->type == tyButton) || (item->type == tyHpotmeter) || (item->type == tyPotmeter))
         img = item->bitmap[0];