Commit bb4c5c75 authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: use unsigned indexes in data init (large tables were overflowing)

parent ac271b54
...@@ -609,7 +609,7 @@ static inline dataentry ...@@ -609,7 +609,7 @@ static inline dataentry
de->tid = fd; de->tid = fd;
de->hasdata = false; de->hasdata = false;
sprintf(de->data, "XID=%d", xid); sprintf(de->data, "XID=%u", xid);
de->end = strlen(de->data); de->end = strlen(de->data);
if (de->end > dtbl.w_stats.data_hi) if (de->end > dtbl.w_stats.data_hi)
dtbl.w_stats.data_hi = de->end; dtbl.w_stats.data_hi = de->end;
......
...@@ -53,13 +53,13 @@ DATA_Init(void) ...@@ -53,13 +53,13 @@ DATA_Init(void)
dataentry *entryptr; dataentry *entryptr;
char *bufptr; char *bufptr;
int bufsize = config.maxdata; unsigned bufsize = config.maxdata;
/* /*
* we want enough space to accomodate all open and done records * we want enough space to accomodate all open and done records
* *
*/ */
int entries = (1 << config.maxopen_scale) + config.maxdone; unsigned entries = (1 << config.maxopen_scale) + config.maxdone;
entryptr = (dataentry *) calloc(entries, sizeof(dataentry)); entryptr = (dataentry *) calloc(entries, sizeof(dataentry));
if (entryptr == NULL) if (entryptr == NULL)
...@@ -82,7 +82,7 @@ DATA_Init(void) ...@@ -82,7 +82,7 @@ DATA_Init(void)
dtbl.buf = bufptr; dtbl.buf = bufptr;
dtbl.nfree = 0; dtbl.nfree = 0;
for (int i = 0; i < entries; i++) { for (unsigned i = 0; i < entries; i++) {
dtbl.entry[i].magic = DATA_MAGIC; dtbl.entry[i].magic = DATA_MAGIC;
dtbl.entry[i].state = DATA_EMPTY; dtbl.entry[i].state = DATA_EMPTY;
dtbl.entry[i].hasdata = false; dtbl.entry[i].hasdata = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment