From 97610277154e09a37793190d8e6d3d2a9d111fc1 Mon Sep 17 00:00:00 2001 From: pixel Date: Fri, 6 Jul 2007 14:23:50 +0000 Subject: Adding close() and init() functions. --- mpq-bios.c | 13 +++++++++++++ mpq-bios.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/mpq-bios.c b/mpq-bios.c index bbca00c..bfc21df 100644 --- a/mpq-bios.c +++ b/mpq-bios.c @@ -135,6 +135,19 @@ static int read_data(mpq_archive_t * mpq_a, void * buf, size_t l) { return 1; } +void mpqlib_init() { + __mpqlib_init_cryptography(); +} + +void mpqlib_close_archive(mpq_archive_t * mpq_a) { + if (mpq_a) { + if (mpq_a->mpq_i->closeit) { + close(mpq_a->mpq_i->fd); + } + free_archive(mpq_a); + } +} + mpq_archive_t * mpqlib_reopen_archive(int fd) { struct mpq_internals_t * mpq_i; mpq_archive_t * mpq_a; diff --git a/mpq-bios.h b/mpq-bios.h index dd3c634..0a2767e 100644 --- a/mpq-bios.h +++ b/mpq-bios.h @@ -13,8 +13,10 @@ typedef struct { extern "C" { #endif +void mpqlib_init(); mpq_archive_t * mpqlib_open_archive(const char * fname); mpq_archive_t * mpqlib_reopen_archive(int fd); +void mpqlib_close_archive(mpq_archive_t *); #ifdef __cplusplus } -- cgit v1.2.3