summaryrefslogtreecommitdiff
path: root/lib/libXtst/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2022-11-06 18:00:45 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2022-11-06 18:00:45 +0000
commitb266d7a314d16fa9c703496e17a767a0d06daee6 (patch)
tree3e46ddd52afbf04fac1e6ea8b78810e4372cb21e /lib/libXtst/src
parent6f5e184f3688ee8f4e4723ae7679ae2a806fe0eb (diff)
Update libXtst to version 1.2.4
Diffstat (limited to 'lib/libXtst/src')
-rw-r--r--lib/libXtst/src/Makefile.in1
-rw-r--r--lib/libXtst/src/XRecord.c44
-rw-r--r--lib/libXtst/src/XTest.c14
3 files changed, 25 insertions, 34 deletions
diff --git a/lib/libXtst/src/Makefile.in b/lib/libXtst/src/Makefile.in
index 582d86c2c..334529a5a 100644
--- a/lib/libXtst/src/Makefile.in
+++ b/lib/libXtst/src/Makefile.in
@@ -287,6 +287,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
+runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
diff --git a/lib/libXtst/src/XRecord.c b/lib/libXtst/src/XRecord.c
index 4af18399a..6c9b54ed3 100644
--- a/lib/libXtst/src/XRecord.c
+++ b/lib/libXtst/src/XRecord.c
@@ -61,17 +61,6 @@ from The Open Group.
#include <X11/extensions/record.h>
#include <limits.h>
-#ifndef HAVE__XEATDATAWORDS
-static inline void _XEatDataWords(Display *dpy, unsigned long n)
-{
-# ifndef LONG64
- if (n >= (ULONG_MAX >> 2))
- _XIOError(dpy);
-# endif
- _XEatData (dpy, n << 2);
-}
-#endif
-
static XExtensionInfo _xrecord_info_data;
static XExtensionInfo *xrecord_info = &_xrecord_info_data;
static const char *xrecord_extension_name = RECORD_NAME;
@@ -177,7 +166,7 @@ static XPointer alloc_mem_cache(void)
struct mem_cache_str *cache;
/* note that an error will go unnoticed */
- cache = (struct mem_cache_str *) Xmalloc(sizeof(struct mem_cache_str));
+ cache = Xmalloc(sizeof(struct mem_cache_str));
if (cache) {
cache->display_closed = False;
cache->inter_data = NULL;
@@ -328,7 +317,7 @@ XRecordCreateContext(Display *dpy, int datum_flags,
XRecordRange *
XRecordAllocRange(void)
{
- return (XRecordRange*)Xcalloc(1, sizeof(XRecordRange));
+ return Xcalloc(1, sizeof(XRecordRange));
}
Status
@@ -420,7 +409,7 @@ XRecordGetContext(Display *dpy, XRecordContext context,
XExtDisplayInfo *info = find_display (dpy);
register xRecordGetContextReq *req;
xRecordGetContextReply rep;
- unsigned int count, i, rn;
+ unsigned int count;
xRecordRange xrange;
xRecordClientInfo xclient_inf;
XRecordState *ret;
@@ -438,7 +427,7 @@ XRecordGetContext(Display *dpy, XRecordContext context,
}
count = rep.nClients;
- ret = (XRecordState*)Xmalloc(sizeof(XRecordState));
+ ret = Xmalloc(sizeof(XRecordState));
if (!ret) {
_XEatDataWords (dpy, rep.length);
UnlockDisplay(dpy);
@@ -470,7 +459,7 @@ XRecordGetContext(Display *dpy, XRecordContext context,
SyncHandle();
return 0;
}
- for(i = 0; i < count; i++)
+ for (unsigned int i = 0; i < count; i++)
{
client_inf[i] = &(client_inf_str[i]);
_XRead(dpy, (char *)&xclient_inf, (long)sizeof(xRecordClientInfo));
@@ -498,7 +487,7 @@ XRecordGetContext(Display *dpy, XRecordContext context,
SyncHandle();
return 0;
}
- for (rn=0; rn<xclient_inf.nRanges; rn++) {
+ for (unsigned int rn = 0; rn < xclient_inf.nRanges; rn++) {
client_inf_str[i].ranges[rn] = &(ranges[rn]);
_XRead(dpy, (char *)&xrange, (long)sizeof(xRecordRange));
WireToLibRange(&xrange, &(ranges[rn]));
@@ -521,9 +510,7 @@ XRecordGetContext(Display *dpy, XRecordContext context,
void
XRecordFreeState(XRecordState *state)
{
- int i;
-
- for(i=0; i<state->nclients; i++) {
+ for (unsigned long i = 0; i < state->nclients; i++) {
if (state->client_info[i]->ranges) {
if (state->client_info[i]->ranges[0])
Xfree(state->client_info[i]->ranges[0]);
@@ -571,10 +558,10 @@ static struct reply_buffer *alloc_reply_buffer(
/*
* nothing available; malloc a new struct
*/
- rbp = (struct reply_buffer *)Xmalloc(sizeof(struct reply_buffer));
+ rbp = Xmalloc(sizeof(struct reply_buffer));
if (!rbp)
return NULL;
- rbp->buf = (unsigned char *)Xmalloc(nbytes);
+ rbp->buf = Xmalloc(nbytes);
if (!rbp->buf) {
Xfree(rbp);
return NULL;
@@ -598,7 +585,7 @@ static XRecordInterceptData *alloc_inter_data(XExtDisplayInfo *info)
return &iq->data;
}
/* allocate a new one */
- iq = (struct intercept_queue *)Xmalloc(sizeof(struct intercept_queue));
+ iq = Xmalloc(sizeof(struct intercept_queue));
if (!iq)
return NULL;
iq->cache = cache;
@@ -738,14 +725,13 @@ parse_reply_call_callback(
XRecordInterceptProc callback,
XPointer closure)
{
- int current_index;
+ unsigned int current_index;
int datum_bytes = 0;
- XRecordInterceptData *data;
/* call the callback for each protocol element in the reply */
current_index = 0;
do {
- data = alloc_inter_data(info);
+ XRecordInterceptData *data = alloc_inter_data(info);
if (!data)
return Error;
@@ -883,7 +869,6 @@ XRecordEnableContext(Display *dpy, XRecordContext context,
register xRecordEnableContextReq *req;
xRecordEnableContextReply rep;
struct reply_buffer *reply;
- enum parser_return status;
XRecordCheckExtension (dpy, info, 0);
LockDisplay(dpy);
@@ -895,6 +880,8 @@ XRecordEnableContext(Display *dpy, XRecordContext context,
while (1)
{
+ enum parser_return status;
+
/* This code should match that in XRecordEnableContextAsync */
if (!_XReply (dpy, (xReply *)&rep, 0, xFalse))
{
@@ -1028,8 +1015,7 @@ XRecordEnableContextAsync(Display *dpy, XRecordContext context,
record_async_state *async_state;
XRecordCheckExtension (dpy, info, 0);
- async = (_XAsyncHandler *)Xmalloc(sizeof(_XAsyncHandler) +
- sizeof(record_async_state));
+ async = Xmalloc(sizeof(_XAsyncHandler) + sizeof(record_async_state));
if (!async)
return 0;
async_state = (record_async_state *)(async + 1);
diff --git a/lib/libXtst/src/XTest.c b/lib/libXtst/src/XTest.c
index 3e4bb1707..2e53700dc 100644
--- a/lib/libXtst/src/XTest.c
+++ b/lib/libXtst/src/XTest.c
@@ -99,10 +99,11 @@ XTestQueryExtension (Display *dpy,
int *major_return, int *minor_return)
{
XExtDisplayInfo *info = find_display (dpy);
- register xXTestGetVersionReq *req;
xXTestGetVersionReply rep;
if (XextHasExtension(info)) {
+ xXTestGetVersionReq *req;
+
LockDisplay(dpy);
GetReq(XTestGetVersion, req);
req->reqType = info->codes->major_opcode;
@@ -259,7 +260,6 @@ send_axes(
int n_axes)
{
deviceValuator ev;
- int n;
req->deviceid |= MORE_EVENTS;
req->length += ((n_axes + 5) / 6) * (SIZEOF(xEvent) >> 2);
@@ -267,19 +267,24 @@ send_axes(
ev.deviceid = dev->device_id;
ev.first_valuator = first_axis;
while (n_axes > 0) {
- n = n_axes > 6 ? 6 : n_axes;
+ int n = n_axes > 6 ? 6 : n_axes;
ev.num_valuators = n;
switch (n) {
case 6:
ev.valuator5 = *(axes+5);
+ /* fallthrough */
case 5:
ev.valuator4 = *(axes+4);
+ /* fallthrough */
case 4:
ev.valuator3 = *(axes+3);
+ /* fallthrough */
case 3:
ev.valuator2 = *(axes+2);
+ /* fallthrough */
case 2:
ev.valuator1 = *(axes+1);
+ /* fallthrough */
case 1:
ev.valuator0 = *axes;
}
@@ -428,11 +433,10 @@ Status
XTestDiscard(Display *dpy)
{
Bool something;
- register char *ptr;
LockDisplay(dpy);
if ((something = (dpy->bufptr != dpy->buffer))) {
- for (ptr = dpy->buffer;
+ for (char *ptr = dpy->buffer;
ptr < dpy->bufptr;
ptr += (((xReq *)ptr)->length << 2))
dpy->request--;