From 7b3f315a5d8b90dcb0db5512ed91fa700027cb7a Mon Sep 17 00:00:00 2001
From: marha <marha@users.sourceforge.net>
Date: Tue, 30 Oct 2012 08:08:23 +0100
Subject: fontconfig xserver mesa git update 30 oct 2012

fontconfig: bdaef0b80dc27f4ab7a9d9bcedcfd8b5724b3cfd
xserver: 1ca096d5e07221025c4c4110528772b7d94f15ee
mesa: 0a66ced8f822b0d5478b0cd6d72c1a6ad70647a2
---
 xorg-server/hw/xfree86/common/xf86str.h    |   2 +-
 xorg-server/hw/xwin/InitOutput.c           |  23 +-
 xorg-server/hw/xwin/Makefile.am            |   1 -
 xorg-server/hw/xwin/glx/gen_gl_wrappers.py |  10 +-
 xorg-server/hw/xwin/glx/glwrap.c           |   2 +-
 xorg-server/hw/xwin/glx/indirect.c         |  12 +-
 xorg-server/hw/xwin/win.h                  |  18 +-
 xorg-server/hw/xwin/winallpriv.c           |   2 +-
 xorg-server/hw/xwin/winclipboard.h         |   3 +-
 xorg-server/hw/xwin/winclipboardtextconv.c |  10 +-
 xorg-server/hw/xwin/winclipboardthread.c   |   5 +-
 xorg-server/hw/xwin/winclipboardwrappers.c |   9 -
 xorg-server/hw/xwin/wincursor.c            |   3 +-
 xorg-server/hw/xwin/winerror.c             |   4 -
 xorg-server/hw/xwin/wingc.c                |   5 -
 xorg-server/hw/xwin/winlayouts.h           |  10 +-
 xorg-server/hw/xwin/winmonitors.c          |   8 +-
 xorg-server/hw/xwin/winmsg.c               |   4 +-
 xorg-server/hw/xwin/winmsg.h               |  30 +-
 xorg-server/hw/xwin/winmultiwindowwm.c     |   8 -
 xorg-server/hw/xwin/winprefs.c             |  21 +-
 xorg-server/hw/xwin/winprefslex.l          |   7 +-
 xorg-server/hw/xwin/winprefsyacc.y         | 914 ++++++++++++++---------------
 xorg-server/hw/xwin/winprocarg.c           |   4 -
 xorg-server/hw/xwin/winregistry.c          |  65 --
 xorg-server/hw/xwin/winscrinit.c           |   6 +-
 xorg-server/hw/xwin/winvalargs.c           |   2 -
 xorg-server/hw/xwin/winwindow.c            |   6 -
 xorg-server/hw/xwin/winwindowswm.c         |   5 +-
 29 files changed, 545 insertions(+), 654 deletions(-)
 delete mode 100644 xorg-server/hw/xwin/winregistry.c

(limited to 'xorg-server/hw')

diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h
index 059026243..4c2d147a2 100644
--- a/xorg-server/hw/xfree86/common/xf86str.h
+++ b/xorg-server/hw/xfree86/common/xf86str.h
@@ -347,7 +347,7 @@ typedef struct _DriverRec {
  */
 
 /* Tolerate prior #include <linux/input.h> */
-#if defined(linux) && defined(_INPUT_H)
+#if defined(linux)
 #undef BUS_NONE
 #undef BUS_PCI
 #undef BUS_SBUS
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index 1cf0f02eb..4bcd3a006 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -77,11 +77,6 @@ static void
  winClipboardShutdown(void);
 #endif
 
-#if defined(DDXOSVERRORF)
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
 static Bool
  winCheckDisplayNumber(void);
 
@@ -299,11 +294,11 @@ winCheckMount(void)
     }
 
     while ((ent = getmntent(mnt)) != NULL) {
-        BOOL system = (winCheckMntOpt(ent, "user") != NULL);
+        BOOL sys = (winCheckMntOpt(ent, "user") != NULL);
         BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
         BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
 
-        if (system) {
+        if (sys) {
             if (root)
                 curlevel = sys_root;
             else if (tmp)
@@ -897,7 +892,7 @@ ddxUseMsg(void)
  */
 
 void
-InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
 {
     int i;
 
@@ -940,15 +935,15 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
     LoadPreferences();
 
     /* Setup global screen info parameters */
-    screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
-    screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
-    screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
-    screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
-    screenInfo->numPixmapFormats = NUMFORMATS;
+    pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+    pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+    pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+    pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+    pScreenInfo->numPixmapFormats = NUMFORMATS;
 
     /* Describe how we want common pixmap formats padded */
     for (i = 0; i < NUMFORMATS; i++) {
-        screenInfo->formats[i] = g_PixmapFormats[i];
+        pScreenInfo->formats[i] = g_PixmapFormats[i];
     }
 
     /* Load pointers to DirectDraw functions */
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index 33729a906..99dc55631 100644
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -95,7 +95,6 @@ SRCS =	InitInput.c \
 	winprefsyacc.y \
 	winprefslex.l \
 	winprocarg.c \
-	winregistry.c \
 	winscrinit.c \
 	winshaddd.c \
 	winshadddnl.c \
diff --git a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
index 15f7ef868..2273589c9 100644
--- a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
+++ b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
@@ -146,9 +146,8 @@ for line in glspec :
                         arglist_use = m1.group(2)
                         wrappers[function] = {}
 
-                        # near and far might be reserved words or macros so can't be used as formal parameter names
-                        arglist_use = arglist_use.replace('near','zNear')
-                        arglist_use = arglist_use.replace('far','zFar')
+                        # ensure formal parameter names don't collide with reserved names or shadow global declarations
+                        arglist_use = ',' .join([i.rstrip() + '_' for i in arglist_use.split(",")])
 
                         wrappers[function]['arglist_use'] = arglist_use
                         param_count = 0
@@ -217,9 +216,8 @@ for w in sorted(wrappers.keys()) :
                 if k.startswith('param') :
                         l = wrappers[w][k].split()
 
-                        # near and far might be reserved words or macros so can't be used as formal parameter names
-                        l[0] = l[0].replace('near','zNear')
-                        l[0] = l[0].replace('far','zFar')
+                        # ensure formal parameter names don't collide with reserved names or shadow global declarations
+                        l[0] = l[0] + '_'
 
                         if l[2] == 'in' :
                                 if l[3] == 'array' :
diff --git a/xorg-server/hw/xwin/glx/glwrap.c b/xorg-server/hw/xwin/glx/glwrap.c
index 690b82926..73cff3cc1 100644
--- a/xorg-server/hw/xwin/glx/glwrap.c
+++ b/xorg-server/hw/xwin/glx/glwrap.c
@@ -67,7 +67,7 @@ glWinCallDelta(void)
 }
 
 static PROC
-glWinResolveHelper(PROC * cache, char *symbol)
+glWinResolveHelper(PROC * cache, const char *symbol)
 {
     PROC proc = NULL;
 
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index 97b6045b7..c0069a20f 100644
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -1626,15 +1626,15 @@ glxWinCreateContext(__GLXscreen * screen,
  */
 
 static int
-GetShift(int Mask)
+GetShift(int mask)
 {
-    int Shift = 0;
+    int shift = 0;
 
-    while ((Mask &1) == 0) {
-        Shift++;
-        Mask >>=1;
+    while ((mask &1) == 0) {
+        shift++;
+        mask >>=1;
     }
-    return Shift;
+    return shift;
 }
 
 static int
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 08d0d3f92..7b34e84d9 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -857,11 +857,13 @@ void
 
 #ifdef DDXOSVERRORF
 void
- OSVenderVErrorF(const char *pszFormat, va_list va_args);
+OsVendorVErrorF(const char *pszFormat, va_list va_args)
+_X_ATTRIBUTE_PRINTF(1, 0);
 #endif
 
 void
- winMessageBoxF(const char *pszError, UINT uType, ...);
+winMessageBoxF(const char *pszError, UINT uType, ...)
+_X_ATTRIBUTE_PRINTF(1, 3);
 
 #ifdef XWIN_NATIVEGDI
 /*
@@ -1052,18 +1054,6 @@ void
 winPolyLineNativeGDI(DrawablePtr pDrawable,
                      GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
 #endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpushpxl.c
- */
-
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
-              int dx, int dy, int xOrg, int yOrg);
-#endif
-
 /*
  * winscrinit.c
  */
diff --git a/xorg-server/hw/xwin/winallpriv.c b/xorg-server/hw/xwin/winallpriv.c
index ea3126fa0..cc3b3d1ba 100644
--- a/xorg-server/hw/xwin/winallpriv.c
+++ b/xorg-server/hw/xwin/winallpriv.c
@@ -110,7 +110,7 @@ winAllocatePrivates(ScreenPtr pScreen)
  */
 
 Bool
-winInitCmapPrivates(ColormapPtr pcmap, int index)
+winInitCmapPrivates(ColormapPtr pcmap, int i)
 {
 #if CYGDEBUG
     winDebug("winInitCmapPrivates\n");
diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h
index 27eb2f96f..2cd775d6b 100644
--- a/xorg-server/hw/xwin/winclipboard.h
+++ b/xorg-server/hw/xwin/winclipboard.h
@@ -79,7 +79,6 @@
  */
 
 extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
 extern void winDebug(const char *format, ...);
 extern void winErrorFVerb(int verb, const char *format, ...);
 
@@ -100,7 +99,7 @@ void
  winClipboardDOStoUNIX(char *pszData, int iLength);
 
 void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
 
 /*
  * winclipboardthread.c
diff --git a/xorg-server/hw/xwin/winclipboardtextconv.c b/xorg-server/hw/xwin/winclipboardtextconv.c
index 74a351b17..fd405a02e 100644
--- a/xorg-server/hw/xwin/winclipboardtextconv.c
+++ b/xorg-server/hw/xwin/winclipboardtextconv.c
@@ -38,7 +38,7 @@
 void
  winClipboardDOStoUNIX(char *pszSrc, int iLength);
 void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
 
 /*
  * Convert \r\n to \n
@@ -75,12 +75,12 @@ winClipboardDOStoUNIX(char *pszSrc, int iLength)
  */
 
 void
-winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength)
+winClipboardUNIXtoDOS(char **ppszData, int iLength)
 {
     int iNewlineCount = 0;
-    unsigned char *pszSrc = *ppszData;
-    unsigned char *pszEnd = pszSrc + iLength;
-    unsigned char *pszDest = NULL, *pszDestBegin = NULL;
+    char *pszSrc = *ppszData;
+    char *pszEnd = pszSrc + iLength;
+    char *pszDest = NULL, *pszDestBegin = NULL;
 
     winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
 
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
index f2e8e6d6f..891278279 100644
--- a/xorg-server/hw/xwin/winclipboardthread.c
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -47,7 +47,6 @@
  */
 
 extern Bool g_fUnicodeClipboard;
-extern unsigned long serverGeneration;
 extern Bool g_fClipboardStarted;
 extern Bool g_fClipboardLaunched;
 extern Bool g_fClipboard;
@@ -413,7 +412,7 @@ winClipboardProc(void *pvNotUsed)
             ("winClipboardProc - the clipboard thread has restarted %d times and seems to be unstable, disabling clipboard integration\n",
              clipboardRestarts);
         g_fClipboard = FALSE;
-        return;
+        return NULL;
     }
 
     if (g_fClipboard) {
@@ -422,7 +421,7 @@ winClipboardProc(void *pvNotUsed)
         /* Create the clipboard client thread */
         if (!winInitClipboard()) {
             ErrorF("winClipboardProc - winClipboardInit failed.\n");
-            return;
+            return NULL;
         }
 
         winDebug("winClipboardProc - winInitClipboard returned.\n");
diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c
index 1118f4ff8..008088b6a 100644
--- a/xorg-server/hw/xwin/winclipboardwrappers.c
+++ b/xorg-server/hw/xwin/winclipboardwrappers.c
@@ -49,10 +49,6 @@
  * Local function prototypes
  */
 
-int winProcEstablishConnection(ClientPtr /* client */ );
-int winProcQueryTree(ClientPtr /* client */ );
-int winProcSetSelectionOwner(ClientPtr /* client */ );
-
 DISPATCH_PROC(winProcEstablishConnection);
 DISPATCH_PROC(winProcSetSelectionOwner);
 
@@ -60,10 +56,8 @@ DISPATCH_PROC(winProcSetSelectionOwner);
  * References to external symbols
  */
 
-extern int g_iNumScreens;
 extern unsigned int g_uiAuthDataLen;
 extern char *g_pAuthData;
-extern Bool g_fXdmcpEnabled;
 extern Bool g_fClipboardLaunched;
 extern Bool g_fClipboardStarted;
 extern Bool g_fClipboard;
@@ -71,9 +65,6 @@ extern Window g_iClipboardWindow;
 extern Atom g_atomLastOwnedSelection;
 extern HWND g_hwndClipboard;
 
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcQueryTreeOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
 
 /*
  * Wrapper for internal EstablishConnection function.
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
index b56104fde..b5ea0db1b 100644
--- a/xorg-server/hw/xwin/wincursor.c
+++ b/xorg-server/hw/xwin/wincursor.c
@@ -158,7 +158,6 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
     HBITMAP hAnd, hXor;
     ICONINFO ii;
     unsigned char *pCur;
-    int x, y;
     unsigned char bit;
     HDC hDC;
     BITMAPV4HEADER bi;
@@ -262,6 +261,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
                                      sizeof(unsigned long));
 
         if (lpBits) {
+            int y;
             for (y = 0; y < nCY; y++) {
                 unsigned long *src, *dst;
 
@@ -305,6 +305,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
 
         pCur = (unsigned char *) lpBits;
         if (lpBits) {
+	    int x, y;
             for (y = 0; y < pScreenPriv->cursor.sm_cy; y++) {
                 for (x = 0; x < pScreenPriv->cursor.sm_cx; x++) {
                     if (x >= nCX || y >= nCY)   /* Outside of X11 icon bounds */
diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c
index 56c1e34e7..6645469fc 100644
--- a/xorg-server/hw/xwin/winerror.c
+++ b/xorg-server/hw/xwin/winerror.c
@@ -36,10 +36,6 @@
 #include "win.h"
 
 #ifdef DDXOSVERRORF
-/* Prototype */
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-
 void
 OsVendorVErrorF(const char *pszFormat, va_list va_args)
 {
diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c
index 8b7c7040c..7ac305d06 100644
--- a/xorg-server/hw/xwin/wingc.c
+++ b/xorg-server/hw/xwin/wingc.c
@@ -33,11 +33,6 @@
 #endif
 #include "win.h"
 
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx,
-              int dy, int xOrg, int yOrg);
-
 /*
  * Local prototypes
  */
diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h
index d8875ceb5..8b6b98407 100644
--- a/xorg-server/hw/xwin/winlayouts.h
+++ b/xorg-server/hw/xwin/winlayouts.h
@@ -30,11 +30,11 @@
 typedef struct {
     unsigned int winlayout;
     int winkbtype;
-    char *xkbmodel;
-    char *xkblayout;
-    char *xkbvariant;
-    char *xkboptions;
-    char *layoutname;
+    const char *xkbmodel;
+    const char *xkblayout;
+    const char *xkbvariant;
+    const char *xkboptions;
+    const char *layoutname;
 } WinKBLayoutRec, *WinKBLayoutPtr;
 
 /*
diff --git a/xorg-server/hw/xwin/winmonitors.c b/xorg-server/hw/xwin/winmonitors.c
index 07532f6f5..955fb9214 100644
--- a/xorg-server/hw/xwin/winmonitors.c
+++ b/xorg-server/hw/xwin/winmonitors.c
@@ -27,6 +27,10 @@ from The Open Group.
 
 */
 
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
 #include "win.h"
 #include "winmonitors.h"
 
@@ -55,13 +59,13 @@ getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
 }
 
 Bool
-QueryMonitor(int index, struct GetMonitorInfoData *data)
+QueryMonitor(int i, struct GetMonitorInfoData *data)
 {
     /* prepare data */
     if (data == NULL)
         return FALSE;
     memset(data, 0, sizeof(*data));
-    data->requestedMonitor = index;
+    data->requestedMonitor = i;
 
     /* query information */
     EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
diff --git a/xorg-server/hw/xwin/winmsg.c b/xorg-server/hw/xwin/winmsg.c
index 07c2f30eb..57c1d1888 100644
--- a/xorg-server/hw/xwin/winmsg.c
+++ b/xorg-server/hw/xwin/winmsg.c
@@ -38,7 +38,9 @@
 #endif
 #include <stdarg.h>
 
-void winVMsg(int, MessageType, int verb, const char *, va_list);
+void
+winVMsg(int, MessageType, int verb, const char *, va_list)
+_X_ATTRIBUTE_PRINTF(4, 0);
 
 void
 winVMsg(int scrnIndex, MessageType type, int verb, const char *format,
diff --git a/xorg-server/hw/xwin/winmsg.h b/xorg-server/hw/xwin/winmsg.h
index ec285ba1f..b638f2cb3 100644
--- a/xorg-server/hw/xwin/winmsg.h
+++ b/xorg-server/hw/xwin/winmsg.h
@@ -34,15 +34,29 @@
  * Function prototypes
  */
 
-void winDrvMsgVerb(int scrnIndex,
-                   MessageType type, int verb, const char *format, ...);
-void winDrvMsg(int scrnIndex, MessageType type, const char *format, ...);
-void winMsgVerb(MessageType type, int verb, const char *format, ...);
-void winMsg(MessageType type, const char *format, ...);
-void winDebug(const char *format, ...);
-void winTrace(const char *format, ...);
+void
+winDrvMsgVerb(int scrnIndex,
+              MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(4, 5);
+void
+winDrvMsg(int scrnIndex, MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+void
+winMsgVerb(MessageType type, int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(3, 4);
+void
+winMsg(MessageType type, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
+void
+winDebug(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+void
+winTrace(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
 
-void winErrorFVerb(int verb, const char *format, ...);
+void
+winErrorFVerb(int verb, const char *format, ...)
+_X_ATTRIBUTE_PRINTF(2, 3);
 void winW32Error(int verb, const char *message);
 void winW32ErrorEx(int verb, const char *message, DWORD errorcode);
 void winDebugWin32Message(const char *function, HWND hwnd, UINT message,
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index ffb7c2d0f..ac9d57976 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -131,13 +131,6 @@ typedef struct _XMsgProcArgRec {
     HWND hwndScreen;
 } XMsgProcArgRec, *XMsgProcArgPtr;
 
-/*
- * References to external symbols
- */
-
-extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
-
 /*
  * Prototypes for local functions
  */
@@ -526,7 +519,6 @@ getHwnd(WMInfoPtr pWMInfo, Window iWindow)
 static void
 UpdateName(WMInfoPtr pWMInfo, Window iWindow)
 {
-    wchar_t *pszName;
     HWND hWnd;
     XWindowAttributes attr;
 
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
index faa97c351..dbc5b5228 100644
--- a/xorg-server/hw/xwin/winprefs.c
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -57,9 +57,6 @@ extern int parse_file(FILE * fp);
 /* Currently in use command ID, incremented each new menu item created */
 static int g_cmdid = STARTMENUID;
 
-/* Defined in DIX */
-extern char *display;
-
 /* Local function to handle comma-ified icon names */
 static HICON LoadImageComma(char *fname, int sx, int sy, int flags);
 
@@ -330,12 +327,12 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
                 case CMD_EXEC:
                     if (fork() == 0) {
                         struct rlimit rl;
-                        unsigned long i;
+                        int fd;
 
                         /* Close any open descriptors except for STD* */
                         getrlimit(RLIMIT_NOFILE, &rl);
-                        for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++)
-                            close(i);
+                        for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++)
+                            close(fd);
 
                         /* Disassociate any TTYs */
                         setsid();
@@ -538,21 +535,21 @@ static HICON
 LoadImageComma(char *fname, int sx, int sy, int flags)
 {
     HICON hicon;
-    int index;
+    int i;
     char file[PATH_MAX + NAME_MAX + 2];
 
     /* Some input error checking */
     if (!fname || !fname[0])
         return NULL;
 
-    index = 0;
+    i = 0;
     hicon = NULL;
 
     if (fname[0] == ',') {
         /* It's the XWIN.EXE resource they want */
-        index = atoi(fname + 1);
+        i = atoi(fname + 1);
         hicon = LoadImage(g_hInstance,
-                          MAKEINTRESOURCE(index), IMAGE_ICON, sx, sy, flags);
+                          MAKEINTRESOURCE(i), IMAGE_ICON, sx, sy, flags);
     }
     else {
         file[0] = 0;
@@ -569,8 +566,8 @@ LoadImageComma(char *fname, int sx, int sy, int flags)
             /* Specified as <fname>,<index> */
 
             *(strrchr(file, ',')) = 0;  /* End string at comma */
-            index = atoi(strrchr(fname, ',') + 1);
-            hicon = ExtractIcon(g_hInstance, file, index);
+            i = atoi(strrchr(fname, ',') + 1);
+            hicon = ExtractIcon(g_hInstance, file, i);
         }
         else {
             /* Just an .ico file... */
diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l
index ba8aea696..15f707766 100644
--- a/xorg-server/hw/xwin/winprefslex.l
+++ b/xorg-server/hw/xwin/winprefslex.l
@@ -37,14 +37,10 @@
 #include <string.h>
 #include "winprefsyacc.h"
 
-extern YYSTYPE yylval;
-extern char *yytext;
 extern int yyparse(void);
 
 extern void ErrorF (const char* /*f*/, ...);
 
-int yylineno;
-
 /* Copy the parsed string, must be free()d in yacc parser */
 static char *makestr(char *str)
 {
@@ -62,6 +58,9 @@ static char *makestr(char *str)
 %}
 
 %option yylineno
+%option nounput
+%option noinput
+%option never-interactive
 
 %%
 \#.*[\r\n]              { /* comment */ return NEWLINE; }
diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y
index d23c32da4..3b376b3e7 100644
--- a/xorg-server/hw/xwin/winprefsyacc.y
+++ b/xorg-server/hw/xwin/winprefsyacc.y
@@ -1,457 +1,457 @@
-%{
-/*
- * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- * Copyright (C) Colin Harrison 2005-2008
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the XFree86 Project
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * from the XFree86 Project.
- *
- * Authors:     Earle F. Philhower, III
- *              Colin Harrison
- */
-/* $XFree86: $ */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "winprefs.h"
-
-/* The following give better error messages in bison at the cost of a few KB */
-#define YYERROR_VERBOSE 1
-
-/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */
-#define YYLTYPE_IS_TRIVIAL 1
-#define YYENABLE_NLS 0
-
-/* The global pref settings */
-WINPREFS pref;
-
-/* The working menu */  
-static MENUPARSED menu;
-
-/* Functions for parsing the tokens into out structure */
-/* Defined at the end section of this file */
-
-static void SetIconDirectory (char *path);
-static void SetDefaultIcon (char *fname);
-static void SetRootMenu (char *menu);
-static void SetDefaultSysMenu (char *menu, int pos);
-static void SetTrayIcon (char *fname);
-
-static void OpenMenu(char *menuname);
-static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
-static void CloseMenu(void);
-
-static void OpenIcons(void);
-static void AddIconLine(char *matchstr, char *iconfile);
-static void CloseIcons(void);
-
-static void OpenStyles(void);
-static void AddStyleLine(char *matchstr, unsigned long style);
-static void CloseStyles(void);
-
-static void OpenSysMenu(void);
-static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
-static void CloseSysMenu(void);
-
-static int yyerror (char *s);
-
-extern void ErrorF (const char* /*f*/, ...);
-extern char *yytext;
-extern int yylex(void);
-
-%}
-
-%union {
-  char *sVal;
-  unsigned long uVal;
-  int iVal;
-}
-
-%token NEWLINE
-%token MENU
-%token LB
-%token RB
-%token ICONDIRECTORY
-%token DEFAULTICON
-%token ICONS
-%token STYLES
-%token TOPMOST
-%token MAXIMIZE
-%token MINIMIZE
-%token BOTTOM
-%token NOTITLE
-%token OUTLINE
-%token NOFRAME
-%token DEFAULTSYSMENU
-%token SYSMENU
-%token ROOTMENU
-%token SEPARATOR
-%token ATSTART
-%token ATEND
-%token EXEC
-%token ALWAYSONTOP
-%token DEBUGOUTPUT "DEBUG"
-%token RELOAD
-%token TRAYICON
-%token FORCEEXIT
-%token SILENTEXIT
-
-%token <sVal> STRING
-%type <uVal>  group1
-%type <uVal>  group2
-%type <uVal>  stylecombo
-%type <iVal>  atspot
-
-%%
-
-input:	/* empty */
-	| input line
-	;
-
-line:	NEWLINE
-	| command
-	;
-
-
-newline_or_nada:	
-	| NEWLINE newline_or_nada
-	;
-
-command:	defaulticon
-	| icondirectory
-	| menu
-	| icons
-	| styles
-	| sysmenu
-	| rootmenu
-	| defaultsysmenu
-	| debug
-	| trayicon
-	| forceexit
-	| silentexit
-	;
-
-trayicon:	TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
-	;
-
-rootmenu:	ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
-	;
-
-defaultsysmenu:	DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
-	;
-
-defaulticon:	DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
-	;
-
-icondirectory:	ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
-	;
-
-menuline:	SEPARATOR NEWLINE newline_or_nada  { AddMenuLine("-", CMD_SEPARATOR, ""); }
-	| STRING ALWAYSONTOP NEWLINE newline_or_nada  { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
-	| STRING EXEC STRING NEWLINE newline_or_nada  { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
-	| STRING MENU STRING NEWLINE newline_or_nada  { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
-	| STRING RELOAD NEWLINE newline_or_nada  { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
-	;
-
-menulist:	menuline
-	| menuline menulist
-	;
-
-menu:	MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
-	;
-
-iconline:	STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
-	;
-
-iconlist:	iconline
-	| iconline iconlist
-	;
-
-icons:	ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
-	;
-
-group1:	TOPMOST { $$=STYLE_TOPMOST; }
-	| MAXIMIZE { $$=STYLE_MAXIMIZE; }
-	| MINIMIZE { $$=STYLE_MINIMIZE; }
-	| BOTTOM { $$=STYLE_BOTTOM; }
-	;
-
-group2:	NOTITLE { $$=STYLE_NOTITLE; }
-	| OUTLINE { $$=STYLE_OUTLINE; }
-	| NOFRAME { $$=STYLE_NOFRAME; }
-	;
-
-stylecombo:	group1 { $$=$1; }
-	| group2 { $$=$1; }
-	| group1 group2 { $$=$1|$2; }
-	| group2 group1 { $$=$1|$2; }
-	;
-
-styleline:	STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); }
-	;
-
-stylelist:	styleline
-	| styleline stylelist
-	;
-
-styles:	STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();}
-	;
-
-atspot:	{ $$=AT_END; }
-	| ATSTART { $$=AT_START; }
-	| ATEND { $$=AT_END; }
-	;
-
-sysmenuline:	STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
-	;
-
-sysmenulist:	sysmenuline
-	| sysmenuline sysmenulist
-	;
-
-sysmenu:	SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
-	;
-
-forceexit:	FORCEEXIT NEWLINE { pref.fForceExit = TRUE; }
-	;
-
-silentexit:	SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
-	;
-
-debug: 	DEBUGOUTPUT STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
-	;
-
-
-%%
-/*
- * Errors in parsing abort and print log messages
- */
-static int
-yyerror (char *s) 
-{
-  extern int yylineno; /* Handled by flex internally */
-
-  ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
-  return 1;
-}
-
-/* Miscellaneous functions to store TOKENs into the structure */
-static void
-SetIconDirectory (char *path)
-{
-  strncpy (pref.iconDirectory, path, PATH_MAX);
-  pref.iconDirectory[PATH_MAX] = 0;
-}
-
-static void
-SetDefaultIcon (char *fname)
-{
-  strncpy (pref.defaultIconName, fname, NAME_MAX);
-  pref.defaultIconName[NAME_MAX] = 0;
-}
-
-static void
-SetTrayIcon (char *fname)
-{
-  strncpy (pref.trayIconName, fname, NAME_MAX);
-  pref.trayIconName[NAME_MAX] = 0;
-}
-
-static void
-SetRootMenu (char *menu)
-{
-  strncpy (pref.rootMenuName, menu, MENU_MAX);
-  pref.rootMenuName[MENU_MAX] = 0;
-}
-
-static void
-SetDefaultSysMenu (char *menu, int pos)
-{
-  strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
-  pref.defaultSysMenuName[MENU_MAX] = 0;
-  pref.defaultSysMenuPos = pos;
-}
-
-static void
-OpenMenu (char *menuname)
-{
-  if (menu.menuItem) free(menu.menuItem);
-  menu.menuItem = NULL;
-  strncpy(menu.menuName, menuname, MENU_MAX);
-  menu.menuName[MENU_MAX] = 0;
-  menu.menuItems = 0;
-}
-
-static void
-AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
-{
-  if (menu.menuItem==NULL)
-    menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
-  else
-    menu.menuItem = (MENUITEM*)
-      realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
-
-  strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
-  menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
-
-  menu.menuItem[menu.menuItems].cmd = cmd;
-
-  strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
-  menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
-
-  menu.menuItem[menu.menuItems].commandID = 0;
-
-  menu.menuItems++;
-}
-
-static void
-CloseMenu (void)
-{
-  if (menu.menuItem==NULL || menu.menuItems==0)
-    {
-      ErrorF("LoadPreferences: Empty menu detected\n");
-      return;
-    }
-  
-  if (pref.menuItems)
-    pref.menu = (MENUPARSED*)
-      realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
-  else
-    pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
-  
-  memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
-  pref.menuItems++;
-
-  memset (&menu, 0, sizeof(MENUPARSED));
-}
-
-static void 
-OpenIcons (void)
-{
-  if (pref.icon != NULL) {
-    ErrorF("LoadPreferences: Redefining icon mappings\n");
-    free(pref.icon);
-    pref.icon = NULL;
-  }
-  pref.iconItems = 0;
-}
-
-static void
-AddIconLine (char *matchstr, char *iconfile)
-{
-  if (pref.icon==NULL)
-    pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
-  else
-    pref.icon = (ICONITEM*)
-      realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
-
-  strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
-  pref.icon[pref.iconItems].match[MENU_MAX] = 0;
-
-  strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
-  pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
-
-  pref.icon[pref.iconItems].hicon = 0;
-
-  pref.iconItems++;
-}
-
-static void 
-CloseIcons (void)
-{
-}
-
-static void
-OpenStyles (void)
-{
-  if (pref.style != NULL) {
-    ErrorF("LoadPreferences: Redefining window style\n");
-    free(pref.style);
-    pref.style = NULL;
-  }
-  pref.styleItems = 0;
-}
-
-static void
-AddStyleLine (char *matchstr, unsigned long style)
-{
-  if (pref.style==NULL)
-    pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM));
-  else
-    pref.style = (STYLEITEM*)
-      realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
-
-  strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX);
-  pref.style[pref.styleItems].match[MENU_MAX] = 0;
-
-  pref.style[pref.styleItems].type = style;
-
-  pref.styleItems++;
-}
-
-static void
-CloseStyles (void)
-{
-}
-
-static void
-OpenSysMenu (void)
-{
-  if (pref.sysMenu != NULL) {
-    ErrorF("LoadPreferences: Redefining system menu\n");
-    free(pref.sysMenu);
-    pref.sysMenu = NULL;
-  }
-  pref.sysMenuItems = 0;
-}
-
-static void
-AddSysMenuLine (char *matchstr, char *menuname, int pos)
-{
-  if (pref.sysMenu==NULL)
-    pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
-  else
-    pref.sysMenu = (SYSMENUITEM*)
-      realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
-
-  strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
-  pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
-
-  strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
-  pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
-
-  pref.sysMenu[pref.sysMenuItems].menuPos = pos;
-
-  pref.sysMenuItems++;
-}
-
-static void
-CloseSysMenu (void)
-{
-}
-
+%{
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) Colin Harrison 2005-2008
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * from the XFree86 Project.
+ *
+ * Authors:     Earle F. Philhower, III
+ *              Colin Harrison
+ */
+/* $XFree86: $ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */
+#include <string.h>
+#include "winprefs.h"
+
+/* The following give better error messages in bison at the cost of a few KB */
+#define YYERROR_VERBOSE 1
+
+/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */
+#define YYLTYPE_IS_TRIVIAL 1
+#define YYENABLE_NLS 0
+
+/* The global pref settings */
+WINPREFS pref;
+
+/* The working menu */  
+static MENUPARSED menu;
+
+/* Functions for parsing the tokens into out structure */
+/* Defined at the end section of this file */
+
+static void SetIconDirectory (char *path);
+static void SetDefaultIcon (char *fname);
+static void SetRootMenu (char *menu);
+static void SetDefaultSysMenu (char *menu, int pos);
+static void SetTrayIcon (char *fname);
+
+static void OpenMenu(char *menuname);
+static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
+static void CloseMenu(void);
+
+static void OpenIcons(void);
+static void AddIconLine(char *matchstr, char *iconfile);
+static void CloseIcons(void);
+
+static void OpenStyles(void);
+static void AddStyleLine(char *matchstr, unsigned long style);
+static void CloseStyles(void);
+
+static void OpenSysMenu(void);
+static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
+static void CloseSysMenu(void);
+
+static int yyerror (char *s);
+
+extern char *yytext;
+extern int yylex(void);
+
+%}
+
+%union {
+  char *sVal;
+  unsigned long uVal;
+  int iVal;
+}
+
+%token NEWLINE
+%token MENU
+%token LB
+%token RB
+%token ICONDIRECTORY
+%token DEFAULTICON
+%token ICONS
+%token STYLES
+%token TOPMOST
+%token MAXIMIZE
+%token MINIMIZE
+%token BOTTOM
+%token NOTITLE
+%token OUTLINE
+%token NOFRAME
+%token DEFAULTSYSMENU
+%token SYSMENU
+%token ROOTMENU
+%token SEPARATOR
+%token ATSTART
+%token ATEND
+%token EXEC
+%token ALWAYSONTOP
+%token DEBUGOUTPUT "DEBUG"
+%token RELOAD
+%token TRAYICON
+%token FORCEEXIT
+%token SILENTEXIT
+
+%token <sVal> STRING
+%type <uVal>  group1
+%type <uVal>  group2
+%type <uVal>  stylecombo
+%type <iVal>  atspot
+
+%%
+
+input:	/* empty */
+	| input line
+	;
+
+line:	NEWLINE
+	| command
+	;
+
+
+newline_or_nada:	
+	| NEWLINE newline_or_nada
+	;
+
+command:	defaulticon
+	| icondirectory
+	| menu
+	| icons
+	| styles
+	| sysmenu
+	| rootmenu
+	| defaultsysmenu
+	| debug
+	| trayicon
+	| forceexit
+	| silentexit
+	;
+
+trayicon:	TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
+	;
+
+rootmenu:	ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
+	;
+
+defaultsysmenu:	DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
+	;
+
+defaulticon:	DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
+	;
+
+icondirectory:	ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
+	;
+
+menuline:	SEPARATOR NEWLINE newline_or_nada  { AddMenuLine("-", CMD_SEPARATOR, ""); }
+	| STRING ALWAYSONTOP NEWLINE newline_or_nada  { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
+	| STRING EXEC STRING NEWLINE newline_or_nada  { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
+	| STRING MENU STRING NEWLINE newline_or_nada  { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
+	| STRING RELOAD NEWLINE newline_or_nada  { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
+	;
+
+menulist:	menuline
+	| menuline menulist
+	;
+
+menu:	MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
+	;
+
+iconline:	STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
+	;
+
+iconlist:	iconline
+	| iconline iconlist
+	;
+
+icons:	ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
+	;
+
+group1:	TOPMOST { $$=STYLE_TOPMOST; }
+	| MAXIMIZE { $$=STYLE_MAXIMIZE; }
+	| MINIMIZE { $$=STYLE_MINIMIZE; }
+	| BOTTOM { $$=STYLE_BOTTOM; }
+	;
+
+group2:	NOTITLE { $$=STYLE_NOTITLE; }
+	| OUTLINE { $$=STYLE_OUTLINE; }
+	| NOFRAME { $$=STYLE_NOFRAME; }
+	;
+
+stylecombo:	group1 { $$=$1; }
+	| group2 { $$=$1; }
+	| group1 group2 { $$=$1|$2; }
+	| group2 group1 { $$=$1|$2; }
+	;
+
+styleline:	STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); }
+	;
+
+stylelist:	styleline
+	| styleline stylelist
+	;
+
+styles:	STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();}
+	;
+
+atspot:	{ $$=AT_END; }
+	| ATSTART { $$=AT_START; }
+	| ATEND { $$=AT_END; }
+	;
+
+sysmenuline:	STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
+	;
+
+sysmenulist:	sysmenuline
+	| sysmenuline sysmenulist
+	;
+
+sysmenu:	SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
+	;
+
+forceexit:	FORCEEXIT NEWLINE { pref.fForceExit = TRUE; }
+	;
+
+silentexit:	SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
+	;
+
+debug: 	DEBUGOUTPUT STRING NEWLINE { ErrorF("LoadPreferences: %s\n", $2); free($2); }
+	;
+
+
+%%
+/*
+ * Errors in parsing abort and print log messages
+ */
+static int
+yyerror (char *s) 
+{
+  extern int yylineno; /* Handled by flex internally */
+
+  ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
+  return 1;
+}
+
+/* Miscellaneous functions to store TOKENs into the structure */
+static void
+SetIconDirectory (char *path)
+{
+  strncpy (pref.iconDirectory, path, PATH_MAX);
+  pref.iconDirectory[PATH_MAX] = 0;
+}
+
+static void
+SetDefaultIcon (char *fname)
+{
+  strncpy (pref.defaultIconName, fname, NAME_MAX);
+  pref.defaultIconName[NAME_MAX] = 0;
+}
+
+static void
+SetTrayIcon (char *fname)
+{
+  strncpy (pref.trayIconName, fname, NAME_MAX);
+  pref.trayIconName[NAME_MAX] = 0;
+}
+
+static void
+SetRootMenu (char *menuname)
+{
+  strncpy (pref.rootMenuName, menuname, MENU_MAX);
+  pref.rootMenuName[MENU_MAX] = 0;
+}
+
+static void
+SetDefaultSysMenu (char *menuname, int pos)
+{
+  strncpy (pref.defaultSysMenuName, menuname, MENU_MAX);
+  pref.defaultSysMenuName[MENU_MAX] = 0;
+  pref.defaultSysMenuPos = pos;
+}
+
+static void
+OpenMenu (char *menuname)
+{
+  if (menu.menuItem) free(menu.menuItem);
+  menu.menuItem = NULL;
+  strncpy(menu.menuName, menuname, MENU_MAX);
+  menu.menuName[MENU_MAX] = 0;
+  menu.menuItems = 0;
+}
+
+static void
+AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
+{
+  if (menu.menuItem==NULL)
+    menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
+  else
+    menu.menuItem = (MENUITEM*)
+      realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
+
+  strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
+  menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
+
+  menu.menuItem[menu.menuItems].cmd = cmd;
+
+  strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
+  menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
+
+  menu.menuItem[menu.menuItems].commandID = 0;
+
+  menu.menuItems++;
+}
+
+static void
+CloseMenu (void)
+{
+  if (menu.menuItem==NULL || menu.menuItems==0)
+    {
+      ErrorF("LoadPreferences: Empty menu detected\n");
+      return;
+    }
+  
+  if (pref.menuItems)
+    pref.menu = (MENUPARSED*)
+      realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
+  else
+    pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
+  
+  memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
+  pref.menuItems++;
+
+  memset (&menu, 0, sizeof(MENUPARSED));
+}
+
+static void 
+OpenIcons (void)
+{
+  if (pref.icon != NULL) {
+    ErrorF("LoadPreferences: Redefining icon mappings\n");
+    free(pref.icon);
+    pref.icon = NULL;
+  }
+  pref.iconItems = 0;
+}
+
+static void
+AddIconLine (char *matchstr, char *iconfile)
+{
+  if (pref.icon==NULL)
+    pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
+  else
+    pref.icon = (ICONITEM*)
+      realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
+
+  strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
+  pref.icon[pref.iconItems].match[MENU_MAX] = 0;
+
+  strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
+  pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
+
+  pref.icon[pref.iconItems].hicon = 0;
+
+  pref.iconItems++;
+}
+
+static void 
+CloseIcons (void)
+{
+}
+
+static void
+OpenStyles (void)
+{
+  if (pref.style != NULL) {
+    ErrorF("LoadPreferences: Redefining window style\n");
+    free(pref.style);
+    pref.style = NULL;
+  }
+  pref.styleItems = 0;
+}
+
+static void
+AddStyleLine (char *matchstr, unsigned long style)
+{
+  if (pref.style==NULL)
+    pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM));
+  else
+    pref.style = (STYLEITEM*)
+      realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
+
+  strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX);
+  pref.style[pref.styleItems].match[MENU_MAX] = 0;
+
+  pref.style[pref.styleItems].type = style;
+
+  pref.styleItems++;
+}
+
+static void
+CloseStyles (void)
+{
+}
+
+static void
+OpenSysMenu (void)
+{
+  if (pref.sysMenu != NULL) {
+    ErrorF("LoadPreferences: Redefining system menu\n");
+    free(pref.sysMenu);
+    pref.sysMenu = NULL;
+  }
+  pref.sysMenuItems = 0;
+}
+
+static void
+AddSysMenuLine (char *matchstr, char *menuname, int pos)
+{
+  if (pref.sysMenu==NULL)
+    pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
+  else
+    pref.sysMenu = (SYSMENUITEM*)
+      realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
+
+  strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
+  pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
+
+  strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
+  pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
+
+  pref.sysMenu[pref.sysMenuItems].menuPos = pos;
+
+  pref.sysMenuItems++;
+}
+
+static void
+CloseSysMenu (void)
+{
+}
+
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index a5b3c07bf..14056faf0 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -56,10 +56,6 @@ void
 void
  winLogVersionInfo(void);
 
-#ifdef DDXOSVERRORF
-void OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
 /*
  * Process arguments on the command line
  */
diff --git a/xorg-server/hw/xwin/winregistry.c b/xorg-server/hw/xwin/winregistry.c
deleted file mode 100644
index d33f8c363..000000000
--- a/xorg-server/hw/xwin/winregistry.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors:	Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* Prototypes */
-DWORD winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey);
-
-DWORD
-winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey)
-{
-    HKEY hkResult;
-    DWORD dwDisposition;
-
-    RegCreateKeyEx(hkey,
-                   pszRegistryKey,
-                   0,
-                   '\0',
-                   REG_OPTION_NON_VOLATILE,
-                   KEY_READ, NULL, &hkResult, &dwDisposition);
-
-    if (dwDisposition == REG_CREATED_NEW_KEY) {
-        ErrorF("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey);
-    }
-    else if (dwDisposition == REG_OPENED_EXISTING_KEY) {
-        ErrorF("winGetRegistryDWORD - Opened existing key: %s\n",
-               pszRegistryKey);
-    }
-
-    /* Free the registry key handle */
-    RegCloseKey(hkResult);
-    hkResult = NULL;
-
-    return 0;
-}
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index be25f12af..639a99ca3 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -254,7 +254,7 @@ winCreateScreenResources(ScreenPtr pScreen)
 
 /* See Porting Layer Definition - p. 20 */
 Bool
-winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
+winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
 {
     winScreenPriv(pScreen);
     winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
@@ -578,11 +578,11 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
 /* See Porting Layer Definition - p. 20 */
 
 Bool
-winFinishScreenInitNativeGDI(int index,
+winFinishScreenInitNativeGDI(int i,
                              ScreenPtr pScreen, int argc, char **argv)
 {
     winScreenPriv(pScreen);
-    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+    winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i];
     VisualPtr pVisuals = NULL;
     DepthPtr pDepths = NULL;
     VisualID rootVisual = 0;
diff --git a/xorg-server/hw/xwin/winvalargs.c b/xorg-server/hw/xwin/winvalargs.c
index eb6e973b8..edfd71f72 100644
--- a/xorg-server/hw/xwin/winvalargs.c
+++ b/xorg-server/hw/xwin/winvalargs.c
@@ -57,9 +57,7 @@ Bool
 winValidateArgs(void)
 {
     int i;
-    int iMaxConsecutiveScreen = 0;
     BOOL fHasNormalScreen0 = FALSE;
-    BOOL fImplicitScreenFound = FALSE;
 
     /*
      * Check for a malformed set of -screen parameters.
diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c
index 594791789..ab6d8dec2 100644
--- a/xorg-server/hw/xwin/winwindow.c
+++ b/xorg-server/hw/xwin/winwindow.c
@@ -59,7 +59,6 @@ winCreateWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -82,7 +81,6 @@ winDestroyWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -105,7 +103,6 @@ winPositionWindowNativeGDI(WindowPtr pWin, int x, int y)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -210,7 +207,6 @@ winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -238,7 +234,6 @@ winUnmapWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
@@ -262,7 +257,6 @@ winMapWindowNativeGDI(WindowPtr pWin)
     Bool fResult = TRUE;
     ScreenPtr pScreen = pWin->drawable.pScreen;
 
-    winWindowPriv(pWin);
     winScreenPriv(pScreen);
 
 #if CYGDEBUG
diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c
index 88c375733..fbd41aaa8 100644
--- a/xorg-server/hw/xwin/winwindowswm.c
+++ b/xorg-server/hw/xwin/winwindowswm.c
@@ -82,7 +82,6 @@ static int
 ProcWindowsWMQueryVersion(ClientPtr client)
 {
     xWindowsWMQueryVersionReply rep;
-    int n;
 
     REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
     rep.type = X_Reply;
@@ -491,7 +490,7 @@ ProcWindowsWMFrameSetTitle(ClientPtr client)
 #endif
 
     title_bytes = malloc(title_length + 1);
-    strncpy(title_bytes, (unsigned char *) &stuff[1], title_length);
+    strncpy(title_bytes, (char *) &stuff[1], title_length);
     title_bytes[title_length] = '\0';
 
     pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
@@ -562,8 +561,6 @@ SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to)
 static int
 SProcWindowsWMQueryVersion(ClientPtr client)
 {
-    int n;
-
     REQUEST(xWindowsWMQueryVersionReq);
     swaps(&stuff->length);
     return ProcWindowsWMQueryVersion(client);
-- 
cgit v1.2.3