Unverified Commit c8d69eba authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/fix_shadowed_vars' into 3.6.x

parents 105cd2be 4821edfe
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
* *
#define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \ #define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \ -Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs -Wredundant-decls -Wnested-externs -Wshadow
*/ */
/* /*
......
...@@ -720,9 +720,9 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese ...@@ -720,9 +720,9 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese
# if XFree86Devel # if XFree86Devel
# define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \ # define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \ -Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs Gcc28Warnings -Wredundant-decls -Wnested-externs -Wshadow Gcc28Warnings
# else # else
# define GccWarningOptions -Wall -Wpedantic -Wpointer-arith Gcc28Warnings # define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wshadow Gcc28Warnings
# endif # endif
# endif # endif
# ifndef DefaultCCOptions # ifndef DefaultCCOptions
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
* *
#define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \ #define GccWarningOptions -Wall -Wpedantic -Wpointer-arith -Wstrict-prototypes \
-Wmissing-prototypes -Wmissing-declarations \ -Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs -Wredundant-decls -Wnested-externs -Wshadow
*/ */
/* /*
......
...@@ -145,7 +145,7 @@ CheckForEmptyMask(CursorBitsPtr bits) ...@@ -145,7 +145,7 @@ CheckForEmptyMask(CursorBitsPtr bits)
if (bits->argb) if (bits->argb)
{ {
CARD32 *argb = bits->argb; CARD32 *argb = bits->argb;
int n = bits->width * bits->height; n = bits->width * bits->height;
while (n--) while (n--)
if (*argb++ & 0xff000000) return; if (*argb++ & 0xff000000) return;
} }
......
...@@ -303,7 +303,7 @@ void nxagentWakeupByReset(ClientPtr client) ...@@ -303,7 +303,7 @@ void nxagentWakeupByReset(ClientPtr client)
#ifndef WAIT_ALL_EVENTS #ifndef WAIT_ALL_EVENTS
static Bool nxagentWaitWakeupBySplitPredicate(Display *display, XEvent *event, XPointer ptr) static Bool nxagentWaitWakeupBySplitPredicate(Display *disp, XEvent *event, XPointer ptr)
{ {
return (event -> type == ClientMessage && return (event -> type == ClientMessage &&
(event -> xclient.data.l[0] == NXNoSplitNotify || (event -> xclient.data.l[0] == NXNoSplitNotify ||
......
...@@ -1733,13 +1733,15 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection, ...@@ -1733,13 +1733,15 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
return 0; return 0;
} }
int i = nxagentFindCurrentSelectionIndex(selection);
if (i < NumCurrentSelections && IS_INTERNAL_OWNER(i))
{ {
/* int i = nxagentFindCurrentSelectionIndex(selection);
* There is a client owner on the agent side, let normal dix stuff happen. if (i < NumCurrentSelections && IS_INTERNAL_OWNER(i))
*/ {
return 0; /*
* There is a client owner on the agent side, let normal dix stuff happen.
*/
return 0;
}
} }
/* /*
......
...@@ -487,7 +487,7 @@ void nxagentDisconnectCursor(void * p0, XID x1, void * p2) ...@@ -487,7 +487,7 @@ void nxagentDisconnectCursor(void * p0, XID x1, void * p2)
} }
} }
Bool nxagentDisconnectAllCursor(void) void nxagentDisconnectAllCursor(void)
{ {
Bool r = True; Bool r = True;
...@@ -518,7 +518,7 @@ Bool nxagentDisconnectAllCursor(void) ...@@ -518,7 +518,7 @@ Bool nxagentDisconnectAllCursor(void)
nxagentDisconnectCursor(grab -> cursor, 0, &r); nxagentDisconnectCursor(grab -> cursor, 0, &r);
} }
return r; return;
} }
......
...@@ -112,6 +112,6 @@ void nxagentDisconnectCursor(void * p0, XID x1, void * p2); ...@@ -112,6 +112,6 @@ void nxagentDisconnectCursor(void * p0, XID x1, void * p2);
void nxagentReconnectCursor(void * p0, XID x1, void * p2); void nxagentReconnectCursor(void * p0, XID x1, void * p2);
void nxagentReDisplayCurrentCursor(void); void nxagentReDisplayCurrentCursor(void);
Bool nxagentReconnectAllCursor(void *p0); Bool nxagentReconnectAllCursor(void *p0);
Bool nxagentDisconnectAllCursor(void); void nxagentDisconnectAllCursor(void);
#endif /* __Cursor_H__ */ #endif /* __Cursor_H__ */
...@@ -110,7 +110,7 @@ Bool nxagentTrue24 = False; ...@@ -110,7 +110,7 @@ Bool nxagentTrue24 = False;
int nxagentNumVisuals; int nxagentNumVisuals;
int nxagentXConnectionNumber; int nxagentXConnectionNumber;
int nxagentIOErrorHandler(Display *display); int nxagentIOErrorHandler(Display *disp);
static Bool nxagentDisplayInfoSaved = False; static Bool nxagentDisplayInfoSaved = False;
static Display *nxagentDisplayBackup = NULL; static Display *nxagentDisplayBackup = NULL;
...@@ -170,7 +170,7 @@ Pixmap nxagentIconPixmap; ...@@ -170,7 +170,7 @@ Pixmap nxagentIconPixmap;
Pixmap nxagentIconShape; Pixmap nxagentIconShape;
Bool useXpmIcon = False; Bool useXpmIcon = False;
Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask); Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask);
static void nxagentInitVisuals(void); static void nxagentInitVisuals(void);
...@@ -188,7 +188,7 @@ static int nxagentCheckForColormapsCompatibility(int flexibility); ...@@ -188,7 +188,7 @@ static int nxagentCheckForColormapsCompatibility(int flexibility);
* Save Internal implementation Also called in Reconnect.c. * Save Internal implementation Also called in Reconnect.c.
*/ */
Display *nxagentInternalOpenDisplay(char *display); Display *nxagentInternalOpenDisplay(char *disp);
#ifdef NXAGENT_TIMESTAMP #ifdef NXAGENT_TIMESTAMP
unsigned long startTime; unsigned long startTime;
...@@ -226,7 +226,7 @@ int nxagentServerOrder(void) ...@@ -226,7 +226,7 @@ int nxagentServerOrder(void)
* be probably moved to Handlers.c. * be probably moved to Handlers.c.
*/ */
int nxagentIOErrorHandler(Display *display) int nxagentIOErrorHandler(Display *disp)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentIOErrorHandler: Got I/O error with nxagentException.ioError [%d].\n", fprintf(stderr, "nxagentIOErrorHandler: Got I/O error with nxagentException.ioError [%d].\n",
...@@ -559,7 +559,7 @@ static void nxagentSigchldHandler(int signal) ...@@ -559,7 +559,7 @@ static void nxagentSigchldHandler(int signal)
return; return;
} }
Display *nxagentInternalOpenDisplay(char *display) Display *nxagentInternalOpenDisplay(char *disp)
{ {
/* /*
* Stop the smart schedule timer since it uses SIGALRM as we do. * Stop the smart schedule timer since it uses SIGALRM as we do.
...@@ -601,10 +601,10 @@ FIXME: Should print a warning if the user tries to let the agent ...@@ -601,10 +601,10 @@ FIXME: Should print a warning if the user tries to let the agent
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentInternalOpenDisplay: Going to open the display [%s].\n", fprintf(stderr, "nxagentInternalOpenDisplay: Going to open the display [%s].\n",
display); disp);
#endif #endif
Display *newDisplay = XOpenDisplay(display); Display *newDisplay = XOpenDisplay(disp);
alarm(0); alarm(0);
...@@ -630,7 +630,7 @@ FIXME: Should print a warning if the user tries to let the agent ...@@ -630,7 +630,7 @@ FIXME: Should print a warning if the user tries to let the agent
return newDisplay; return newDisplay;
} }
static void nxagentDisplayBlockHandler(Display *display, int reason) static void nxagentDisplayBlockHandler(Display *disp, int reason)
{ {
if (nxagentDisplay != NULL) if (nxagentDisplay != NULL)
{ {
...@@ -686,7 +686,7 @@ static void nxagentDisplayBlockHandler(Display *display, int reason) ...@@ -686,7 +686,7 @@ static void nxagentDisplayBlockHandler(Display *display, int reason)
} }
} }
static void nxagentDisplayWriteHandler(Display *display, int length) static void nxagentDisplayWriteHandler(Display *disp, int length)
{ {
if (nxagentDisplay != NULL) if (nxagentDisplay != NULL)
{ {
...@@ -717,7 +717,7 @@ int nxagentGetDataRate(void) ...@@ -717,7 +717,7 @@ int nxagentGetDataRate(void)
return nxagentRate; return nxagentRate;
} }
static void nxagentDisplayFlushHandler(Display *display, int length) static void nxagentDisplayFlushHandler(Display *disp, int length)
{ {
if (nxagentDisplay != NULL) if (nxagentDisplay != NULL)
{ {
...@@ -768,7 +768,7 @@ static void nxagentDisplayFlushHandler(Display *display, int length) ...@@ -768,7 +768,7 @@ static void nxagentDisplayFlushHandler(Display *display, int length)
* rupt was received or if any other event occurred mandating the * rupt was received or if any other event occurred mandating the
+ end of the session." + end of the session."
*/ */
static int nxagentDisplayErrorPredicate(Display *display, int error) static int nxagentDisplayErrorPredicate(Display *disp, int error)
{ {
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentDisplayErrorPredicate: CHECK! Error is [%d] with [%d][%d][%d][%d][%d].\n", fprintf(stderr, "nxagentDisplayErrorPredicate: CHECK! Error is [%d] with [%d][%d][%d][%d][%d].\n",
...@@ -789,7 +789,7 @@ static int nxagentDisplayErrorPredicate(Display *display, int error) ...@@ -789,7 +789,7 @@ static int nxagentDisplayErrorPredicate(Display *display, int error)
else if (nxagentException.sigHup > 0 || else if (nxagentException.sigHup > 0 ||
nxagentException.ioError > 0) nxagentException.ioError > 0)
{ {
NXForceDisplayError(display); NXForceDisplayError(disp);
return 1; return 1;
} }
...@@ -1746,7 +1746,7 @@ FIXME: Is this needed? ...@@ -1746,7 +1746,7 @@ FIXME: Is this needed?
nxagentDisplay = NULL; nxagentDisplay = NULL;
} }
Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask) Bool nxagentMakeIcon(Display *disp, Pixmap *nxIcon, Pixmap *nxMask)
{ {
char** agentIconData; char** agentIconData;
...@@ -1764,8 +1764,8 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask) ...@@ -1764,8 +1764,8 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
XlibPixmap IconPixmap; XlibPixmap IconPixmap;
XlibPixmap IconShape; XlibPixmap IconShape;
if (XpmSuccess == XpmCreatePixmapFromData(display, if (XpmSuccess == XpmCreatePixmapFromData(disp,
DefaultRootWindow(display), DefaultRootWindow(disp),
agentIconData, agentIconData,
&IconPixmap, &IconPixmap,
&IconShape, &IconShape,
...@@ -2255,7 +2255,6 @@ static int nxagentInitAndCheckVisuals(int flexibility) ...@@ -2255,7 +2255,6 @@ static int nxagentInitAndCheckVisuals(int flexibility)
{ {
/* FIXME: does this also need work? */ /* FIXME: does this also need work? */
bool matched;
bool compatible = true; bool compatible = true;
long viMask = VisualScreenMask; long viMask = VisualScreenMask;
......
...@@ -405,7 +405,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned ...@@ -405,7 +405,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
RegionNumRects(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)))); RegionNumRects(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable))));
#endif #endif
RegionPtr clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height); clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height);
/* /*
* Intersecting the viewable region of the drawable with the * Intersecting the viewable region of the drawable with the
...@@ -2261,11 +2261,11 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, ...@@ -2261,11 +2261,11 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode,
{ {
RegionPtr pRegion = RegionCreate(NullBox, 1); RegionPtr pRegion = RegionCreate(NullBox, 1);
int np = nPoints; xPoint *xp = pPoints;
while (np--)
for (int np = nPoints; np--; xp++)
{ {
BoxRec box; BoxRec box;
xPoint *xp = pPoints;
if (CoordModePrevious) if (CoordModePrevious)
{ {
...@@ -2294,8 +2294,6 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, ...@@ -2294,8 +2294,6 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode,
RegionUnion(pRegion, pRegion, &tmpRegion); RegionUnion(pRegion, pRegion, &tmpRegion);
RegionUninit(&tmpRegion); RegionUninit(&tmpRegion);
xp++;
} }
BoxRec extents = *RegionExtents(pRegion); BoxRec extents = *RegionExtents(pRegion);
......
...@@ -167,7 +167,7 @@ void nxagentHandleCollectPropertyEvent(XEvent*); ...@@ -167,7 +167,7 @@ void nxagentHandleCollectPropertyEvent(XEvent*);
void nxagentHandleCollectGrabPointerEvent(int resource); void nxagentHandleCollectGrabPointerEvent(int resource);
Bool nxagentCollectGrabPointerPredicate(Display *display, XEvent *X, XPointer ptr); Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr);
/* /*
* Used in Handlers.c to synchronize the agent with the remote X * Used in Handlers.c to synchronize the agent with the remote X
...@@ -702,7 +702,7 @@ static void nxagentToggleAutoGrab(void) ...@@ -702,7 +702,7 @@ static void nxagentToggleAutoGrab(void)
nxagentDisableAutoGrab(); nxagentDisableAutoGrab();
} }
static Bool nxagentExposurePredicate(Display *display, XEvent *event, XPointer window) static Bool nxagentExposurePredicate(Display *disp, XEvent *event, XPointer window)
{ {
/* /*
* Handle both Expose and ProcessedExpose events. The latters are * Handle both Expose and ProcessedExpose events. The latters are
...@@ -720,12 +720,12 @@ static Bool nxagentExposurePredicate(Display *display, XEvent *event, XPointer w ...@@ -720,12 +720,12 @@ static Bool nxagentExposurePredicate(Display *display, XEvent *event, XPointer w
} }
} }
static int nxagentAnyEventPredicate(Display *display, XEvent *event, XPointer parameter) static int nxagentAnyEventPredicate(Display *disp, XEvent *event, XPointer parameter)
{ {
return 1; return 1;
} }
int nxagentInputEventPredicate(Display *display, XEvent *event, XPointer parameter) int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter)
{ {
switch (event -> type) switch (event -> type)
{ {
...@@ -1238,7 +1238,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -1238,7 +1238,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource,
nxagentCollectGrabPointerPredicate); nxagentCollectGrabPointerPredicate);
ScreenPtr pScreen = nxagentScreen(X.xbutton.window); pScreen = nxagentScreen(X.xbutton.window);
viewportCursor = XCreateFontCursor(nxagentDisplay, XC_fleur); viewportCursor = XCreateFontCursor(nxagentDisplay, XC_fleur);
NXCollectGrabPointer(nxagentDisplay, resource, NXCollectGrabPointer(nxagentDisplay, resource,
...@@ -1380,7 +1380,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -1380,7 +1380,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
} }
case MotionNotify: case MotionNotify:
{ {
ScreenPtr pScreen = nxagentScreen(X.xmotion.window); pScreen = nxagentScreen(X.xmotion.window);
#ifdef TEST #ifdef TEST
fprintf(stderr, "%s: Going to handle new MotionNotify event.\n", __func__); fprintf(stderr, "%s: Going to handle new MotionNotify event.\n", __func__);
...@@ -1593,6 +1593,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already ...@@ -1593,6 +1593,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
{ {
for (int k = 0; k < 8; k++) for (int k = 0; k < 8; k++)
{ {
if (val & (1 << k))
{ {
#ifdef NXAGENT_FIXKEYS_DEBUG #ifdef NXAGENT_FIXKEYS_DEBUG
fprintf(stderr, "sending KeyRelease event for keycode: %x\n", fprintf(stderr, "sending KeyRelease event for keycode: %x\n",
...@@ -3882,7 +3883,7 @@ void nxagentDeactivatePointerGrab(void) ...@@ -3882,7 +3883,7 @@ void nxagentDeactivatePointerGrab(void)
} }
} }
Bool nxagentCollectGrabPointerPredicate(Display *display, XEvent *X, XPointer ptr) Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr)
{ {
return (X -> xclient.window == 0 && return (X -> xclient.window == 0 &&
X -> xclient.message_type == 0 && X -> xclient.message_type == 0 &&
......
...@@ -68,9 +68,9 @@ typedef int (*GetResourceFuncPtr)(Display*); ...@@ -68,9 +68,9 @@ typedef int (*GetResourceFuncPtr)(Display*);
int nxagentWaitForResource(GetResourceFuncPtr, PredicateFuncPtr); int nxagentWaitForResource(GetResourceFuncPtr, PredicateFuncPtr);
Bool nxagentCollectGrabPointerPredicate(Display *display, XEvent *X, XPointer ptr); Bool nxagentCollectGrabPointerPredicate(Display *disp, XEvent *X, XPointer ptr);
int nxagentInputEventPredicate(Display *display, XEvent *event, XPointer parameter); int nxagentInputEventPredicate(Display *disp, XEvent *event, XPointer parameter);
/* /*
* Enable and disable notification of * Enable and disable notification of
......
...@@ -941,7 +941,7 @@ void nxagentHandleCollectInputFocusEvent(int resource) ...@@ -941,7 +941,7 @@ void nxagentHandleCollectInputFocusEvent(int resource)
#endif #endif
} }
Bool nxagentCollectInputFocusPredicate(Display *display, XEvent *X, XPointer ptr) Bool nxagentCollectInputFocusPredicate(Display *disp, XEvent *X, XPointer ptr)
{ {
return (X -> xclient.window == 0 && return (X -> xclient.window == 0 &&
X -> xclient.message_type == 0 && X -> xclient.message_type == 0 &&
......
...@@ -203,7 +203,7 @@ void checkX2goAgent(void) ...@@ -203,7 +203,7 @@ void checkX2goAgent(void)
/* /*
* Called at X server's initialization. * Called at X server's initialization.
*/ */
void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) void InitOutput(ScreenInfo *scrInfo, int argc, char *argv[])
{ {
/* /*
* Print our pid and version information. * Print our pid and version information.
...@@ -329,13 +329,13 @@ FIXME: These variables, if not removed at all because have probably ...@@ -329,13 +329,13 @@ FIXME: These variables, if not removed at all because have probably
* Initialize the basic screen info. * Initialize the basic screen info.
*/ */
nxagentSetScreenInfo(screenInfo); nxagentSetScreenInfo(scrInfo);
/* /*
* Initialize pixmap formats for this screen. * Initialize pixmap formats for this screen.
*/ */
nxagentSetPixmapFormats(screenInfo); nxagentSetPixmapFormats(scrInfo);
/* /*
* Get our own privates' index. * Get our own privates' index.
...@@ -370,7 +370,7 @@ FIXME: These variables, if not removed at all because have probably ...@@ -370,7 +370,7 @@ FIXME: These variables, if not removed at all because have probably
AddScreen(nxagentOpenScreen, argc, argv); AddScreen(nxagentOpenScreen, argc, argv);
} }
nxagentNumScreens = screenInfo->numScreens; nxagentNumScreens = scrInfo->numScreens;
/* /*
* Initialize the GCs used by the synchronization put images. We do * Initialize the GCs used by the synchronization put images. We do
......
...@@ -647,9 +647,9 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2) ...@@ -647,9 +647,9 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2)
} }
} }
Bool nxagentDisconnectAllPixmaps(void) void nxagentDisconnectAllPixmaps(void)
{ {
int r = 1; int r;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to iterate through pixmap resources.\n"); fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to iterate through pixmap resources.\n");
...@@ -661,6 +661,7 @@ Bool nxagentDisconnectAllPixmaps(void) ...@@ -661,6 +661,7 @@ Bool nxagentDisconnectAllPixmaps(void)
* too. * too.
*/ */
r = 1;
FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentDisconnectPixmap, &r); FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentDisconnectPixmap, &r);
#ifdef WARNING #ifdef WARNING
...@@ -674,7 +675,7 @@ Bool nxagentDisconnectAllPixmaps(void) ...@@ -674,7 +675,7 @@ Bool nxagentDisconnectAllPixmaps(void)
#endif #endif
for (int i = 0, r = 1; i < MAXCLIENTS; r = 1, i++) for (int i = 0; i < MAXCLIENTS; i++)
{ {
if (clients[i]) if (clients[i])
{ {
...@@ -682,6 +683,7 @@ Bool nxagentDisconnectAllPixmaps(void) ...@@ -682,6 +683,7 @@ Bool nxagentDisconnectAllPixmaps(void)
fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to disconnect pixmaps of client [%d].\n", i); fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to disconnect pixmaps of client [%d].\n", i);
#endif #endif
r = 1;
FindClientResourcesByType(clients[i], RT_PIXMAP, nxagentDisconnectPixmap, &r); FindClientResourcesByType(clients[i], RT_PIXMAP, nxagentDisconnectPixmap, &r);
#ifdef WARNING #ifdef WARNING
...@@ -701,7 +703,7 @@ Bool nxagentDisconnectAllPixmaps(void) ...@@ -701,7 +703,7 @@ Bool nxagentDisconnectAllPixmaps(void)
fprintf(stderr, "nxagentDisconnectAllPixmaps: Pixmaps disconnection completed.\n"); fprintf(stderr, "nxagentDisconnectAllPixmaps: Pixmaps disconnection completed.\n");
#endif #endif
return r; return;
} }
void nxagentReconnectPixmap(void *p0, XID x1, void *p2) void nxagentReconnectPixmap(void *p0, XID x1, void *p2)
...@@ -837,7 +839,13 @@ Bool nxagentReconnectAllPixmaps(void *p0) ...@@ -837,7 +839,13 @@ Bool nxagentReconnectAllPixmaps(void *p0)
#endif #endif
for (int i = 0, result = 1; i < MAXCLIENTS; result = 1, i++) /*
* FIXME: This is a bit cumbersome: at the end of each iteration
* result will be reset to 1. Therefore at loop exit result will
* always be 1 meaning the whole function will always return 1...
*/
result = 1;
for (int i = 0; i < MAXCLIENTS; result = 1, i++)
{ {
if (clients[i] != NULL) if (clients[i] != NULL)
{ {
......
...@@ -132,7 +132,7 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, ...@@ -132,7 +132,7 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
void nxagentReconnectPixmap(void *p0, XID x1, void *p2); void nxagentReconnectPixmap(void *p0, XID x1, void *p2);
Bool nxagentReconnectAllPixmaps(void *p0); Bool nxagentReconnectAllPixmaps(void *p0);
void nxagentDisconnectPixmap(void *p0, XID x1, void* p2); void nxagentDisconnectPixmap(void *p0, XID x1, void* p2);
Bool nxagentDisconnectAllPixmaps(void); void nxagentDisconnectAllPixmaps(void);
int nxagentDestroyNewPixmapResourceType(void * p, XID id); int nxagentDestroyNewPixmapResourceType(void * p, XID id);
......
...@@ -83,7 +83,7 @@ extern Bool nxagentReconnectAllPicture(void*); ...@@ -83,7 +83,7 @@ extern Bool nxagentReconnectAllPicture(void*);
extern Bool nxagentDisconnectAllPicture(void); extern Bool nxagentDisconnectAllPicture(void);
extern Bool nxagentDisconnectAllWindows(void); extern Bool nxagentDisconnectAllWindows(void);
extern Bool nxagentDisconnectAllCursor(void); extern void nxagentDisconnectAllCursor(void);
extern Bool nxagentReconnectFailedFonts(void*); extern Bool nxagentReconnectFailedFonts(void*);
extern Bool nxagentInstallFontServerPath(void); extern Bool nxagentInstallFontServerPath(void);
...@@ -519,6 +519,7 @@ Bool nxagentReconnectSession(void) ...@@ -519,6 +519,7 @@ Bool nxagentReconnectSession(void)
nxagentEmptyBSPixmapList(); nxagentEmptyBSPixmapList();
/* FIXME: nxagentReconnectAllPixmaps will always return 1 */
if (nxagentReconnectAllPixmaps(reconnectLossyLevel[PIXMAP_STEP]) == 0) if (nxagentReconnectAllPixmaps(reconnectLossyLevel[PIXMAP_STEP]) == 0)
{ {
failedStep = PIXMAP_STEP; failedStep = PIXMAP_STEP;
......
...@@ -236,7 +236,7 @@ int nxagentBitsPerPixel(int depth) ...@@ -236,7 +236,7 @@ int nxagentBitsPerPixel(int depth)
else return 32; else return 32;
} }
void nxagentSetScreenInfo(ScreenInfo *screenInfo) void nxagentSetScreenInfo(ScreenInfo *scrInfo)
{ {
/* /*
* Setup global screen info parameters. In the Xnest * Setup global screen info parameters. In the Xnest
...@@ -248,34 +248,34 @@ void nxagentSetScreenInfo(ScreenInfo *screenInfo) ...@@ -248,34 +248,34 @@ void nxagentSetScreenInfo(ScreenInfo *screenInfo)
* *
* From a standard implementation: * From a standard implementation:
* *
* screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; * scrInfo->imageByteOrder = IMAGE_BYTE_ORDER;
* screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; * scrInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
* screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; * scrInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
* screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; * scrInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
* *
* From Xnest implementation: * From Xnest implementation:
* *
* screenInfo -> imageByteOrder = ImageByteOrder(nxagentDisplay); * scrInfo -> imageByteOrder = ImageByteOrder(nxagentDisplay);
* screenInfo -> bitmapScanlineUnit = BitmapUnit(nxagentDisplay); * scrInfo -> bitmapScanlineUnit = BitmapUnit(nxagentDisplay);
* screenInfo -> bitmapScanlinePad = BitmapPad(nxagentDisplay); * scrInfo -> bitmapScanlinePad = BitmapPad(nxagentDisplay);
* screenInfo -> bitmapBitOrder = BitmapBitOrder(nxagentDisplay); * scrInfo -> bitmapBitOrder = BitmapBitOrder(nxagentDisplay);
*/ */
screenInfo -> imageByteOrder = IMAGE_BYTE_ORDER; scrInfo -> imageByteOrder = IMAGE_BYTE_ORDER;
screenInfo -> bitmapScanlinePad = BITMAP_SCANLINE_PAD; scrInfo -> bitmapScanlinePad = BITMAP_SCANLINE_PAD;
screenInfo -> bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; scrInfo -> bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
screenInfo -> bitmapBitOrder = BITMAP_BIT_ORDER; scrInfo -> bitmapBitOrder = BITMAP_BIT_ORDER;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSetScreenInfo: Server image order is [%d] bitmap order is [%d].\n", fprintf(stderr, "nxagentSetScreenInfo: Server image order is [%d] bitmap order is [%d].\n",
screenInfo -> imageByteOrder, screenInfo -> bitmapBitOrder); scrInfo -> imageByteOrder, scrInfo -> bitmapBitOrder);
fprintf(stderr, "nxagentSetScreenInfo: Server scanline unit is [%d] scanline pad is [%d].\n", fprintf(stderr, "nxagentSetScreenInfo: Server scanline unit is [%d] scanline pad is [%d].\n",
screenInfo -> bitmapScanlineUnit, screenInfo -> bitmapScanlinePad); scrInfo -> bitmapScanlineUnit, scrInfo -> bitmapScanlinePad);
#endif #endif
} }
void nxagentSetPixmapFormats(ScreenInfo *screenInfo) void nxagentSetPixmapFormats(ScreenInfo *scrInfo)
{ {
/* /*
* Formats are created with no care of which are supported * Formats are created with no care of which are supported
...@@ -284,19 +284,19 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo) ...@@ -284,19 +284,19 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo)
* of session from a display to another. * of session from a display to another.
*/ */
screenInfo -> numPixmapFormats = nxagentNumPixmapFormats; scrInfo -> numPixmapFormats = nxagentNumPixmapFormats;
for (int i = 0; i < nxagentNumPixmapFormats; i++) for (int i = 0; i < nxagentNumPixmapFormats; i++)
{ {
screenInfo -> formats[i].depth = nxagentPixmapFormats[i].depth; scrInfo -> formats[i].depth = nxagentPixmapFormats[i].depth;
screenInfo -> formats[i].bitsPerPixel = nxagentPixmapFormats[i].bits_per_pixel; scrInfo -> formats[i].bitsPerPixel = nxagentPixmapFormats[i].bits_per_pixel;
screenInfo -> formats[i].scanlinePad = nxagentPixmapFormats[i].scanline_pad; scrInfo -> formats[i].scanlinePad = nxagentPixmapFormats[i].scanline_pad;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentSetPixmapFormats: Set format at index [%d] to depth [%d] " fprintf(stderr, "nxagentSetPixmapFormats: Set format at index [%d] to depth [%d] "
"bits per pixel [%d] scanline pad [%d].\n", i, "bits per pixel [%d] scanline pad [%d].\n", i,
screenInfo -> formats[i].depth, screenInfo -> formats[i].bitsPerPixel, scrInfo -> formats[i].depth, scrInfo -> formats[i].bitsPerPixel,
screenInfo -> formats[i].scanlinePad); scrInfo -> formats[i].scanlinePad);
#endif #endif
} }
} }
...@@ -2950,9 +2950,9 @@ int nxagentShadowSendUpdates(int *suspended) ...@@ -2950,9 +2950,9 @@ int nxagentShadowSendUpdates(int *suspended)
return 1; return 1;
} }
int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr, int nxagentShadowPoll(PixmapPtr shadowPixmapPtr, GCPtr shadowGCPtr,
unsigned char nxagentShadowDepth, int nxagentShadowWidth, unsigned char shadowDepth, int shadowWidth,
int nxagentShadowHeight, char *nxagentShadowBuffer, int *changed, int *suspended) int shadowHeight, char *shadowBuffer, int *changed, int *suspended)
{ {
RegionRec updateRegion; RegionRec updateRegion;
RegionRec tempRegion; RegionRec tempRegion;
...@@ -2977,7 +2977,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr ...@@ -2977,7 +2977,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
BoxRec *pBox = (BoxRec *)ptBox; BoxRec *pBox = (BoxRec *)ptBox;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentShadowPoll: nRects[%ld], pBox[%p] depth[%d].\n", numRects, (void *) pBox, nxagentShadowDepth); fprintf(stderr, "nxagentShadowPoll: nRects[%ld], pBox[%p] depth[%d].\n", numRects, (void *) pBox, shadowDepth);
#endif #endif
for (int n = 0; n < numRects; n++) for (int n = 0; n < numRects; n++)
...@@ -2994,7 +2994,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr ...@@ -2994,7 +2994,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
unsigned int width = pBox[n].y1 - pBox[n].x1;/* y1 = x2 */ unsigned int width = pBox[n].y1 - pBox[n].x1;/* y1 = x2 */
unsigned int height = y2 - pBox[n].x2; /* x2 = y1 */ unsigned int height = y2 - pBox[n].x2; /* x2 = y1 */
if((x + width) > nxagentShadowWidth || (y + height) > nxagentShadowHeight) if((x + width) > shadowWidth || (y + height) > shadowHeight)
{ {
/* /*
* Out of bounds. Maybe a resize of the master session is going on. * Out of bounds. Maybe a resize of the master session is going on.
...@@ -3028,8 +3028,8 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr ...@@ -3028,8 +3028,8 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
for (int c = 0; c + y < y2; c++) for (int c = 0; c + y < y2; c++)
{ {
memcpy(tBuffer, nxagentShadowBuffer + x * nxagentBppMaster + memcpy(tBuffer, shadowBuffer + x * nxagentBppMaster +
(y + c) * nxagentShadowWidth * nxagentBppMaster, line); (y + c) * shadowWidth * nxagentBppMaster, line);
tBuffer += line; tBuffer += line;
...@@ -3042,8 +3042,8 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr ...@@ -3042,8 +3042,8 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
nxagentShadowAdaptDepth(width, height, line, &tBuffer); nxagentShadowAdaptDepth(width, height, line, &tBuffer);
} }
fbPutImage(nxagentVirtualDrawable((DrawablePtr)nxagentShadowPixmapPtr), nxagentShadowGCPtr, fbPutImage(nxagentVirtualDrawable((DrawablePtr)shadowPixmapPtr), shadowGCPtr,
nxagentShadowDepth, x, y, width, height, 0, ZPixmap, tBuffer); shadowDepth, x, y, width, height, 0, ZPixmap, tBuffer);
BoxRec box = {.x1 = x, .x2 = x + width, .y1 = y, .y2 = y + height}; BoxRec box = {.x1 = x, .x2 = x + width, .y1 = y, .y2 = y + height};
......
...@@ -780,7 +780,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable) ...@@ -780,7 +780,7 @@ void nxagentWaitDrawable(DrawablePtr pDrawable)
} }
} }
static Bool nxagentCommitSplitPredicate(Display *display, XEvent *event, XPointer ptr) static Bool nxagentCommitSplitPredicate(Display *disp, XEvent *event, XPointer ptr)
{ {
return (event -> type == ClientMessage && return (event -> type == ClientMessage &&
event -> xclient.data.l[0] == NXCommitSplitNotify && event -> xclient.data.l[0] == NXCommitSplitNotify &&
...@@ -820,7 +820,7 @@ void nxagentWaitCommitEvent(int resource) ...@@ -820,7 +820,7 @@ void nxagentWaitCommitEvent(int resource)
} }
} }
static Bool nxagentWaitSplitPredicate(Display *display, XEvent *event, XPointer ptr) static Bool nxagentWaitSplitPredicate(Display *disp, XEvent *event, XPointer ptr)
{ {
return (event -> type == ClientMessage && return (event -> type == ClientMessage &&
(event -> xclient.data.l[0] == NXNoSplitNotify || (event -> xclient.data.l[0] == NXNoSplitNotify ||
......
...@@ -85,7 +85,6 @@ int CleanXYImage(XImage *image) ...@@ -85,7 +85,6 @@ int CleanXYImage(XImage *image)
int CleanZImage(XImage *image) int CleanZImage(XImage *image)
{ {
unsigned int bytesToClean; unsigned int bytesToClean;
unsigned int j;
unsigned int imageLength; unsigned int imageLength;
#ifdef TEST #ifdef TEST
...@@ -105,8 +104,6 @@ int CleanZImage(XImage *image) ...@@ -105,8 +104,6 @@ int CleanZImage(XImage *image)
* as fully transparent. * as fully transparent.
*/ */
register int i;
bytesToClean = image -> bytes_per_line * image -> height; bytesToClean = image -> bytes_per_line * image -> height;
#ifdef DEBUG #ifdef DEBUG
...@@ -118,14 +115,14 @@ int CleanZImage(XImage *image) ...@@ -118,14 +115,14 @@ int CleanZImage(XImage *image)
if (image -> byte_order == LSBFirst) if (image -> byte_order == LSBFirst)
{ {
for (i = 3; i < bytesToClean; i += 4) for (int i = 3; i < bytesToClean; i += 4)
{ {
((unsigned char *) image -> data)[i] = 0x00; ((unsigned char *) image -> data)[i] = 0x00;
} }
} }
else else
{ {
for (i = 0; i < bytesToClean; i += 4) for (int i = 0; i < bytesToClean; i += 4)
{ {
((unsigned char *) image -> data)[i] = 0x00; ((unsigned char *) image -> data)[i] = 0x00;
} }
...@@ -138,14 +135,12 @@ int CleanZImage(XImage *image) ...@@ -138,14 +135,12 @@ int CleanZImage(XImage *image)
case 16: case 16:
case 8: case 8:
{ {
register int i, j;
bytesToClean = image -> bytes_per_line - bytesToClean = image -> bytes_per_line -
((image -> width * image -> bits_per_pixel) >> 3); ((image -> width * image -> bits_per_pixel) >> 3);
for (i = 1; i <= image -> height; i++) for (int i = 1; i <= image -> height; i++)
{ {
for (j = bytesToClean; j > 0; j--) for (int j = bytesToClean; j > 0; j--)
{ {
((unsigned char *) image -> data)[(i * image -> bytes_per_line) - j] = 0x00; ((unsigned char *) image -> data)[(i * image -> bytes_per_line) - j] = 0x00;
} }
...@@ -171,7 +166,7 @@ int CleanZImage(XImage *image) ...@@ -171,7 +166,7 @@ int CleanZImage(XImage *image)
bytesToClean = imageLength % 4; bytesToClean = imageLength % 4;
for (j = 0; j < bytesToClean; j++) for (int j = 0; j < bytesToClean; j++)
{ {
((unsigned char *)image -> data)[(imageLength + j)] = 0x00; ((unsigned char *)image -> data)[(imageLength + j)] = 0x00;
} }
...@@ -189,7 +184,6 @@ int CleanZImage(XImage *image) ...@@ -189,7 +184,6 @@ int CleanZImage(XImage *image)
int CopyAndCleanImage(XImage *src_image, XImage *dst_image) int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
register long data_size; register long data_size;
register int i;
data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; data_size = (src_image -> bytes_per_line * src_image -> height) >> 2;
...@@ -212,7 +206,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -212,7 +206,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
mask = 0x00ffffff; mask = 0x00ffffff;
} }
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i] & mask; ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i] & mask;
} }
...@@ -224,7 +218,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -224,7 +218,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
unsigned int bytes_to_clean; unsigned int bytes_to_clean;
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i]; ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i];
} }
...@@ -236,7 +230,6 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -236,7 +230,6 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
register unsigned int mask = 0xffffffff; register unsigned int mask = 0xffffffff;
register int line_size; register int line_size;
register int i;
line_size = dst_image -> bytes_per_line >> 2; line_size = dst_image -> bytes_per_line >> 2;
...@@ -249,7 +242,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -249,7 +242,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
mask = mask >> (bytes_to_clean << 3); mask = mask >> (bytes_to_clean << 3);
} }
for (i = 0; i < dst_image -> height;) for (int i = 0; i < dst_image -> height;)
{ {
((unsigned char *)dst_image -> data)[(++i * line_size) -1] &= mask; ((unsigned char *)dst_image -> data)[(++i * line_size) -1] &= mask;
} }
...@@ -261,7 +254,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -261,7 +254,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
case 15: case 15:
case 16: case 16:
{ {
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i];
} }
...@@ -270,7 +263,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -270,7 +263,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
{ {
int card32_per_line = dst_image -> bytes_per_line >> 2; int card32_per_line = dst_image -> bytes_per_line >> 2;
for (i = 0; i < dst_image -> height;) for (int i = 0; i < dst_image -> height;)
{ {
((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= 0x0000ffff; ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= 0x0000ffff;
} }
...@@ -313,7 +306,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -313,7 +306,7 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
} }
} }
for (i = 0; i < data_size; i++) for (int i = 0; i < data_size; i++)
{ {
((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i];
} }
...@@ -321,11 +314,10 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image) ...@@ -321,11 +314,10 @@ int CopyAndCleanImage(XImage *src_image, XImage *dst_image)
if (mask) if (mask)
{ {
int card32_per_line; int card32_per_line;
int i;
card32_per_line = dst_image -> bytes_per_line >> 2; card32_per_line = dst_image -> bytes_per_line >> 2;
for (i = 0; i < dst_image -> height; i++) for (int i = 0; i < dst_image -> height; i++)
{ {
((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= mask; ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= mask;
} }
......
...@@ -666,7 +666,7 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst) ...@@ -666,7 +666,7 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
{ {
if ( (((1<<depth)-1)&planeMask) != (1<<depth)-1 ) if ( (((1<<depth)-1)&planeMask) != (1<<depth)-1 )
{ {
xPoint pt; xPoint xpt;
pGC = GetScratchGC(depth, pDraw->pScreen); pGC = GetScratchGC(depth, pDraw->pScreen);
if (!pGC) if (!pGC)
...@@ -683,9 +683,9 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst) ...@@ -683,9 +683,9 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
* Clear the pixmap before doing anything else * Clear the pixmap before doing anything else
*/ */
ValidateGC((DrawablePtr)pPixmap, pGC); ValidateGC((DrawablePtr)pPixmap, pGC);
pt.x = pt.y = 0; xpt.x = xpt.y = 0;
width = w; width = w;
(*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &pt, &width, (*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &xpt, &width,
TRUE); TRUE);
/* alu is already GXCopy */ /* alu is already GXCopy */
......
...@@ -462,12 +462,12 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) ...@@ -462,12 +462,12 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
ysizes[index] * sizeof(int)); ysizes[index] * sizeof(int));
if (!newpoints || !newwidths) if (!newpoints || !newwidths)
{ {
int i; int k;
for (i = 0; i < ylength; i++) for (k = 0; k < ylength; k++)
{ {
free (yspans[i].points); free (yspans[k].points);
free (yspans[i].widths); free (yspans[k].widths);
} }
free (yspans); free (yspans);
free (ysizes); free (ysizes);
...@@ -494,8 +494,6 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) ...@@ -494,8 +494,6 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
widths = (int *) malloc(count * sizeof(int)); widths = (int *) malloc(count * sizeof(int));
if (!points || !widths) if (!points || !widths)
{ {
int i;
for (i = 0; i < ylength; i++) for (i = 0; i < ylength; i++)
{ {
free (yspans[i].points); free (yspans[i].points);
......
...@@ -61,7 +61,7 @@ static Bool authFromXDMCP; ...@@ -61,7 +61,7 @@ static Bool authFromXDMCP;
static XdmAuthKeyRec privateKey; static XdmAuthKeyRec privateKey;
static char XdmAuthenticationName[] = "XDM-AUTHENTICATION-1"; static char XdmAuthenticationName[] = "XDM-AUTHENTICATION-1";
#define XdmAuthenticationNameLen (sizeof XdmAuthenticationName - 1) #define XdmAuthenticationNameLen (sizeof XdmAuthenticationName - 1)
static XdmAuthKeyRec rho; static XdmAuthKeyRec global_rho;
static Bool static Bool
XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData, XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
...@@ -76,7 +76,7 @@ XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData, ...@@ -76,7 +76,7 @@ XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData,
return FALSE; return FALSE;
incoming = (XdmAuthKeyPtr) incomingData->data; incoming = (XdmAuthKeyPtr) incomingData->data;
XdmcpDecrementKey (incoming); XdmcpDecrementKey (incoming);
return XdmcpCompareKeys (incoming, &rho); return XdmcpCompareKeys (incoming, &global_rho);
} }
return FALSE; return FALSE;
} }
...@@ -89,7 +89,7 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData, ...@@ -89,7 +89,7 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
outgoingData->data = 0; outgoingData->data = 0;
if (packet_type == REQUEST) { if (packet_type == REQUEST) {
if (XdmcpAllocARRAY8 (outgoingData, 8)) if (XdmcpAllocARRAY8 (outgoingData, 8))
XdmcpWrap ((unsigned char *)&rho, (unsigned char *)&privateKey, XdmcpWrap ((unsigned char *)&global_rho, (unsigned char *)&privateKey,
outgoingData->data, 8); outgoingData->data, 8);
} }
return TRUE; return TRUE;
...@@ -152,10 +152,10 @@ XdmAuthenticationInit (char *cookie, int cookie_len) ...@@ -152,10 +152,10 @@ XdmAuthenticationInit (char *cookie, int cookie_len)
cookie_len = 7; cookie_len = 7;
memmove (privateKey.data + 1, cookie, cookie_len); memmove (privateKey.data + 1, cookie, cookie_len);
} }
XdmcpGenerateKey (&rho); XdmcpGenerateKey (&global_rho);
XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen, XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen,
(char *)&rho, (char *)&global_rho,
sizeof (rho), sizeof (global_rho),
(ValidatorFunc)XdmAuthenticationValidator, (ValidatorFunc)XdmAuthenticationValidator,
(GeneratorFunc)XdmAuthenticationGenerator, (GeneratorFunc)XdmAuthenticationGenerator,
(AddAuthorFunc)XdmAuthenticationAddAuth); (AddAuthorFunc)XdmAuthenticationAddAuth);
...@@ -340,7 +340,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id) ...@@ -340,7 +340,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id)
{ {
/* R5 xdm sent bogus authorization data in the accept packet, /* R5 xdm sent bogus authorization data in the accept packet,
* but we can recover */ * but we can recover */
rho_bits = rho.data; rho_bits = global_rho.data;
key_bits = (unsigned char *) data; key_bits = (unsigned char *) data;
key_bits[0] = '\0'; key_bits[0] = '\0';
} }
...@@ -353,7 +353,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id) ...@@ -353,7 +353,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id)
break; break;
#ifdef XDMCP #ifdef XDMCP
case 8: /* auth from XDMCP is 8 bytes long */ case 8: /* auth from XDMCP is 8 bytes long */
rho_bits = rho.data; rho_bits = global_rho.data;
key_bits = (unsigned char *) data; key_bits = (unsigned char *) data;
break; break;
#endif #endif
...@@ -477,7 +477,7 @@ XdmRemoveCookie (unsigned short data_length, char *data) ...@@ -477,7 +477,7 @@ XdmRemoveCookie (unsigned short data_length, char *data)
break; break;
#ifdef XDMCP #ifdef XDMCP
case 8: case 8:
rho_bits = &rho; rho_bits = &global_rho;
key_bits = (XdmAuthKeyPtr) data; key_bits = (XdmAuthKeyPtr) data;
break; break;
#endif #endif
......
...@@ -679,15 +679,15 @@ XdmcpBlockHandler( ...@@ -679,15 +679,15 @@ XdmcpBlockHandler(
struct timeval **wt, struct timeval **wt,
void * pReadmask) void * pReadmask)
{ {
fd_set *LastSelectMask = (fd_set*)pReadmask; fd_set *last_select_mask = (fd_set*)pReadmask;
CARD32 millisToGo; CARD32 millisToGo;
if (state == XDM_OFF) if (state == XDM_OFF)
return; return;
FD_SET(xdmcpSocket, LastSelectMask); FD_SET(xdmcpSocket, last_select_mask);
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
if (xdmcpSocket6 >= 0) if (xdmcpSocket6 >= 0)
FD_SET(xdmcpSocket6, LastSelectMask); FD_SET(xdmcpSocket6, last_select_mask);
#endif #endif
if (timeOutTime == 0) if (timeOutTime == 0)
return; return;
...@@ -710,7 +710,7 @@ XdmcpWakeupHandler( ...@@ -710,7 +710,7 @@ XdmcpWakeupHandler(
int i, int i,
void * pReadmask) void * pReadmask)
{ {
fd_set* LastSelectMask = (fd_set*)pReadmask; fd_set* last_select_mask = (fd_set*)pReadmask;
#ifdef NX_TRANS_SOCKET #ifdef NX_TRANS_SOCKET
...@@ -723,16 +723,16 @@ XdmcpWakeupHandler( ...@@ -723,16 +723,16 @@ XdmcpWakeupHandler(
return; return;
if (i > 0) if (i > 0)
{ {
if (FD_ISSET(xdmcpSocket, LastSelectMask)) if (FD_ISSET(xdmcpSocket, last_select_mask))
{ {
receive_packet(xdmcpSocket); receive_packet(xdmcpSocket);
FD_CLR(xdmcpSocket, LastSelectMask); FD_CLR(xdmcpSocket, last_select_mask);
} }
#if defined(IPv6) && defined(AF_INET6) #if defined(IPv6) && defined(AF_INET6)
if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, LastSelectMask)) if (xdmcpSocket6 >= 0 && FD_ISSET(xdmcpSocket6, last_select_mask))
{ {
receive_packet(xdmcpSocket6); receive_packet(xdmcpSocket6);
FD_CLR(xdmcpSocket6, LastSelectMask); FD_CLR(xdmcpSocket6, last_select_mask);
} }
#endif #endif
} }
...@@ -757,12 +757,12 @@ static void ...@@ -757,12 +757,12 @@ static void
XdmcpSelectHost( XdmcpSelectHost(
struct sockaddr *host_sockaddr, struct sockaddr *host_sockaddr,
int host_len, int host_len,
ARRAY8Ptr AuthenticationName) ARRAY8Ptr auth_name)
{ {
state = XDM_START_CONNECTION; state = XDM_START_CONNECTION;
memmove(&req_sockaddr, host_sockaddr, host_len); memmove(&req_sockaddr, host_sockaddr, host_len);
req_socklen = host_len; req_socklen = host_len;
XdmcpSetAuthentication (AuthenticationName); XdmcpSetAuthentication (auth_name);
send_packet(); send_packet();
} }
...@@ -777,11 +777,11 @@ static void ...@@ -777,11 +777,11 @@ static void
XdmcpAddHost( XdmcpAddHost(
struct sockaddr *from, struct sockaddr *from,
int fromlen, int fromlen,
ARRAY8Ptr AuthenticationName, ARRAY8Ptr auth_name,
ARRAY8Ptr hostname, ARRAY8Ptr hostname,
ARRAY8Ptr status) ARRAY8Ptr status)
{ {
XdmcpSelectHost(from, fromlen, AuthenticationName); XdmcpSelectHost(from, fromlen, auth_name);
} }
/* /*
...@@ -1066,8 +1066,6 @@ send_query_msg(void) ...@@ -1066,8 +1066,6 @@ send_query_msg(void)
XdmcpWriteARRAYofARRAY8 (&buffer, &AuthenticationNames); XdmcpWriteARRAYofARRAY8 (&buffer, &AuthenticationNames);
if (broadcast) if (broadcast)
{ {
int i;
for (i = 0; i < NumBroadcastAddresses; i++) for (i = 0; i < NumBroadcastAddresses; i++)
XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &BroadcastAddresses[i], XdmcpFlush (xdmcpSocket, &buffer, (XdmcpNetaddr) &BroadcastAddresses[i],
sizeof (struct sockaddr_in)); sizeof (struct sockaddr_in));
......
...@@ -136,7 +136,6 @@ char tmpname[PATH_MAX]; ...@@ -136,7 +136,6 @@ char tmpname[PATH_MAX];
file= list->pattern[what]; file= list->pattern[what];
map= strrchr(file,'('); map= strrchr(file,'(');
if (map!=NULL) { if (map!=NULL) {
char *tmp;
map++; map++;
tmp= strrchr(map,')'); tmp= strrchr(map,')');
if ((tmp==NULL)||(tmp[1]!='\0')) { if ((tmp==NULL)||(tmp[1]!='\0')) {
......
...@@ -876,21 +876,21 @@ XkbWriteKeyTypes( XkbDescPtr xkb, ...@@ -876,21 +876,21 @@ XkbWriteKeyTypes( XkbDescPtr xkb,
buf= (char *)&wire[1]; buf= (char *)&wire[1];
if (wire->nMapEntries>0) { if (wire->nMapEntries>0) {
xkbKTMapEntryWireDesc * wire; xkbKTMapEntryWireDesc * ewire;
XkbKTMapEntryPtr entry; XkbKTMapEntryPtr entry;
wire= (xkbKTMapEntryWireDesc *)buf; ewire= (xkbKTMapEntryWireDesc *)buf;
entry= type->map; entry= type->map;
for (n=0;n<type->map_count;n++,wire++,entry++) { for (n=0;n<type->map_count;n++,ewire++,entry++) {
wire->active= entry->active; ewire->active= entry->active;
wire->mask= entry->mods.mask; ewire->mask= entry->mods.mask;
wire->level= entry->level; ewire->level= entry->level;
wire->realMods= entry->mods.real_mods; ewire->realMods= entry->mods.real_mods;
wire->virtualMods= entry->mods.vmods; ewire->virtualMods= entry->mods.vmods;
if (client->swapped) { if (client->swapped) {
swaps(&wire->virtualMods); swaps(&ewire->virtualMods);
} }
} }
buf= (char *)wire; buf= (char *)ewire;
if (type->preserve!=NULL) { if (type->preserve!=NULL) {
xkbModsWireDesc * pwire; xkbModsWireDesc * pwire;
XkbModsPtr preserve; XkbModsPtr preserve;
...@@ -2598,7 +2598,6 @@ ProcXkbSetCompatMap(ClientPtr client) ...@@ -2598,7 +2598,6 @@ ProcXkbSetCompatMap(ClientPtr client)
} }
if (stuff->groups!=0) { if (stuff->groups!=0) {
register unsigned i,bit;
xkbModsWireDesc *wire = (xkbModsWireDesc *)data; xkbModsWireDesc *wire = (xkbModsWireDesc *)data;
for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) { for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
if (stuff->groups&bit) { if (stuff->groups&bit) {
......
...@@ -1040,10 +1040,10 @@ _XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi, ...@@ -1040,10 +1040,10 @@ _XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi,
unsigned keycode, unsigned keycode,
XkbAction * pAction) XkbAction * pAction)
{ {
DeviceIntPtr dev;
int button;
if (filter->keycode==0) { /* initial press */ if (filter->keycode==0) { /* initial press */
DeviceIntPtr dev;
int button;
dev= _XkbLookupButtonDevice(pAction->devbtn.device,NULL); dev= _XkbLookupButtonDevice(pAction->devbtn.device,NULL);
if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice())) if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice()))
return 1; return 1;
...@@ -1081,7 +1081,8 @@ int button; ...@@ -1081,7 +1081,8 @@ int button;
} }
} }
else if (filter->keycode==keycode) { else if (filter->keycode==keycode) {
int button; DeviceIntPtr dev;
int button;
filter->active= 0; filter->active= 0;
dev= _XkbLookupButtonDevice(filter->upAction.devbtn.device,NULL); dev= _XkbLookupButtonDevice(filter->upAction.devbtn.device,NULL);
......
...@@ -630,11 +630,9 @@ XkbSrvLedInfoPtr sli; ...@@ -630,11 +630,9 @@ XkbSrvLedInfoPtr sli;
/* optimization to check for most common case */ /* optimization to check for most common case */
if (((class==XkbDfltXIClass)&&(id==XkbDfltXIId))&&(dev->kbdfeed)) { if (((class==XkbDfltXIClass)&&(id==XkbDfltXIId))&&(dev->kbdfeed)) {
XkbSrvLedInfoPtr sli;
sli= dev->kbdfeed->xkb_sli;
if (dev->kbdfeed->xkb_sli==NULL) { if (dev->kbdfeed->xkb_sli==NULL) {
sli= XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts); dev->kbdfeed->xkb_sli=
dev->kbdfeed->xkb_sli= sli; XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts);
} }
return dev->kbdfeed->xkb_sli; return dev->kbdfeed->xkb_sli;
} }
......
...@@ -117,12 +117,12 @@ unsigned ndx; ...@@ -117,12 +117,12 @@ unsigned ndx;
return; return;
} }
if ( rg->currentDown!=0 ) { if ( rg->currentDown!=0 ) {
int key = xE->u.u.detail; int tmpkey = xE->u.u.detail;
xE->u.u.type= KeyRelease; xE->u.u.type= KeyRelease;
xE->u.u.detail= rg->currentDown; xE->u.u.detail= rg->currentDown;
XkbHandleActions(keybd,keybd,xE,count); XkbHandleActions(keybd,keybd,xE,count);
xE->u.u.type= KeyPress; xE->u.u.type= KeyPress;
xE->u.u.detail= key; xE->u.u.detail= tmpkey;
} }
rg->currentDown= key; rg->currentDown= key;
} }
......
...@@ -1271,7 +1271,6 @@ char buf[256],*tmp; ...@@ -1271,7 +1271,6 @@ char buf[256],*tmp;
} }
else if (type==XkbKB_RadioGroup) { else if (type==XkbKB_RadioGroup) {
int g; int g;
char *tmp;
g= ((behavior->data)&(~XkbKB_RGAllowNone))+1; g= ((behavior->data)&(~XkbKB_RGAllowNone))+1;
if (XkbKB_RGAllowNone&behavior->data) { if (XkbKB_RGAllowNone&behavior->data) {
sprintf(buf,"allowNone,"); sprintf(buf,"allowNone,");
......
...@@ -636,7 +636,6 @@ XkbDescPtr xkb; ...@@ -636,7 +636,6 @@ XkbDescPtr xkb;
bzero((char *)typeName,XkbNumKbdGroups*sizeof(Atom)); bzero((char *)typeName,XkbNumKbdGroups*sizeof(Atom));
bzero((char *)type,XkbNumKbdGroups*sizeof(XkbKeyTypePtr)); bzero((char *)type,XkbNumKbdGroups*sizeof(XkbKeyTypePtr));
if (wireMap.flags&XkmKeyHasTypes) { if (wireMap.flags&XkmKeyHasTypes) {
register int g;
for (g=0;g<XkbNumKbdGroups;g++) { for (g=0;g<XkbNumKbdGroups;g++) {
if ((wireMap.flags&(1<<g))&& if ((wireMap.flags&(1<<g))&&
((tmp=XkmGetCountedString(file,buf,100))>0)) { ((tmp=XkmGetCountedString(file,buf,100))>0)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment