diff options
| -rw-r--r-- | c_src/permdb.c | 28 | 
1 files changed, 18 insertions, 10 deletions
| diff --git a/c_src/permdb.c b/c_src/permdb.c index 47c9641..9610f82 100644 --- a/c_src/permdb.c +++ b/c_src/permdb.c @@ -208,7 +208,8 @@ validate_checksum(struct commit_info *commit, buffered_file *file)          dprintf(READ,                  (stderr,                   "validate_checksum: read from file: length %llu start %llu\n", -                 commit->length, commit->start)); +                 (long long unsigned) commit->length, +                 (long long unsigned) commit->start));          unsigned char *checksumdata =                  bf_read(file, commit->start, commit->length, NULL); @@ -290,12 +291,14 @@ datafile_verify_file(buffered_file *file)          node_offset offset = bf_lastcommit(file); -        dprintf(READ, (stderr, "verifying commit: %llu\n", offset)); +        dprintf(READ, (stderr, "verifying commit: %llu\n", +                       (long long unsigned) offset));          struct commit_info *data_commit =                  read_data_commit_backward(file, &offset);          if (data_commit == NULL || validate_checksum(data_commit, file) < 0) { -                dprintf(READ, (stderr, "commit broken: %llu\n", offset)); +                dprintf(READ, (stderr, "commit broken: %llu\n", +                               (long long unsigned) offset));                  free(data_commit);                  return -1;          } @@ -324,7 +327,8 @@ read_data_commit(buffered_file *file, node_offset *offset)          }          *offset += sizeof(uint32_t);          struct commit_info *commit = malloc(sizeof(struct commit_info)); -        dprintf(READ, (stderr, "read commit: %llu\n", *offset)); +        dprintf(READ, (stderr, "read commit: %llu\n", +                       (long long unsigned) *offset));          dprinthex(READ, data, sizeof(uint32_t) + SHA256_DIGEST_SIZE);          commit->length = read_be32(data);          commit->start = *offset - commit->length; @@ -372,18 +376,21 @@ rebuild_index_file(permdb_object *state)                          unsigned char *datakey =                                  readdatakeyandlen(state, offset, &datalen);                          dprintf(REBUILD, -                                (stderr, "entry %llu: %zu\n", offset, datalen)); +                                (stderr, "entry %llu: %zu\n", +                                 (long long unsigned) offset, datalen));                          int result =                                  addvalue(state, datakey, keylen, NULL, 0, offset);                          free(datakey);                          if (result < 0) {                                  fprintf(stderr, "error updating index tree for " -                                        "entry at %llu\n", offset); +                                        "entry at %llu\n", +                                        (long long unsigned) offset);                                  free(cookie);                                  return -1;                          }                          if (result == 0) { -                                fprintf(stderr, "duplicate key at %llu", offset); +                                fprintf(stderr, "duplicate key at %llu", +                                        (long long unsigned) offset);                                  free(cookie);                                  return -1;                          } @@ -397,8 +404,8 @@ rebuild_index_file(permdb_object *state)                                  read_data_commit_forward(state->datafile,                                                           &offset);                          dprintf(REBUILD, -                                (stderr, "verifying commit: %llu %p\n", offset, -                                 data_commit)); +                                (stderr, "verifying commit: %llu %p\n", +                                 (long long unsigned) offset, data_commit));                          if (data_commit == NULL                              || validate_checksum(data_commit,                                                   state->datafile) < 0) { @@ -410,7 +417,8 @@ rebuild_index_file(permdb_object *state)                          }                          free(data_commit);                  } else { -                        fprintf(stderr, "not a cookie at %llu:\n", offset); +                        fprintf(stderr, "not a cookie at %llu:\n", +                                (long long unsigned) offset);                          print_hex(cookie, sizeof(data_entry_cookie));                          free(cookie);                          return -1; | 
