Преглед на файлове

Remove unused function bts_hashes.

master
Richard Nyberg преди 18 години
родител
ревизия
13607e007a
променени са 2 файла, в които са добавени 1 реда и са изтрити 36 реда
  1. +0
    -32
      misc/stream.c
  2. +1
    -4
      misc/stream.h

+ 0
- 32
misc/stream.c Целия файл

@@ -179,35 +179,3 @@ bts_sha(struct bt_stream *bts, off_t start, off_t length, uint8_t *hash)
SHA1_Final(hash, &ctx);
return err;
}

int
bts_hashes(struct metainfo *meta, fdcb_t fd_cb, hashcb_t cb, void *arg)
{
int err = 0;
uint8_t hash[SHA_DIGEST_LENGTH];
uint32_t piece;
struct bt_stream *bts;
off_t plen = meta->piece_length;
off_t llen = meta->total_length % plen;

if ((err = bts_open(&bts, meta, fd_cb, arg)) != 0)
return err;

for (piece = 0; piece < meta->npieces; piece++) {
off_t start = piece * plen;
if (piece < meta->npieces - 1)
err = bts_sha(bts, start, plen, hash);
else
err = bts_sha(bts, start, llen, hash);

if (err == 0)
cb(piece, hash, arg);
else if (err == ENOENT) {
cb(piece, NULL, arg);
err = 0;
} else
break;
}
bts_close(bts);
return err;
}

+ 1
- 4
misc/stream.h Целия файл

@@ -18,12 +18,9 @@ struct bt_stream {

int bts_open(struct bt_stream **res, unsigned nfiles, struct mi_file *files,
fdcb_t fd_cb, void *fd_arg);
int bts_close(struct bt_stream *bts);
int bts_get(struct bt_stream *bts, off_t off, uint8_t *buf, size_t len);
int bts_put(struct bt_stream *bts, off_t off, const uint8_t *buf, size_t len);
int bts_close(struct bt_stream *bts);

int bts_sha(struct bt_stream *bts, off_t start, off_t length, uint8_t *hash);
int bts_hashes(struct metainfo *meta, fdcb_t fd_cb, hashcb_t hash_cb,
void *arg);

#endif

Loading…
Отказ
Запис