mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Merge remote branch 'pietern/issue-300'
This commit is contained in:
commit
fc09b9f449
@ -65,8 +65,8 @@
|
|||||||
/* data type to hold offset in file and size */
|
/* data type to hold offset in file and size */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *data;
|
void *data;
|
||||||
unsigned long size;
|
uint64_t size;
|
||||||
unsigned long offset;
|
uint64_t offset;
|
||||||
} pos;
|
} pos;
|
||||||
|
|
||||||
static unsigned char level = 0;
|
static unsigned char level = 0;
|
||||||
@ -77,8 +77,8 @@ static pos positions[16];
|
|||||||
/* Hold a stack of errors */
|
/* Hold a stack of errors */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char error[16][1024];
|
char error[16][1024];
|
||||||
unsigned long offset[16];
|
uint64_t offset[16];
|
||||||
unsigned int level;
|
uint32_t level;
|
||||||
} errors_t;
|
} errors_t;
|
||||||
static errors_t errors;
|
static errors_t errors;
|
||||||
|
|
||||||
@ -494,15 +494,15 @@ void printCentered(int indent, int width, char* body) {
|
|||||||
printf("%s %s %s\n", head, body, tail);
|
printf("%s %s %s\n", head, body, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printValid(int ops, int bytes) {
|
void printValid(uint64_t ops, uint64_t bytes) {
|
||||||
char body[80];
|
char body[80];
|
||||||
sprintf(body, "Processed %d valid opcodes (in %d bytes)", ops, bytes);
|
sprintf(body, "Processed %llu valid opcodes (in %llu bytes)", ops, bytes);
|
||||||
printCentered(4, 80, body);
|
printCentered(4, 80, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printSkipped(int bytes, int offset) {
|
void printSkipped(uint64_t bytes, uint64_t offset) {
|
||||||
char body[80];
|
char body[80];
|
||||||
sprintf(body, "Skipped %d bytes (resuming at 0x%08x)", bytes, offset);
|
sprintf(body, "Skipped %llu bytes (resuming at 0x%08llx)", bytes, offset);
|
||||||
printCentered(4, 80, body);
|
printCentered(4, 80, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,12 +536,12 @@ void printErrorStack(entry *e) {
|
|||||||
|
|
||||||
/* display error stack */
|
/* display error stack */
|
||||||
for (i = 0; i < errors.level; i++) {
|
for (i = 0; i < errors.level; i++) {
|
||||||
printf("0x%08lx - %s\n", errors.offset[i], errors.error[i]);
|
printf("0x%08llx - %s\n", errors.offset[i], errors.error[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void process() {
|
void process() {
|
||||||
int i, num_errors = 0, num_valid_ops = 0, num_valid_bytes = 0;
|
uint64_t num_errors = 0, num_valid_ops = 0, num_valid_bytes = 0;
|
||||||
entry entry;
|
entry entry;
|
||||||
processHeader();
|
processHeader();
|
||||||
|
|
||||||
@ -558,7 +558,9 @@ void process() {
|
|||||||
num_valid_bytes = 0;
|
num_valid_bytes = 0;
|
||||||
|
|
||||||
/* search for next valid entry */
|
/* search for next valid entry */
|
||||||
unsigned long offset = positions[0].offset + 1;
|
uint64_t offset = positions[0].offset + 1;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
while (!entry.success && offset < positions[0].size) {
|
while (!entry.success && offset < positions[0].size) {
|
||||||
positions[1].offset = offset;
|
positions[1].offset = offset;
|
||||||
|
|
||||||
@ -606,9 +608,9 @@ void process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* print summary on errors */
|
/* print summary on errors */
|
||||||
if (num_errors > 0) {
|
if (num_errors) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Total unprocessable opcodes: %d\n", num_errors);
|
printf("Total unprocessable opcodes: %llu\n", num_errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,7 +622,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
unsigned long size;
|
size_t size;
|
||||||
struct stat stat;
|
struct stat stat;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user