Commit cf9e8c73 authored by Thomas E. Dickey's avatar Thomas E. Dickey Committed by Alan Coopersmith
Browse files

This cleans up the "easy" warning fixes which can be made using my

Regress script, comparing object-files before/after the edits:

	https://invisible-island.net/ansification/index.html
	https://invisible-island.net/scripts/readme.html



The changes are casts, which quiet the gcc warnings about implicit
conversion that my "gcc-normal" script would show.  I avoided
reformatting the code.

The change reduces the number of gcc warnings from 769 to 163.

Signed-off-by: Thomas E. Dickey's avatarThomas E. Dickey <dickey@invisible-island.net>
parent fb7e899e
......@@ -129,7 +129,7 @@ SOFTWARE.
#define XtStackAlloc(size, stack_cache_array) \
((size) <= sizeof(stack_cache_array) \
? (XtPointer)(stack_cache_array) \
: XtMalloc((unsigned)(size)))
: XtMalloc((Cardinal)(size)))
#define XtStackFree(pointer, stack_cache_array) \
{ if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); }
......
......@@ -143,20 +143,20 @@ Cardinal XtAsprintf(
if (len < 0)
_XtAllocError("vsnprintf");
*new_string = XtMalloc(len + 1); /* snprintf doesn't count trailing '\0' */
*new_string = XtMalloc((Cardinal) len + 1); /* snprintf doesn't count trailing '\0' */
if (len < sizeof(buf))
{
strncpy(*new_string, buf, len);
strncpy(*new_string, buf, (size_t) len);
(*new_string)[len] = '\0';
}
else
{
va_start(ap, format);
if (vsnprintf(*new_string, len + 1, format, ap) < 0)
if (vsnprintf(*new_string, (size_t) (len + 1), format, ap) < 0)
_XtAllocError("vsnprintf");
va_end(ap);
}
return len;
return (Cardinal) len;
}
......@@ -252,7 +252,7 @@ char* _XtHeapAlloc(
printf( "allocating large segment (%d bytes) on heap %#x\n",
bytes, heap );
#endif
heap_loc = XtMalloc(bytes + sizeof(char*));
heap_loc = XtMalloc(bytes + (Cardinal) sizeof(char*));
if (heap->start) {
*(char**)heap_loc = *(char**)heap->start;
*(char**)heap->start = heap_loc;
......@@ -273,10 +273,10 @@ char* _XtHeapAlloc(
heap->current = heap_loc + sizeof(char*);
heap->bytes_remaining = HEAP_SEGMENT_SIZE - sizeof(char*);
}
bytes = (bytes + (sizeof(long) - 1)) & (~(sizeof(long) - 1));
bytes = (Cardinal) ((bytes + (sizeof(long) - 1)) & (~(sizeof(long) - 1)));
heap_loc = heap->current;
heap->current += bytes;
heap->bytes_remaining -= bytes; /* can be negative, if rounded */
heap->bytes_remaining = (heap->bytes_remaining - (int) bytes); /* can be negative, if rounded */
return heap_loc;
}
......
......@@ -122,17 +122,17 @@ void _XtAddCallback(
if (icl && icl->call_state) {
icl->call_state |= _XtCBFreeAfterCalling;
icl = (InternalCallbackList)
__XtMalloc(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (count + 1));
__XtMalloc((Cardinal) (sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) (count + 1)));
(void) memmove((char *)ToList(icl), (char *)ToList(*callbacks),
sizeof(XtCallbackRec) * count);
} else {
icl = (InternalCallbackList)
XtRealloc((char *) icl, sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (count + 1));
XtRealloc((char *) icl, (Cardinal)(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) (count + 1)));
}
*callbacks = icl;
icl->count = count + 1;
icl->count = (unsigned short) (count + 1);
icl->is_padded = 0;
icl->call_state = 0;
cl = ToList(icl) + count;
......@@ -208,17 +208,17 @@ static void AddCallbacks(
for (j=0, cl = newcallbacks; cl->callback; cl++, j++);
if (icl && icl->call_state) {
icl->call_state |= _XtCBFreeAfterCalling;
icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (i+j));
icl = (InternalCallbackList) __XtMalloc((Cardinal)(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) (i+j)));
(void) memmove((char *)ToList(*callbacks), (char *)ToList(icl),
sizeof(XtCallbackRec) * i);
sizeof(XtCallbackRec) * (size_t) i);
} else {
icl = (InternalCallbackList) XtRealloc((char *) icl,
sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (i+j));
(Cardinal)(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) (i+j)));
}
*callbacks = icl;
icl->count = i+j;
icl->count = (unsigned short) (i+j);
icl->is_padded = 0;
icl->call_state = 0;
for (cl = ToList(icl) + i; --j >= 0; )
......@@ -283,9 +283,9 @@ void _XtRemoveCallback (
j = icl->count - i - 1;
ocl = ToList(icl);
icl = (InternalCallbackList)
__XtMalloc(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (i + j));
icl->count = i + j;
__XtMalloc((Cardinal) (sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) (i + j)));
icl->count = (unsigned short) (i + j);
icl->is_padded = 0;
icl->call_state = 0;
ncl = ToList(icl);
......@@ -301,8 +301,8 @@ void _XtRemoveCallback (
while (--i >= 0)
*cl++ = *ncl++;
icl = (InternalCallbackList)
XtRealloc((char *) icl, sizeof(InternalCallbackRec)
+ sizeof(XtCallbackRec) * icl->count);
XtRealloc((char *) icl, (Cardinal) (sizeof(InternalCallbackRec)
+ sizeof(XtCallbackRec) * icl->count));
icl->is_padded = 0;
*callbacks = icl;
} else {
......@@ -385,9 +385,9 @@ void XtRemoveCallbacks (
cl = ToList(icl);
if (icl->call_state) {
icl->call_state |= _XtCBFreeAfterCalling;
icl = (InternalCallbackList)__XtMalloc(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * i);
icl->count = i;
icl = (InternalCallbackList)__XtMalloc((Cardinal)(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) i));
icl->count = (unsigned short) i;
icl->call_state = 0;
}
ccl = ToList(icl);
......@@ -404,7 +404,7 @@ void XtRemoveCallbacks (
}
if (icl->count) {
icl = (InternalCallbackList)
XtRealloc((char *)icl, (sizeof(InternalCallbackRec) +
XtRealloc((char *)icl, (Cardinal) (sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * icl->count));
icl->is_padded = 0;
*callbacks = icl;
......@@ -484,9 +484,9 @@ InternalCallbackList _XtCompileCallbackList(
for (n=0, xtcl=xtcallbacks; xtcl->callback; n++, xtcl++) {};
if (n == 0) return (InternalCallbackList) NULL;
callbacks = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * n);
callbacks->count = n;
callbacks = (InternalCallbackList) __XtMalloc((Cardinal) (sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) n));
callbacks->count = (unsigned short) n;
callbacks->is_padded = 0;
callbacks->call_state = 0;
cl = ToList(callbacks);
......@@ -514,17 +514,17 @@ XtCallbackList _XtGetCallbackList(
if (icl->call_state) {
icl->call_state |= _XtCBFreeAfterCalling;
ocl = ToList(icl);
icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (i+1));
icl->count = i;
icl = (InternalCallbackList) __XtMalloc((Cardinal)(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t) (i+1)));
icl->count = (unsigned short) i;
icl->call_state = 0;
cl = ToList(icl);
while (--i >= 0)
*cl++ = *ocl++;
} else {
icl = (InternalCallbackList) XtRealloc((char *)icl,
sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (i+1));
(Cardinal)(sizeof(InternalCallbackRec) +
sizeof(XtCallbackRec) * (size_t)(i+1)));
cl = ToList(icl) + i;
}
icl->is_padded = 1;
......
......@@ -242,7 +242,7 @@ static void CompositeInsertChild(
cw->composite.num_slots += (cw->composite.num_slots / 2) + 2;
cw->composite.children = children =
(WidgetList) XtRealloc((XtPointer) children,
(unsigned) (cw->composite.num_slots) * sizeof(Widget));
(Cardinal)((unsigned) (cw->composite.num_slots) * sizeof(Widget)));
}
/* Ripple children up one space from "position" */
for (i = cw->composite.num_children; i > position; i--) {
......
......@@ -207,15 +207,15 @@ void _XtTableAddConverter(
XtFree((char *)p);
}
p = (ConverterPtr) __XtMalloc(sizeof(ConverterRec) +
sizeof(XtConvertArgRec) * num_args);
p = (ConverterPtr) __XtMalloc((Cardinal)(sizeof(ConverterRec) +
sizeof(XtConvertArgRec) * num_args));
p->next = *pp;
*pp = p;
p->from = from_type;
p->to = to_type;
p->converter = converter;
p->destructor = destructor;
p->num_args = num_args;
p->num_args = (unsigned short) num_args;
p->global = global;
args = ConvertArgs(p);
while (num_args--)
......@@ -223,7 +223,7 @@ void _XtTableAddConverter(
p->new_style = new_style;
p->do_ref_count = False;
if (destructor || (cache_type & 0xff)) {
p->cache_type = cache_type & 0xff;
p->cache_type = (char) (cache_type & 0xff);
if (cache_type & XtCacheRefCount)
p->do_ref_count = True;
} else {
......@@ -367,7 +367,7 @@ CacheEnter(
pHashEntry = &cacheHashTable[hash & CACHEHASHMASK];
if ((succeeded && destructor) || do_ref) {
p = (CachePtr) _XtHeapAlloc(heap, (sizeof(CacheRec) +
p = (CachePtr) _XtHeapAlloc(heap, (Cardinal) (sizeof(CacheRec) +
sizeof(CacheRecExt) +
num_args * sizeof(XrmValue)));
CEXT(p)->prev = pHashEntry;
......@@ -377,7 +377,7 @@ CacheEnter(
p->has_ext = True;
}
else {
p = (CachePtr)_XtHeapAlloc(heap, (sizeof(CacheRec) +
p = (CachePtr)_XtHeapAlloc(heap, (Cardinal) (sizeof(CacheRec) +
num_args * sizeof(XrmValue)));
p->has_ext = False;
}
......@@ -403,7 +403,7 @@ CacheEnter(
p->from.addr = (XPointer)_XtHeapAlloc(heap, from->size);
(void) memmove((char *)p->from.addr, (char *)from->addr, from->size);
}
p->num_args = num_args;
p->num_args = (unsigned short) num_args;
if (num_args) {
XrmValue *pargs = CARGS(p);
for (i = 0; i < num_args; i++) {
......@@ -540,7 +540,7 @@ static Boolean ResourceQuarkToOffset(
for (i = 0; i < wc->core_class.num_resources; i++, resources++) {
res = *resources;
if (res->xrm_name == name) {
*offset = -res->xrm_offset - 1;
*offset = (Cardinal) (-res->xrm_offset - 1);
return True;
}
} /* for i in resources */
......
......@@ -144,11 +144,11 @@ void _XtConvertInitialize(void)
(char*) fromVal->addr, tstr); \
return False; \
} \
*(type*)(toVal->addr) = (value); \
*(type*)(toVal->addr) = (type) (value); \
} \
else { \
static type static_val; \
static_val = (value); \
static_val = (type) (value); \
toVal->addr = (XPointer)&static_val; \
} \
toVal->size = sizeof(type); \
......@@ -162,11 +162,11 @@ void _XtConvertInitialize(void)
toVal->size = sizeof(type); \
return False; \
} \
*(type*)(toVal->addr) = (value); \
*(type*)(toVal->addr) = (type) (value); \
} \
else { \
static type static_val; \
static_val = (value); \
static_val = (type) (value); \
toVal->addr = (XPointer)&static_val; \
} \
toVal->size = sizeof(type); \
......@@ -445,7 +445,7 @@ Boolean XtCvtIntToColor(
}
screen = *((Screen **) args[0].addr);
colormap = *((Colormap *) args[1].addr);
c.pixel = *(int *)fromVal->addr;
c.pixel = (unsigned long) (*(int *)fromVal->addr);
XQueryColor(DisplayOfScreen(screen), colormap, &c);
done(XColor, c);
......@@ -1381,18 +1381,18 @@ static int CompareISOLatin1 (const char *first, const char *second)
/* try lowercasing and try again */
if ((a >= XK_A) && (a <= XK_Z))
a += (XK_a - XK_A);
a = (unsigned char) (a + (XK_a - XK_A));
else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
a += (XK_agrave - XK_Agrave);
a = (unsigned char) (a + (XK_agrave - XK_Agrave));
else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
a += (XK_oslash - XK_Ooblique);
a = (unsigned char) (a + (XK_oslash - XK_Ooblique));
if ((b >= XK_A) && (b <= XK_Z))
b += (XK_a - XK_A);
b = (unsigned char) (b + (XK_a - XK_A));
else if ((b >= XK_Agrave) && (b <= XK_Odiaeresis))
b += (XK_agrave - XK_Agrave);
b = (unsigned char) (b + (XK_agrave - XK_Agrave));
else if ((b >= XK_Ooblique) && (b <= XK_Thorn))
b += (XK_oslash - XK_Ooblique);
b = (unsigned char) (b + (XK_oslash - XK_Ooblique));
if (a != b) break;
}
......@@ -1407,11 +1407,11 @@ static void CopyISOLatin1Lowered(char *dst, const char *src)
for ( ; *source; source++, dest++) {
if (*source >= XK_A && *source <= XK_Z)
*dest = *source + (XK_a - XK_A);
*dest = (unsigned char) (*source + (XK_a - XK_A));
else if (*source >= XK_Agrave && *source <= XK_Odiaeresis)
*dest = *source + (XK_agrave - XK_Agrave);
*dest = (unsigned char) (*source + (XK_agrave - XK_Agrave));
else if (*source >= XK_Ooblique && *source <= XK_Thorn)
*dest = *source + (XK_oslash - XK_Ooblique);
*dest = (unsigned char) (*source + (XK_oslash - XK_Ooblique));
else
*dest = *source;
}
......@@ -1656,10 +1656,10 @@ Boolean XtCvtStringToCommandArgArray(
while (*src != '\0' && !IsWhitespace(*src) && !IsNewline(*src)) {
if (*src == '\\' &&
(IsWhitespace(*(src+1)) || IsNewline(*(src+1)))) {
len = src - start;
len = (int) (src - start);
if (len) {
/* copy preceeding part of token */
memcpy(dst, start, len);
memcpy(dst, start, (size_t) len);
dst += len;
}
/* skip backslash */
......@@ -1669,10 +1669,10 @@ Boolean XtCvtStringToCommandArgArray(
}
src++;
}
len = src - start;
len = (int) (src - start);
if (len) {
/* copy last part of token */
memcpy(dst, start, len);
memcpy(dst, start, (size_t) len);
dst += len;
}
*dst = '\0';
......@@ -1680,13 +1680,13 @@ Boolean XtCvtStringToCommandArgArray(
dst++;
}
ptr = strarray = (String*) __XtMalloc((Cardinal)(tokens+1) * sizeof(String));
ptr = strarray = (String*) __XtMalloc((Cardinal)((size_t)(tokens+1) * sizeof(String)));
src = dst_str;
while (--tokens >= 0) {
*ptr = src;
ptr++;
if (tokens) {
len = strlen(src);
len = (int) strlen(src);
src = src + len + 1;
}
}
......
......@@ -349,7 +349,7 @@ static Boolean CoreSetValues(
}
else {
attributes.background_pixmap = new->core.background_pixmap;
window_mask &= ~CWBackPixel;
window_mask &= (unsigned long) (~CWBackPixel);
window_mask |= CWBackPixmap;
}
redisplay = TRUE;
......@@ -366,7 +366,7 @@ static Boolean CoreSetValues(
}
else {
attributes.border_pixmap = new->core.border_pixmap;
window_mask &= ~CWBorderPixel;
window_mask &= (unsigned long) (~CWBorderPixel);
window_mask |= CWBorderPixmap;
}
}
......
......@@ -297,7 +297,7 @@ xtWidgetAlloc(
(sizeof(struct {char a; unsigned long b;}) -
sizeof(unsigned long) + sizeof(double))) {
if (csize && !(csize & (sizeof(double) - 1)))
wsize = (wsize + sizeof(double) - 1) & ~(sizeof(double)-1);
wsize = (Cardinal) ((wsize + sizeof(double) - 1) & ~(sizeof(double)-1));
}
}
widget = (Widget) __XtCalloc(1,(unsigned)(wsize + csize));
......@@ -620,7 +620,7 @@ popupPostProc(Widget w)
parent->core.popup_list =
(WidgetList) XtRealloc((char*) parent->core.popup_list,
(unsigned) (parent->core.num_popups+1) * sizeof(Widget));
(Cardinal)((unsigned) (parent->core.num_popups+1) * sizeof(Widget)));
parent->core.popup_list[parent->core.num_popups++] = w;
}
......
......@@ -351,7 +351,7 @@ void XtDestroyWidget (Widget widget)
app->destroy_list_size += 10;
app->destroy_list = (DestroyRec*)
XtRealloc( (char*)app->destroy_list,
(unsigned)sizeof(DestroyRec)*app->destroy_list_size
(Cardinal)(sizeof(DestroyRec) * (size_t)app->destroy_list_size)
);
}
dr = app->destroy_list + app->destroy_count++;
......
......@@ -120,9 +120,9 @@ static void AddToAppContext(
#define DISPLAYS_TO_ADD 4
if (app->count >= app->max) {
app->max += DISPLAYS_TO_ADD;
app->max = (short) (app->max + DISPLAYS_TO_ADD);
app->list = (Display **) XtRealloc((char *)app->list,
(unsigned) app->max * sizeof(Display *));
(Cardinal) ((unsigned) app->max * sizeof(Display *)));
}
app->list[app->count++] = d;
......@@ -218,8 +218,8 @@ static XtPerDisplay InitPerDisplay(
pd->pdi.keyboard.grabType = XtNoServerGrab;
pd->pdi.pointer.grabType = XtNoServerGrab;
_XtAllocWWTable(pd);
pd->per_screen_db = (XrmDatabase *)__XtCalloc(ScreenCount(dpy),
sizeof(XrmDatabase));
pd->per_screen_db = (XrmDatabase *)__XtCalloc((Cardinal)ScreenCount(dpy),
(Cardinal)sizeof(XrmDatabase));
pd->cmd_db = (XrmDatabase)NULL;
pd->server_db = (XrmDatabase)NULL;
pd->dispatcher_list = NULL;
......@@ -288,9 +288,9 @@ Display *XtOpenDisplay(
} else {
int len;
displayName = XDisplayName(displayName);
len = strlen (displayName);
app->display_name_tried = (String) __XtMalloc (len + 1);
strncpy ((char*) app->display_name_tried, displayName, len + 1);
len = (int) strlen (displayName);
app->display_name_tried = (String) __XtMalloc ((Cardinal)(len + 1));
strncpy ((char*) app->display_name_tried, displayName, (size_t) (len + 1));
app->display_name_tried[len] = '\0';
}
if (db) XrmDestroyDatabase(db);
......@@ -317,7 +317,7 @@ _XtAppInit(
*/
saved_argv = (String *)
__XtMalloc( (Cardinal)((*argc_in_out + 1) * sizeof(String)) );
__XtMalloc( (Cardinal)((size_t)(*argc_in_out + 1) * sizeof(String)) );
for (i = 0 ; i < *argc_in_out ; i++) saved_argv[i] = (*argv_in_out)[i];
saved_argv[i] = NULL; /* NULL terminate that sucker. */
......@@ -507,7 +507,7 @@ void XtDestroyApplicationContext(XtAppContext app)
_XtAppDestroyCount++;
appDestroyList =
(XtAppContext *) XtRealloc((char *) appDestroyList,
(unsigned) (_XtAppDestroyCount * sizeof(XtAppContext)));
(unsigned) ((size_t)_XtAppDestroyCount * sizeof(XtAppContext)));
appDestroyList[_XtAppDestroyCount-1] = app;
UNLOCK_PROCESS;
UNLOCK_APP(app);
......@@ -520,7 +520,7 @@ void _XtDestroyAppContexts(void)
XtAppContext apps[8];
XtAppContext* pApps;
pApps = XtStackAlloc (sizeof (XtAppContext) * _XtAppDestroyCount, apps);
pApps = XtStackAlloc (sizeof (XtAppContext) * (size_t)_XtAppDestroyCount, apps);
for (i = ii = 0; i < _XtAppDestroyCount; i++) {
if (_XtSafeToDestroy(appDestroyList[i]))
......@@ -683,7 +683,7 @@ void XtCloseDisplay(Display *dpy)
app->dpy_destroy_count++;
app->dpy_destroy_list = (Display **)
XtRealloc((char *) app->dpy_destroy_list,
(unsigned) (app->dpy_destroy_count * sizeof(Display *)));
(Cardinal) ((size_t)app->dpy_destroy_count * sizeof(Display *)));
app->dpy_destroy_list[app->dpy_destroy_count-1] = dpy;
}
UNLOCK_APP(app);
......@@ -756,8 +756,8 @@ void XtGetDisplays(
{
int ii;
LOCK_APP(app_context);
*num_dpy_return = app_context->count;
*dpy_return = (Display**)__XtMalloc(app_context->count * sizeof(Display*));
*num_dpy_return = (Cardinal)app_context->count;
*dpy_return = (Display**)__XtMalloc((Cardinal)((size_t)app_context->count * sizeof(Display*)));
for (ii = 0; ii < app_context->count; ii++)
(*dpy_return)[ii] = app_context->list[ii];
UNLOCK_APP(app_context);
......
......@@ -194,12 +194,12 @@ void XtAppGetErrorDatabaseText(
#endif /* GLOBALERRORS */
} else (void) XrmGetResource(db, str_name, str_class, &type_str, &result);
if (result.addr) {
(void) strncpy (buffer, result.addr, nbytes);
(void) strncpy (buffer, result.addr, (size_t) nbytes);
if (result.size > (unsigned) nbytes) buffer[nbytes-1] = 0;
} else {
int len = strlen(defaultp);
int len = (int) strlen(defaultp);
if (len >= nbytes) len = nbytes-1;
(void) memmove(buffer, defaultp, len);
(void) memmove(buffer, defaultp, (size_t) len);
buffer[len] = '\0';
}
if (str_name)
......
......@@ -150,7 +150,7 @@ static void CallExtensionSelector(
for (p = widget->core.event_table; p != NULL; p = p->next)
if (p->has_type_specifier &&
EXT_TYPE(p) >= rec->min && EXT_TYPE(p) <= rec->max)
count += p->mask;
count = (Cardinal) (count + p->mask);
if (count == 0 && !forceCall) return;
......@@ -230,7 +230,7 @@ RemoveEventHandler(
Display* dpy = XtDisplay (widget);
if (oldMask != mask)
XSelectInput(dpy, XtWindow(widget), mask);
XSelectInput(dpy, XtWindow(widget), (long) mask);
if (has_type_specifier) {
XtPerDisplay pd = _XtGetPerDisplay(dpy);
......@@ -348,9 +348,9 @@ AddEventHandler(
i++;
if (i == p->mask) {
p = (XtEventRec*) XtRealloc((char*)p,
sizeof(XtEventRec) +
(Cardinal)(sizeof(XtEventRec) +
sizeof(XtEventRecExt) +
p->mask * sizeof(XtPointer));
p->mask * sizeof(XtPointer)));
EXT_SELECT_DATA(p,i) = select_data;
p->mask++;
*pp = p;
......@@ -363,7 +363,7 @@ AddEventHandler(
Display* dpy = XtDisplay (widget);
if (oldMask != mask)
XSelectInput(dpy, XtWindow(widget), mask);
XSelectInput(dpy, XtWindow(widget), (long) mask);
if (has_type_specifier) {
XtPerDisplay pd = _XtGetPerDisplay (dpy);
......@@ -514,7 +514,7 @@ static const WidgetRec WWfake; /* placeholder for deletions */
#define WWHASH(tab,win) ((win) & tab->mask)
#define WWREHASHVAL(tab,win) ((((win) % tab->rehash) + 2) | 1)
#define WWREHASH(tab,idx,rehash) ((idx + rehash) & tab->mask)
#define WWREHASH(tab,idx,rehash) ((unsigned)(idx + rehash) & (tab->mask))
#define WWTABLE(display) (_XtGetPerDisplay(display)->WWtable)
static void ExpandWWTable(WWTable);
......@@ -547,11 +547,11 @@ void XtRegisterDrawable(
if ((tab->occupied + (tab->occupied >> 2)) > tab->mask)
ExpandWWTable(tab);
idx = WWHASH(tab, window);
idx = (int) WWHASH(tab, window);
if ((entry = tab->entries[idx]) && entry != &WWfake) {
rehash = WWREHASHVAL(tab, window);
rehash = (int) WWREHASHVAL(tab, window);
do {
idx = WWREHASH(tab, idx, rehash);
idx = (int) WWREHASH(tab, idx, rehash);
} while ((entry = tab->entries[idx]) && entry != &WWfake);
}
if (!entry)
......@@ -593,12 +593,12 @@ void XtUnregisterDrawable(
UNLOCK_APP(app);
return;
}
idx = WWHASH(tab, window);
idx = (int) WWHASH(tab, window);
if ((entry = tab->entries[idx])) {
if (entry != widget) {
rehash = WWREHASHVAL(tab, window);
rehash = (int) WWREHASHVAL(tab, window);
do {
idx = WWREHASH(tab, idx, rehash);
idx = (int) WWREHASH(tab, idx, rehash);
if (!(entry = tab->entries[idx])) {
UNLOCK_PROCESS;
UNLOCK_APP(app);
......@@ -633,11 +633,11 @@ static void ExpandWWTable(
entries = tab->entries = (<