aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/OpenDis.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/OpenDis.c')
-rw-r--r--nx-X11/lib/X11/OpenDis.c71
1 files changed, 28 insertions, 43 deletions
diff --git a/nx-X11/lib/X11/OpenDis.c b/nx-X11/lib/X11/OpenDis.c
index 4036572a8..965924650 100644
--- a/nx-X11/lib/X11/OpenDis.c
+++ b/nx-X11/lib/X11/OpenDis.c
@@ -73,12 +73,6 @@ extern void *_X11TransSocketProxyConnInfo(XtransConnInfo);
#endif
#if !USE_XCB
-#ifdef X_NOT_POSIX
-#define Size_t unsigned int
-#else
-#define Size_t size_t
-#endif
-
#define bignamelen (sizeof(XBigReqExtensionName) - 1)
typedef struct {
@@ -182,7 +176,7 @@ XOpenDisplay (
/*
* Attempt to allocate a display structure. Return NULL if allocation fails.
*/
- if ((dpy = (Display *)Xcalloc(1, sizeof(Display))) == NULL) {
+ if ((dpy = Xcalloc(1, sizeof(Display))) == NULL) {
return(NULL);
}
@@ -356,9 +350,7 @@ fallback_success:
dpy->qlen = 0;
/* Set up free-function record */
- if ((dpy->free_funcs = (_XFreeFuncRec *)Xcalloc(1,
- sizeof(_XFreeFuncRec)))
- == NULL) {
+ if ((dpy->free_funcs = Xcalloc(1, sizeof(_XFreeFuncRec))) == NULL) {
OutOfMemory (dpy, setup);
return(NULL);
}
@@ -459,8 +451,8 @@ fallback_success:
if (prefix.lengthReason > setuplength) {
fprintf (stderr, "Xlib: Broken initial reply: length of reason > length of packet\r\n");
}else{
- (void) fwrite (u.failure, (Size_t)sizeof(char),
- (Size_t)prefix.lengthReason, stderr);
+ (void) fwrite (u.failure, (size_t)sizeof(char),
+ (size_t)prefix.lengthReason, stderr);
(void) fwrite ("\r\n", sizeof(char), 2, stderr);
}
@@ -523,7 +515,7 @@ fallback_success:
return (NULL);
}
- dpy->vendor = (char *) Xmalloc((unsigned) (u.setup->nbytesVendor + 1));
+ dpy->vendor = Xmalloc(u.setup->nbytesVendor + 1);
if (dpy->vendor == NULL) {
OutOfMemory(dpy, setup);
return (NULL);
@@ -713,6 +705,9 @@ fallback_success:
#endif /* !USE_XCB */
#if USE_XCB
+/*
+ * get availability of large requests
+ */
dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection);
if(dpy->bigreq_size <= dpy->max_request_size)
dpy->bigreq_size = 0;
@@ -740,7 +735,6 @@ fallback_success:
(void) XSynchronize(dpy, _Xdebug);
/*
- * get availability of large requests, and
* get the resource manager database off the root window.
*/
LockDisplay(dpy);
@@ -870,9 +864,8 @@ void _XFreeDisplayStructure(Display *dpy)
while (dpy->ext_procs) {
_XExtension *ext = dpy->ext_procs;
dpy->ext_procs = ext->next;
- if (ext->name)
- Xfree (ext->name);
- Xfree ((char *)ext);
+ Xfree (ext->name);
+ Xfree (ext);
}
if (dpy->im_filters)
(*dpy->free_funcs->im_filters)(dpy);
@@ -914,17 +907,17 @@ void _XFreeDisplayStructure(Display *dpy)
for (k = 0; k < dp->nvisuals; k++)
_XFreeExtData (dp->visuals[k].ext_data);
- Xfree ((char *) dp->visuals);
+ Xfree (dp->visuals);
}
}
- Xfree ((char *) sp->depths);
+ Xfree (sp->depths);
}
_XFreeExtData (sp->ext_data);
}
- Xfree ((char *)dpy->screens);
+ Xfree (dpy->screens);
}
if (dpy->pixmap_format) {
@@ -932,28 +925,21 @@ void _XFreeDisplayStructure(Display *dpy)
for (i = 0; i < dpy->nformats; i++)
_XFreeExtData (dpy->pixmap_format[i].ext_data);
- Xfree ((char *)dpy->pixmap_format);
+ Xfree (dpy->pixmap_format);
}
- if (dpy->display_name)
- Xfree (dpy->display_name);
- if (dpy->vendor)
- Xfree (dpy->vendor);
+ free(dpy->display_name);
- if (dpy->buffer)
- Xfree (dpy->buffer);
- if (dpy->keysyms)
- Xfree ((char *) dpy->keysyms);
- if (dpy->xdefaults)
- Xfree (dpy->xdefaults);
- if (dpy->error_vec)
- Xfree ((char *)dpy->error_vec);
+ Xfree (dpy->vendor);
+ Xfree (dpy->buffer);
+ Xfree (dpy->keysyms);
+ Xfree (dpy->xdefaults);
+ Xfree (dpy->error_vec);
_XFreeExtData (dpy->ext_data);
- if (dpy->free_funcs)
- Xfree ((char *)dpy->free_funcs);
- if (dpy->scratch_buffer)
- Xfree (dpy->scratch_buffer);
+
+ Xfree (dpy->free_funcs);
+ Xfree (dpy->scratch_buffer);
FreeDisplayLock(dpy);
if (dpy->qfree) {
@@ -961,15 +947,14 @@ void _XFreeDisplayStructure(Display *dpy)
while (qelt) {
register _XQEvent *qnxt = qelt->next;
- Xfree ((char *) qelt);
+ Xfree (qelt);
qelt = qnxt;
}
}
while (dpy->im_fd_info) {
struct _XConnectionInfo *conni = dpy->im_fd_info;
dpy->im_fd_info = conni->next;
- if (conni->watch_data)
- Xfree (conni->watch_data);
+ Xfree (conni->watch_data);
Xfree (conni);
}
if (dpy->conn_watchers) {
@@ -977,14 +962,14 @@ void _XFreeDisplayStructure(Display *dpy)
dpy->conn_watchers = watcher->next;
Xfree (watcher);
}
- if (dpy->filedes)
- Xfree (dpy->filedes);
+
+ Xfree (dpy->filedes);
#if USE_XCB
_XFreeX11XCBStructure(dpy);
#endif /* USE_XCB */
- Xfree ((char *)dpy);
+ Xfree (dpy);
}
/* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL