summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/X11/InitialI.h2
-rw-r--r--include/X11/Intrinsic.h12
-rw-r--r--src/Alloc.c22
-rw-r--r--src/Selection.c6
4 files changed, 24 insertions, 18 deletions
diff --git a/include/X11/InitialI.h b/include/X11/InitialI.h
index 224190d..f64a68d 100644
--- a/include/X11/InitialI.h
+++ b/include/X11/InitialI.h
@@ -209,7 +209,7 @@ extern void _XtHeapFree(Heap* heap);
extern char *_XtHeapMalloc(
Heap* /* heap */,
Cardinal /* size */,
- char * /* file */,
+ const char */* file */,
int /* line */
);
diff --git a/include/X11/Intrinsic.h b/include/X11/Intrinsic.h
index 7378101..cf8d3fe 100644
--- a/include/X11/Intrinsic.h
+++ b/include/X11/Intrinsic.h
@@ -1867,21 +1867,21 @@ extern Cardinal XtAsprintf(
extern char *_XtMalloc( /* implementation-private */
Cardinal /* size */,
- char * /* file */,
+ const char */* file */,
int /* line */
);
extern char *_XtRealloc( /* implementation-private */
char * /* ptr */,
Cardinal /* size */,
- char * /* file */,
+ const char */* file */,
int /* line */
);
extern char *_XtCalloc( /* implementation-private */
Cardinal /* num */,
Cardinal /* size */,
- char * /* file */,
+ const char */* file */,
int /* line */
);
@@ -1889,6 +1889,12 @@ extern void _XtFree( /* implementation-private */
char * /* ptr */
);
+extern Boolean _XtIsValidPointer( /* implementation-private */
+ char * /* ptr */);
+
+extern void _XtPrintMemory( /* implementation-private */
+ const char */* filename */);
+
#define XtMalloc(size) _XtMalloc(size, __FILE__, __LINE__)
#define XtRealloc(ptr,size) _XtRealloc(ptr, size, __FILE__, __LINE__)
#define XtCalloc(num,size) _XtCalloc(num, size, __FILE__, __LINE__)
diff --git a/src/Alloc.c b/src/Alloc.c
index d75898c..7013f1c 100644
--- a/src/Alloc.c
+++ b/src/Alloc.c
@@ -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/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;
}