aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Rootless.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Rootless.c110
1 files changed, 48 insertions, 62 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
index 82ec14fe9..c2611c194 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
@@ -120,12 +120,10 @@ static void nxagentPrintRootlessTopLevelWindowMap(void);
void nxagentPrintRootlessTopLevelWindowMap(void)
{
- int i;
-
fprintf(stderr, "nxagentPrintRootlessTopLevelWindowMap: Map size is [%d] num of entry [%d].\n",
topLevelParentMap.size, topLevelParentMap.next);
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
fprintf(stderr, "nxagentPrintRootlessTopLevelWindowMap: [%d] pWin at [%p] XID at [%ld].\n",
i, (void *) topLevelParentMap.elt[i].pWin, (long int) topLevelParentMap.elt[i].xid);
@@ -136,9 +134,7 @@ void nxagentPrintRootlessTopLevelWindowMap(void)
void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w)
{
- int i;
-
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
if (topLevelParentMap.elt[i].pWin == pWin)
{
@@ -181,9 +177,7 @@ void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w)
WindowPtr nxagentRootlessTopLevelWindow(Window w)
{
- int i;
-
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
if (w == topLevelParentMap.elt[i].xid)
{
@@ -196,9 +190,7 @@ WindowPtr nxagentRootlessTopLevelWindow(Window w)
void nxagentRootlessDelTopLevelWindow(WindowPtr pWin)
{
- int i;
-
- for (i = 0; i < topLevelParentMap.next; i++)
+ for (int i = 0; i < topLevelParentMap.next; i++)
{
if (pWin == topLevelParentMap.elt[i].pWin)
{
@@ -485,7 +477,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
{
#ifdef TEST
fprintf(stderr, "nxagentExportProperty: WARNING! Ignored ChangeProperty "
- "on %swindow %lx property %s type %s nUnits %ld format %d\n",
+ "on %swindow [0x%lx] property [%s] type [%s] nUnits [%ld] format [%d]\n",
nxagentWindowTopLevel(pWin) ? "toplevel " : "", nxagentWindow(pWin),
validateString(propertyS), validateString(typeS), nUnits, format);
#endif
@@ -506,7 +498,6 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
/* FIXME: is it okay here to ignore malloc fails? */
unsigned long *buffer = malloc(nUnits * sizeof(*buffer));
int *input = value;
- int i;
if (buffer)
{
@@ -514,7 +505,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
export = True;
output = (char*) buffer;
- for (i = 0; i < nUnits; i++)
+ for (int i = 0; i < nUnits; i++)
{
buffer[i] = input[i];
}
@@ -565,8 +556,8 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
propHints.flags &= ~IconPixmapHint;
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap %x from hint "
- "exporting property %s type %s on window %p.\n",
+ fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap [0x%x] from hint "
+ "exporting property [%s] type [%s] on window [%p].\n",
(unsigned int) wmHints.icon_pixmap, propertyS, typeS,
(void *) pWin);
#endif
@@ -587,8 +578,8 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
propHints.flags &= ~IconWindowHint;
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window %x from hint "
- "exporting property %s type %s on window %p.\n",
+ fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window [0x%x] from hint "
+ "exporting property [%s] type [%s] on window [%p].\n",
(unsigned int) wmHints.icon_window, propertyS, typeS,
(void *) pWin);
#endif
@@ -609,8 +600,8 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
propHints.flags &= ~IconMaskHint;
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask %x from hint "
- "exporting property %s type %s on window %p.\n",
+ fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask [0x%x] from hint "
+ "exporting property [%s] type [%s] on window [%p].\n",
(unsigned int) wmHints.icon_mask, propertyS, typeS,
(void *) pWin);
#endif
@@ -631,8 +622,8 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
propHints.flags &= ~WindowGroupHint;
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group %x from hint "
- "exporting property %s type %s on window %p.\n",
+ fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group [0x%x] from hint "
+ "exporting property [%s] type [%s] on window [%p].\n",
(unsigned int) wmHints.window_group, propertyS, typeS,
(void *) pWin);
#endif
@@ -644,13 +635,12 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
XlibAtom *atoms = malloc(nUnits * sizeof(*atoms));
Atom *input = value;
const char *atomName = NULL;
- int i;
int j = 0;
if (!atoms)
{
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s'- bailing out.\n", typeS);
+ fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '[%s]'- bailing out.\n", typeS);
#endif
return False;
}
@@ -659,7 +649,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
export = True;
output = (char *) atoms;
- for (i = 0; i < nUnits; i++)
+ for (int i = 0; i < nUnits; i++)
{
/*
* Exporting the _NET_WM_PING property could
@@ -679,7 +669,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
if (atoms[j] == None)
{
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom %ld [%s].\n",
+ fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom [%ld] [%s].\n",
(long int) input[i], validateString(atomName));
#endif
}
@@ -703,12 +693,11 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
XlibWindow *wind = malloc(nUnits * sizeof(*wind));
ClientPtr pClient = wClient(pWin);
WindowPtr pWindow;
- int i;
if (!wind)
{
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
+ fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '[%s]' - bailing out.\n", typeS);
#endif
return False;
}
@@ -717,7 +706,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
export = True;
output = (char*) wind;
- for (i = 0; i < nUnits; i++)
+ for (int i = 0; i < nUnits; i++)
{
pWindow = (WindowPtr)SecurityLookupWindow(input[i], pClient,
DixDestroyAccess);
@@ -728,8 +717,8 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
else
{
#ifdef WARNING
- fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window %ld "
- "exporting property %s type %s on window %p.\n",
+ fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window [%ld] "
+ "exporting property [%s] type [%s] on window [%p].\n",
(long int) input[i], propertyS, typeS, (void *) pWin);
#endif
@@ -774,15 +763,14 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
}
else if (mode == PropModeReplace)
{
- int n;
- char *data;
+ char * data = (char *) output;
XDeleteProperty(nxagentDisplay, nxagentWindow(pWin), propertyX);
- data = (char *) output;
-
while (nUnits > 0)
{
+ int n;
+
if ((format >> 3) * nUnits + sizeof(xChangePropertyReq) <
(MAX_REQUEST_SIZE << 2))
{
@@ -819,7 +807,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
{
#ifdef TEST
fprintf(stderr, "nxagentExportProperty: WARNING! Ignored ChangeProperty "
- "on %swindow %x property %s type %s nUnits %ld format %d\n",
+ "on %swindow [0x%x] property [%s] type [%s] nUnits [%ld] format [%d]\n",
nxagentWindowTopLevel(pWin) ? "toplevel " : "",
nxagentWindow(pWin), validateString(propertyS), validateString(typeS),
nUnits, format);
@@ -866,7 +854,7 @@ void nxagentImportProperty(Window window,
if (pWin == NULL)
{
#ifdef TEST
- fprintf(stderr, "nxagentImportProperty: Failed to look up remote window %lx property [%ld] exiting.\n",
+ fprintf(stderr, "nxagentImportProperty: Failed to look up remote window [0x%lx] property [%ld] exiting.\n",
window, property);
#endif
@@ -885,7 +873,7 @@ void nxagentImportProperty(Window window,
}
#ifdef TEST
- fprintf(stderr, "nxagentImportProperty: Window %lx property [%ld]: %s\n",
+ fprintf(stderr, "nxagentImportProperty: Window [0x%lx] property [%ld]: [%s]\n",
window, property, validateString(NameForAtom(propertyL)));
#endif
@@ -900,7 +888,7 @@ void nxagentImportProperty(Window window,
if (buffer == NULL && (nitems > 0))
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: Failed to retrieve remote property [%ld] %s on Window %ld\n",
+ fprintf(stderr, "nxagentImportProperty: Failed to retrieve remote property [%ld] [%s] on Window [%ld]\n",
(long int) property, validateString(NameForAtom(propertyL)), (long int) window);
#endif
}
@@ -956,8 +944,8 @@ void nxagentImportProperty(Window window,
else if (wmState.icon)
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote window %ld"
- " importing property %ld of type WM_STATE", (long int) wmState.icon,
+ fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote window [%ld]"
+ " importing property [%ld] of type WM_STATE", (long int) wmState.icon,
(long int) property);
#endif
}
@@ -982,7 +970,7 @@ void nxagentImportProperty(Window window,
#ifdef WARNING
fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon "
- "pixmap %d from hint importing property [%ld] type %s on window %p.\n",
+ "pixmap [%d] from hint importing property [%ld] type [%s] on window [%p].\n",
(unsigned int) wmHints.icon_pixmap, (long int) property,
typeS, (void *) pWin);
#endif
@@ -1003,7 +991,7 @@ void nxagentImportProperty(Window window,
#ifdef WARNING
fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon "
- "window %x from hint importing property [%ld] type %s on window %p.\n",
+ "window [0x%x] from hint importing property [%ld] type [%s] on window [%p].\n",
(unsigned int) wmHints.icon_window,
(long int) property, typeS, (void *) pWin);
#endif
@@ -1024,7 +1012,7 @@ void nxagentImportProperty(Window window,
#ifdef WARNING
fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon "
- "mask %x from hint importing property [%ld] type %s on window %p.\n",
+ "mask [0x%x] from hint importing property [%ld] type [%s] on window [%p].\n",
(unsigned int) wmHints.icon_mask, (long int) property, typeS, (void *) pWin);
#endif
}
@@ -1044,7 +1032,7 @@ void nxagentImportProperty(Window window,
#ifdef WARNING
fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window "
- "group %x from hint importing property [%ld] type %s on window %p.\n",
+ "group [0x%x] from hint importing property [%ld] type [%s] on window [%p].\n",
(unsigned int) wmHints.window_group,
(long int) property, typeS, (void *) pWin);
#endif
@@ -1055,12 +1043,11 @@ void nxagentImportProperty(Window window,
{
Atom *atoms = malloc(nitems * sizeof(Atom));
Atom *input = (Atom*) buffer;
- int i;
if (atoms == NULL)
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
+ fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '[%s]' - bailing out.\n", typeS);
#endif
return;
@@ -1070,14 +1057,14 @@ void nxagentImportProperty(Window window,
import = True;
output = (char *) atoms;
- for (i = 0; i < nitems; i++)
+ for (int i = 0; i < nitems; i++)
{
atoms[i] = nxagentRemoteToLocalAtom(input[i]);
if (atoms[i] == None)
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote atom %ld.\n",
+ fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote atom [%ld].\n",
(long int) input[i]);
#endif
}
@@ -1088,12 +1075,11 @@ void nxagentImportProperty(Window window,
Window *input = (Window*) buffer;
Window *wind = malloc(nitems * sizeof(Window));
WindowPtr pWindow;
- int i;
if (!wind)
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
+ fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '[%s]' - bailing out.\n", typeS);
#endif
return;
@@ -1102,7 +1088,7 @@ void nxagentImportProperty(Window window,
import = True;
output = (char*) wind;
- for (i = 0; i < nitems; i++)
+ for (int i = 0; i < nitems; i++)
{
pWindow = nxagentWindowPtr(input[i]);
@@ -1113,8 +1099,8 @@ void nxagentImportProperty(Window window,
else
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window %lx "
- "importing property [%ld] type %s on window %p.\n",
+ fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window [0x%lx] "
+ "importing property [%ld] type [%s] on window [%p].\n",
(long int) input[i], (long int) property, typeS, (void*)pWin);
#endif
@@ -1127,7 +1113,7 @@ void nxagentImportProperty(Window window,
{
#ifdef TEST
fprintf(stderr, "nxagentImportProperty: ChangeProperty "
- "on window %lx property [%ld] type %s nitems %ld format %d\n",
+ "on window [0x%lx] property [%ld] type [%s] nitems [%ld] format [%d]\n",
window, property, typeS, nitems, format);
#endif
@@ -1138,7 +1124,7 @@ void nxagentImportProperty(Window window,
{
#ifdef TEST
fprintf(stderr, "nxagentImportProperty: WARNING! Ignored ChangeProperty "
- "on window %lx property [%ld] type %s ntems %ld format %d\n",
+ "on window [0x%lx] property [%ld] type [%s] ntems [%ld] format [%d]\n",
window, property, validateString(typeS), nitems, format);
#endif
}
@@ -1183,7 +1169,7 @@ void nxagentRemovePropertyFromList(void)
struct nxagentPropertyRec *tmp = nxagentPropertyList.first;
#ifdef TEST
- fprintf(stderr, "nxagentRemovePropertyFromList: Property %ld on Window %lx to list, list size is %d.\n\n",
+ fprintf(stderr, "nxagentRemovePropertyFromList: Property [%ld] on Window [0x%lx] to list, list size is [%d].\n\n",
nxagentPropertyList.first -> property, nxagentPropertyList.first -> window,
nxagentPropertyList.size);
#endif
@@ -1220,8 +1206,8 @@ void nxagentAddPropertyToList(Atom property, WindowPtr pWin)
}
#ifdef TEST
- fprintf(stderr, "nxagentAddPropertyToList: Adding record Property %ld - Window %lx[%p]"
- "to list, list size is %d.\n", property, nxagentWindow(pWin), (void*) pWin,
+ fprintf(stderr, "nxagentAddPropertyToList: Adding record Property [%ld] - Window [0x%lx][%p]"
+ "to list, list size is [%d].\n", property, nxagentWindow(pWin), (void*) pWin,
nxagentPropertyList.size);
#endif
@@ -1262,12 +1248,12 @@ Bool nxagentNotifyMatchChangeProperty(void *p)
XPropertyEvent *X = p;
#ifdef TEST
- fprintf(stderr, "nxagentNotifyMatchChangeProperty: Property notify on window %lx property %ld.\n",
+ fprintf(stderr, "nxagentNotifyMatchChangeProperty: Property notify on window [0x%lx] property [%ld].\n",
X -> window, X -> atom);
if (first)
{
- fprintf(stderr, "nxagentNotifyMatchChangeProperty: First element on list is window %lx property %ld list size is %d.\n",
+ fprintf(stderr, "nxagentNotifyMatchChangeProperty: First element on list is window [0x%lx] property [%ld] list size is [%d].\n",
first -> window, first -> property, nxagentPropertyList.size);
}
else