summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Convert.c5
-rw-r--r--src/Event.c2
-rw-r--r--src/Selection.c5
-rw-r--r--src/TMprint.c4
-rw-r--r--src/TMstate.c8
-rw-r--r--src/VarGet.c6
6 files changed, 16 insertions, 14 deletions
diff --git a/src/Convert.c b/src/Convert.c
index 3adfb92..ebfc984 100644
--- a/src/Convert.c
+++ b/src/Convert.c
@@ -80,6 +80,7 @@ in this Software without prior written authorization from The Open Group.
#define CONVERTHASHSIZE ((unsigned)256)
#define CONVERTHASHMASK 255
#define ProcHash(from_type, to_type) (2 * (from_type) + to_type)
+#define HashCode(converter, from) (int)(((long)(converter) >> 2) + from->size + *((char *) from->addr))
typedef struct _ConverterRec *ConverterPtr;
typedef struct _ConverterRec {
@@ -640,7 +641,7 @@ void XtDirectConvert(
LOCK_PROCESS;
/* Try to find cache entry for conversion */
- hash = ((long) converter >> 2) + from->size + *((char *) from->addr);
+ hash = HashCode(converter, from);
if (from->size > 1) hash += ((char *) from->addr)[1];
for (p = cacheHashTable[hash & CACHEHASHMASK]; p; p = p->next) {
@@ -737,7 +738,7 @@ CallConverter(
LOCK_PROCESS;
/* Try to find cache entry for conversion */
- hash = ((long)(converter) >> 2) + from->size + *((char *) from->addr);
+ hash = HashCode(converter, from);
if (from->size > 1) hash += ((char *) from->addr)[1];
if (cP->cache_type != XtCacheNone) {
diff --git a/src/Event.c b/src/Event.c
index 799cc3e..b8487fc 100644
--- a/src/Event.c
+++ b/src/Event.c
@@ -166,7 +166,7 @@ static void CallExtensionSelector(
data[count++] = EXT_SELECT_DATA(p, i);
}
- (*rec->proc)(widget, types, data, count, rec->client_data);
+ (*rec->proc)(widget, types, data, (int) count, rec->client_data);
DEALLOCATE_LOCAL((char*) types);
DEALLOCATE_LOCAL((char*) data);
}
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);
}
diff --git a/src/TMprint.c b/src/TMprint.c
index 71b8e8f..8624250 100644
--- a/src/TMprint.c
+++ b/src/TMprint.c
@@ -92,8 +92,8 @@ if (sb->current - sb->start > (int)sb->max - STR_THRESHOLD) \
}
#define ExpandForChars(sb, nchars ) \
- if ((unsigned)(sb->current - sb->start) > (sb->max - STR_THRESHOLD - nchars)) { \
- _XtString old = sb->start; \
+ if ((unsigned)(sb->current - sb->start) > (sb->max - STR_THRESHOLD - (Cardinal) nchars)) { \
+ _XtString old = sb->start; \
sb->start = XtRealloc(old, \
(Cardinal)(sb->max = (Cardinal)(sb->max + STR_INCAMOUNT + (Cardinal) nchars))); \
sb->current = sb->current - old + sb->start; \
diff --git a/src/TMstate.c b/src/TMstate.c
index 8914c4f..530a6cd 100644
--- a/src/TMstate.c
+++ b/src/TMstate.c
@@ -1424,7 +1424,7 @@ XtTranslations _XtCreateXlations(
xlations = (XtTranslations)
__XtMalloc((Cardinal)(sizeof(TranslationData) +
- (numStateTrees - 1) * sizeof(TMStateTree)));
+ (size_t)(numStateTrees - 1) * sizeof(TMStateTree)));
#ifdef TRACE_TM
LOCK_PROCESS;
if (_XtGlobalTM.numTms == _XtGlobalTM.tmTblSize) {
@@ -1773,8 +1773,8 @@ static XtTranslations UnmergeTranslations(
if (xlations->composers[1]) {
second = UnmergeTranslations(widget, xlations->composers[1],
unmergeXlations,
- (TMShortCard)currIndex +
- xlations->composers[0]->numStateTrees,
+ (TMShortCard)(currIndex +
+ xlations->composers[0]->numStateTrees),
oldBindings, numOldBindings,
newBindings, numNewBindingsRtn);
}
@@ -2020,7 +2020,7 @@ static Boolean ComposeTranslations(
(&((TMSimpleBindData)bindData)->bindTbl[0]);
}
- numBytes =(TMShortCard) (((oldXlations ? oldXlations->numStateTrees : 0)
+ numBytes =(TMShortCard) ((size_t)((oldXlations ? oldXlations->numStateTrees : 0)
+ newXlations->numStateTrees) * sizeof(TMComplexBindProcsRec));
newBindings = (TMComplexBindProcs) XtStackAlloc(numBytes, stackBindings);
XtBZero((char *)newBindings, numBytes);
diff --git a/src/VarGet.c b/src/VarGet.c
index ce66e6f..1ac24cd 100644
--- a/src/VarGet.c
+++ b/src/VarGet.c
@@ -161,7 +161,7 @@ GetTypedArg(
from_val.size = from_size;
from_val.addr = (XPointer)value;
to_val.addr = (XPointer)typed_arg->value;
- to_val.size = typed_arg->size;
+ to_val.size = (unsigned) typed_arg->size;
if (!XtConvertAndStore(widget, from_type, &from_val,
typed_arg->type, &to_val)) {
@@ -234,7 +234,7 @@ XtVaGetValues(Widget widget, ...)
_XtCountVaList(var, &total_count, &typed_count);
if (total_count != typed_count) {
- args = (ArgList)__XtMalloc((unsigned)((total_count - typed_count)
+ args = (ArgList)__XtMalloc((unsigned)((size_t)(total_count - typed_count)
* sizeof(Arg)));
}
else args = NULL; /* for lint; really unused */
@@ -272,7 +272,7 @@ XtVaGetValues(Widget widget, ...)
XtFree((XtPointer)resources);
if (total_count != typed_count) {
- XtGetValues(widget, args, count);
+ XtGetValues(widget, args, (Cardinal) count);
XtFree((XtPointer)args);
}
UNLOCK_APP(app);