1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Feature: Added support to copy a digest

This commit is contained in:
Philipp Schafft 2020-10-21 18:41:33 +00:00
parent fa95e94c65
commit 2b9edf6fd1
2 changed files with 16 additions and 0 deletions

View File

@ -381,6 +381,21 @@ digest_t * digest_new(digest_algo_t algo)
return digest; return digest;
} }
digest_t * digest_copy(digest_t *digest)
{
digest_t *n;
if (!digest)
return NULL;
n = refobject_new__new(digest_t, NULL, NULL, NULL);
n->algo = digest->algo;
n->done = digest->done;
n->state = digest->state;
return n;
}
ssize_t digest_write(digest_t *digest, const void *data, size_t len) ssize_t digest_write(digest_t *digest, const void *data, size_t len)
{ {
if (!digest || !data) if (!digest || !data)

View File

@ -25,6 +25,7 @@ const char *digest_algo_id2str(digest_algo_t algo);
ssize_t digest_algo_length_bytes(digest_algo_t algo); ssize_t digest_algo_length_bytes(digest_algo_t algo);
digest_t * digest_new(digest_algo_t algo); digest_t * digest_new(digest_algo_t algo);
digest_t * digest_copy(digest_t *digest);
ssize_t digest_write(digest_t *digest, const void *data, size_t len); ssize_t digest_write(digest_t *digest, const void *data, size_t len);
ssize_t digest_read(digest_t *digest, void *buf, size_t len); ssize_t digest_read(digest_t *digest, void *buf, size_t len);