Browse Source

* imdb_read_rec() : chg return value and describe

master
Alex 'AdUser' Z 10 years ago
parent
commit
983f3f0711
  1. 8
      src/database.c
  2. 4
      src/database.h

8
src/database.c

@ -142,7 +142,13 @@ int imdb_read_rec(imdb_t *db, imdb_rec_t *rec)
DB_SEEK(db, rec->num * IMDB_REC_LEN);
DB_READ(db, rec->data, IMDB_REC_LEN);
return bytes / IMDB_REC_LEN;
if (bytes != IMDB_REC_LEN)
return -1;
if (rec->data[0] != 0xFF)
return 0;
return 1;
}
int imdb_write_rec(imdb_t *db, imdb_rec_t *rec)

4
src/database.h

@ -74,6 +74,10 @@ typedef struct {
float diff;
} imdb_match_t;
/**
* @return 1 on success, 0 if record not used
* and -1 if record number not exists,
*/
extern int imdb_read_rec (imdb_t *db, imdb_rec_t *rec);
extern int imdb_write_rec(imdb_t *db, imdb_rec_t *rec);

Loading…
Cancel
Save