summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWalter Harms <wharms@bfs.de>2019-06-05 18:58:45 +0200
committerWalter Harms <wharms@bfs.de>2019-06-05 18:58:45 +0200
commit7c0ed275e4c0e86e23c5f93647e03fa4b71797b3 (patch)
tree29efe62a74670e92a7ec11c9230d2e4307f1d01b /src
parentd4208c7734fb12adbfb5ef1b65dfcfe7126380d6 (diff)
parent4194ff5b427e39bb5325db0f377e80b3e6982e17 (diff)
Merge branch 'master' of ssh://gitlab.freedesktop.org/xorg/lib/libxt
Diffstat (limited to 'src')
-rw-r--r--src/Alloc.c26
-rw-r--r--src/Intrinsic.c6
-rw-r--r--src/Selection.c6
-rw-r--r--src/TMaction.c7
-rw-r--r--src/TMstate.c6
5 files changed, 26 insertions, 25 deletions
diff --git a/src/Alloc.c b/src/Alloc.c
index d75898c..dd2f616 100644
--- a/src/Alloc.c
+++ b/src/Alloc.c
@@ -249,7 +249,7 @@ char* _XtHeapAlloc(
if ((bytes + sizeof(char*)) >= (HEAP_SEGMENT_SIZE>>1)) {
/* preserve current segment; insert this one in front */
#ifdef _TRACE_HEAP
- printf( "allocating large segment (%d bytes) on heap %#x\n",
+ printf( "allocating large segment (%d bytes) on heap %p\n",
bytes, heap );
#endif
heap_loc = XtMalloc(bytes + (Cardinal) sizeof(char*));
@@ -265,7 +265,7 @@ char* _XtHeapAlloc(
}
/* else discard remainder of this segment */
#ifdef _TRACE_HEAP
- printf( "allocating new segment on heap %#x\n", heap );
+ printf( "allocating new segment on heap %p\n", heap );
#endif
heap_loc = XtMalloc((unsigned)HEAP_SEGMENT_SIZE);
*(char**)heap_loc = heap->start;
@@ -307,7 +307,7 @@ void _XtHeapFree(
typedef struct _Stats *StatsPtr;
typedef struct _Stats {
StatsPtr prev, next;
- char *file;
+ const char *file;
int line;
unsigned size;
unsigned long seq;
@@ -317,9 +317,9 @@ typedef struct _Stats {
static StatsPtr XtMemory = (StatsPtr)NULL;
static unsigned long ActiveXtMemory = 0;
static unsigned long XtSeqId = 0;
-static unsigned long XtSeqBreakpoint = ~0;
+static unsigned long XtSeqBreakpoint = (unsigned long)(~0UL);
-#define StatsSize(n) ((((n) + (sizeof(long) - 1)) & ~(sizeof(long) - 1)) + sizeof(Stats))
+#define StatsSize(n) (unsigned)((((n) + (sizeof(long) - 1)) & ~(sizeof(long) - 1)) + sizeof(Stats))
#define ToStats(ptr) ((StatsPtr)(ptr - sizeof(Stats)))
#define ToMem(ptr) (((char *)ptr) + sizeof(Stats))
@@ -349,7 +349,7 @@ static void _XtBreakpoint(
char *_XtMalloc(
unsigned size,
- char *file,
+ const char *file,
int line)
{
StatsPtr ptr;
@@ -375,7 +375,7 @@ char *XtMalloc(
char *_XtRealloc(
char *ptr,
unsigned size,
- char *file,
+ const char *file,
int line)
{
char *newptr;
@@ -401,7 +401,7 @@ char *XtRealloc(
char *_XtCalloc(
unsigned num, unsigned size,
- char *file,
+ const char *file,
int line)
{
StatsPtr ptr;
@@ -475,7 +475,7 @@ void XtFree(char *ptr)
char *_XtHeapMalloc(
Heap *heap,
Cardinal size,
- char *file,
+ const char *file,
int line)
{
StatsPtr ptr;
@@ -493,7 +493,7 @@ char *_XtHeapMalloc(
return retval;
}
-void _XtHeapFree(register XtPointer heap)
+void _XtHeapFree(Heap* heap)
{
register StatsPtr mem, next;
@@ -517,7 +517,7 @@ void _XtHeapFree(register XtPointer heap)
#include <stdio.h>
-void _XtPrintMemory(char * filename)
+void _XtPrintMemory(const char * filename)
{
register StatsPtr mem;
FILE *f;
@@ -527,10 +527,10 @@ void _XtPrintMemory(char * filename)
else
f = fopen(filename, "w");
LOCK_PROCESS;
- fprintf(f, "total size: %d\n", ActiveXtMemory);
+ fprintf(f, "total size: %lu\n", ActiveXtMemory);
for (mem = XtMemory; mem; mem = mem->next) {
if (mem->file)
- fprintf(f, "size: %6d seq: %5d %12s(%4d) %s\n",
+ fprintf(f, "size: %6d seq: %5lu %12s(%4d) %s\n",
mem->size, mem->seq,
mem->file, mem->line, mem->heap ? "heap" : "");
}
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
index 49bec47..de41b53 100644
--- a/src/Intrinsic.c
+++ b/src/Intrinsic.c
@@ -1229,7 +1229,7 @@ static String ExtractLocaleName(
strncpy(buf, start, (size_t) len);
*(buf + len) = '\0';
# ifdef WHITEFILL
- for (temp = buf; temp = strchr(temp, ' '); )
+ for (temp = buf; (temp = strchr(temp, ' ')) != NULL; )
*temp++ = '-';
# endif
return buf;
@@ -1239,10 +1239,10 @@ static String ExtractLocaleName(
# ifdef WHITEFILL
if (strchr(lang, ' ')) {
if (buf != NULL) XtFree (buf);
- else buf = XtMalloc (strlen (lang) + 1);
+ else buf = XtMalloc ((Cardinal)strlen (lang) + 1);
if (buf == NULL) return NULL;
strcpy(buf, lang);
- for (temp = buf; temp = strchr(temp, ' '); )
+ for (temp = buf; (temp = strchr(temp, ' ')) != NULL; )
*temp++ = '-';
return buf;
}
diff --git a/src/Selection.c b/src/Selection.c
index 0e1a483..8c48dd7 100644
--- a/src/Selection.c
+++ b/src/Selection.c
@@ -1212,7 +1212,7 @@ static void HandleGetIncrement(
#ifdef XT_COPY_SELECTION
int size = (int) BYTELENGTH(length, info->format) + 1;
char *tmp = __XtMalloc((Cardinal) size);
- (void) memmove(tmp, value, size);
+ (void) memmove(tmp, value, (size_t) size);
XFree(value);
value = tmp;
#endif
@@ -1321,7 +1321,7 @@ Boolean HandleNormal(
if (value) { /* it could have been deleted after the SelectionNotify */
int size = (int) BYTELENGTH(length, info->format) + 1;
char *tmp = __XtMalloc((Cardinal) size);
- (void) memmove(tmp, value, size);
+ (void) memmove(tmp, value, (size_t) size);
XFree(value);
value = (unsigned char *) tmp;
}
@@ -2206,7 +2206,7 @@ void XtGetSelectionParameters(
if (*value_return) {
int size = (int) BYTELENGTH(*length_return, *format_return) + 1;
char *tmp = __XtMalloc((Cardinal) size);
- (void) memmove(tmp, *value_return, size);
+ (void) memmove(tmp, *value_return, (size_t) size);
XFree(*value_return);
*value_return = tmp;
}
diff --git a/src/TMaction.c b/src/TMaction.c
index d1ca2ca..84ba2a0 100644
--- a/src/TMaction.c
+++ b/src/TMaction.c
@@ -476,11 +476,12 @@ static XtActionProc *EnterBindCache(
bindCache->widgetClass = XtClass(w);
if (_XtGlobalTM.numBindCache == _XtGlobalTM.bindCacheTblSize)
{
- _XtGlobalTM.bindCacheTblSize += 16;
+ _XtGlobalTM.bindCacheTblSize =
+ (TMShortCard)(_XtGlobalTM.bindCacheTblSize + 16);
_XtGlobalTM.bindCacheTbl = (TMBindCache *)
XtRealloc((char *)_XtGlobalTM.bindCacheTbl,
- ((_XtGlobalTM.bindCacheTblSize) *
- sizeof(TMBindCache)));
+ (Cardinal)((_XtGlobalTM.bindCacheTblSize) *
+ sizeof(TMBindCache)));
}
_XtGlobalTM.bindCacheTbl[_XtGlobalTM.numBindCache++] = bindCache;
#endif /* TRACE_TM */
diff --git a/src/TMstate.c b/src/TMstate.c
index 0856909..910788a 100644
--- a/src/TMstate.c
+++ b/src/TMstate.c
@@ -1423,10 +1423,10 @@ XtTranslations _XtCreateXlations(
#ifdef TRACE_TM
LOCK_PROCESS;
if (_XtGlobalTM.numTms == _XtGlobalTM.tmTblSize) {
- _XtGlobalTM.tmTblSize += 16;
+ _XtGlobalTM.tmTblSize = (TMShortCard)(_XtGlobalTM.tmTblSize + 16);
_XtGlobalTM.tmTbl = (XtTranslations *)
XtRealloc((char *)_XtGlobalTM.tmTbl,
- _XtGlobalTM.tmTblSize * sizeof(XtTranslations));
+ (Cardinal)(_XtGlobalTM.tmTblSize * sizeof(XtTranslations)));
}
_XtGlobalTM.tmTbl[_XtGlobalTM.numTms++] = xlations;
UNLOCK_PROCESS;
@@ -1601,7 +1601,7 @@ void _XtAddEventSeqToStateTree(
AmbigActions(initialEvent, state, stateTree);
(*state)->actions = eventSeq->actions;
#ifdef TRACE_TM
- LOCK_PROCESS
+ LOCK_PROCESS;
_XtGlobalTM.numComplexActions++;
UNLOCK_PROCESS;
#endif /* TRACE_TM */