summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-14 23:16:17 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-09-06 23:22:20 -0700
commit485fa790ca73929a397fe1e243a5f610c8f2c197 (patch)
tree86e4ef4aa11d4f1e0ead4f616e84092186e771cc
parentf3f5a46235d933b3466823f82115b2f05e0c9e95 (diff)
Convert ValueRec structures from unsigned long to uint32_t values
Used for GC struct members, which are defined in the protocol as 32-bit, so no need to waste time and memory copying into 64-bit longs everywhere Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--print11.c4
-rw-r--r--prtype.c2
-rw-r--r--table11.c16
-rw-r--r--x11.h16
4 files changed, 19 insertions, 19 deletions
diff --git a/print11.c b/print11.c
index b96e5ac..4bf74a4 100644
--- a/print11.c
+++ b/print11.c
@@ -2205,9 +2205,9 @@ FreePixmap(FD fd, const unsigned char *buf)
PrintField(buf, 4, 4, PIXMAP, "pixmap");
}
-static const unsigned long GCDefaults[] = {
+static const uint32_t GCDefaults[] = {
3, /* function GXcopy */
- ~0, /* planemask */
+ (uint32_t) ~0, /* planemask */
0, /* foreground */
1, /* background */
0, /* line width */
diff --git a/prtype.c b/prtype.c
index 5c1f986..8d4e06f 100644
--- a/prtype.c
+++ b/prtype.c
@@ -1070,7 +1070,7 @@ DumpHexBuffer(const unsigned char *buf, long n)
}
void
-PrintValueRec(unsigned long key, unsigned long cmask, short ctype)
+PrintValueRec(uint32_t key, uint32_t cmask, short ctype)
{
unsigned char *values;
struct ValueListEntry *p;
diff --git a/table11.c b/table11.c
index aaf7a48..3463173 100644
--- a/table11.c
+++ b/table11.c
@@ -128,7 +128,7 @@ ValuePtr buckets[HASH_SIZE];
#define HASH(key) ((key) % HASH_SIZE)
ValuePtr
-GetValueRec(unsigned long key)
+GetValueRec(uint32_t key)
{
ValuePtr *bucket, value;
@@ -141,15 +141,15 @@ GetValueRec(unsigned long key)
}
void
-CreateValueRec(unsigned long key, int size, const unsigned long *def)
+CreateValueRec(uint32_t key, int size, const uint32_t *def)
{
ValuePtr *bucket, value;
bucket = &buckets[HASH(key)];
- value = malloc(sizeof(ValueRec) + (size * sizeof(unsigned long)));
+ value = malloc(sizeof(ValueRec) + (size * sizeof(uint32_t)));
if (!value)
return;
- value->values = (unsigned long *) (value + 1);
+ value->values = (uint32_t *) (value + 1);
for (int i = 0; i < size; i++)
value->values[i] = ILong((const unsigned char *) (def + i));
value->size = size;
@@ -159,7 +159,7 @@ CreateValueRec(unsigned long key, int size, const unsigned long *def)
}
void
-DeleteValueRec(unsigned long key)
+DeleteValueRec(uint32_t key)
{
ValuePtr *bucket, value;
@@ -174,11 +174,11 @@ DeleteValueRec(unsigned long key)
}
void
-SetValueRec(unsigned long key,
+SetValueRec(uint32_t key,
const unsigned char *control,
short clength, short ctype, const unsigned char *values)
{
- long cmask;
+ uint32_t cmask;
struct ValueListEntry *p;
ValuePtr value;
int i;
@@ -201,7 +201,7 @@ SetValueRec(unsigned long key,
/* the ctype is a set type, so this code is similar to PrintSET */
for (p = TD[ctype].ValueList, i = 0; p != NULL; p = p->Next, i++) {
if ((p->Value & cmask) != 0) {
- memcpy(&value->values[i], values, sizeof(unsigned long));
+ memcpy(&value->values[i], values, sizeof(uint32_t));
values += 4;
}
}
diff --git a/x11.h b/x11.h
index cbe0c86..6cdf270 100644
--- a/x11.h
+++ b/x11.h
@@ -512,19 +512,19 @@ extern struct ConnState *CS;
typedef struct _Value {
struct _Value *next;
- unsigned long key;
+ uint32_t key;
int size;
- unsigned long *values;
+ uint32_t *values;
} ValueRec, *ValuePtr;
-extern ValuePtr GetValueRec(unsigned long key);
-extern void CreateValueRec(unsigned long key, int size,
- const unsigned long *def);
-extern void DeleteValueRec(unsigned long key);
-extern void SetValueRec(unsigned long key, const unsigned char *control,
+extern ValuePtr GetValueRec(uint32_t key);
+extern void CreateValueRec(uint32_t key, int size,
+ const uint32_t *def);
+extern void DeleteValueRec(uint32_t key);
+extern void SetValueRec(uint32_t key, const unsigned char *control,
short clength, short ctype,
const unsigned char *values);
-extern void PrintValueRec(unsigned long key, unsigned long cmask, short ctype);
+extern void PrintValueRec(uint32_t key, uint32_t cmask, short ctype);
/* ************************************************************ */
/* */