Browse Source

* rename type : block_t -> imdb_block_t

master
Alex 'AdUser' Z 10 years ago
parent
commit
ec4ba6435c
  1. 6
      src/database.c
  2. 6
      src/database.h
  3. 4
      src/util.c

6
src/database.c

@ -132,7 +132,7 @@ int imdb_write_rec(imdb_t *db, imdb_rec_t *rec)
return bytes / IMDB_REC_LEN; return bytes / IMDB_REC_LEN;
} }
int imdb_read_blk(imdb_t *db, block_t *blk) int imdb_read_blk(imdb_t *db, imdb_block_t *blk)
{ {
ssize_t bytes = 0; ssize_t bytes = 0;
@ -196,7 +196,7 @@ int imdb_search(imdb_t *db, imdb_rec_t *sample, float tresh, imdb_match_t **matc
{ {
const int blk_size = 4096; const int blk_size = 4096;
uint64_t found = 0; uint64_t found = 0;
block_t blk; imdb_block_t blk;
unsigned int i = 0; unsigned int i = 0;
unsigned char *p = NULL, *t = NULL; unsigned char *p = NULL, *t = NULL;
float diff = 0.0; float diff = 0.0;
@ -205,7 +205,7 @@ int imdb_search(imdb_t *db, imdb_rec_t *sample, float tresh, imdb_match_t **matc
assert(sample != NULL); assert(sample != NULL);
assert(matches != NULL); assert(matches != NULL);
memset(&blk, 0x0, sizeof(block_t)); memset(&blk, 0x0, sizeof(imdb_block_t));
blk.start = 1; blk.start = 1;
blk.records = blk_size; blk.records = blk_size;

6
src/database.h

@ -16,7 +16,7 @@ typedef struct {
uint64_t start; uint64_t start;
size_t records; size_t records;
unsigned char *data; unsigned char *data;
} block_t; } imdb_block_t;
/** /**
Database header format - fixed length, 48 bytes Database header format - fixed length, 48 bytes
@ -74,8 +74,8 @@ extern int imdb_close(imdb_t *db);
extern int imdb_read_rec (imdb_t *db, imdb_rec_t *rec); extern int imdb_read_rec (imdb_t *db, imdb_rec_t *rec);
extern int imdb_write_rec(imdb_t *db, imdb_rec_t *rec); extern int imdb_write_rec(imdb_t *db, imdb_rec_t *rec);
extern int imdb_read_blk (imdb_t *db, block_t *blk); extern int imdb_read_blk (imdb_t *db, imdb_block_t *blk);
extern int imdb_write_blk(imdb_t *db, block_t *blk); extern int imdb_write_blk(imdb_t *db, imdb_block_t *blk);
extern int imdb_read_list (imdb_t *db, imdb_rec_t *list, size_t list_len); extern int imdb_read_list (imdb_t *db, imdb_rec_t *list, size_t list_len);
extern int imdb_write_list(imdb_t *db, imdb_rec_t *list, size_t list_len); extern int imdb_write_list(imdb_t *db, imdb_rec_t *list, size_t list_len);

4
src/util.c

@ -67,12 +67,12 @@ int db_usage_map(imdb_t *db, unsigned short int cols)
unsigned int i, j = 0; unsigned int i, j = 0;
unsigned char *p, *t; unsigned char *p, *t;
char buf[256]; char buf[256];
block_t blk; imdb_block_t blk;
assert(db != NULL); assert(db != NULL);
assert(cols <= 256); assert(cols <= 256);
memset(&blk, 0x0, sizeof(block_t)); memset(&blk, 0x0, sizeof(imdb_block_t));
memset(buf, 0x0, sizeof(char) * 256); memset(buf, 0x0, sizeof(char) * 256);
blk.start = 1; blk.start = 1;

Loading…
Cancel
Save