summaryrefslogtreecommitdiff
path: root/src/Selection.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-05-06 05:16:24 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2019-05-06 18:03:53 -0400
commit9112c3c104f0b3ec45ae776279e276034bc7dcc5 (patch)
tree55b4ba329cbaecaadb0093132f1b6c01cf8bb9b4 /src/Selection.c
parent37dce673d841e7df75091a3b31828431e71bd78f (diff)
fixes for gcc warnings, no object-change
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/Selection.c')
-rw-r--r--src/Selection.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Selection.c b/src/Selection.c
index 1051115..448f208 100644
--- a/src/Selection.c
+++ b/src/Selection.c
@@ -141,6 +141,7 @@ static Atom GetParamInfo(Widget, Atom);
static int StorageSize[3] = {1, sizeof(short), sizeof(long)};
#define BYTELENGTH(length, format) ((length) * (size_t)StorageSize[(format)>>4])
#define NUMELEM(bytelength, format) ((bytelength) / StorageSize[(format)>>4])
+#define NUMELEM2(bytelength, format) ((unsigned long)(bytelength) / (unsigned long) StorageSize[(format)>>4])
/* Xlib and Xt are permitted to have different memory allocators, and in the
* XtSelectionCallbackProc the client is instructed to free the selection
@@ -1192,7 +1193,7 @@ static void HandleGetIncrement(
XtRemoveTimeOut(info->timeout);
#endif
if (length == 0) {
- unsigned long u_offset = NUMELEM(info->offset, info->format);
+ unsigned long u_offset = NUMELEM2(info->offset, info->format);
(*info->callbacks[n])(widget, *info->req_closure, &ctx->selection,
&info->type,
(info->offset == 0 ? value : info->value),
@@ -1503,7 +1504,7 @@ static void DoLocalTransfer(
&size, ctx->owner_closure, (XtRequestId*)&req);
}
if (total == NULL) total = __XtMalloc(1);
- totallength = NUMELEM(totallength, format);
+ totallength = NUMELEM2(totallength, format);
(*callback)(widget, closure, &selection, &resulttype,
total, &totallength, &format);
}