Crossfire Server, Trunk
|
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | mtar_header_t |
struct | mtar_t |
Macros | |
#define | MTAR_VERSION "0.1.0" |
Typedefs | |
typedef struct mtar_t | mtar_t |
Enumerations | |
enum | { MTAR_ESUCCESS = 0, MTAR_EFAILURE = -1, MTAR_EOPENFAIL = -2, MTAR_EREADFAIL = -3, MTAR_EWRITEFAIL = -4, MTAR_ESEEKFAIL = -5, MTAR_EBADCHKSUM = -6, MTAR_ENULLRECORD = -7, MTAR_ENOTFOUND = -8 } |
enum | { MTAR_TREG = '0', MTAR_TLNK = '1', MTAR_TSYM = '2', MTAR_TCHR = '3', MTAR_TBLK = '4', MTAR_TDIR = '5', MTAR_TFIFO = '6' } |
Functions | |
int | mtar_close (mtar_t *tar) |
int | mtar_finalize (mtar_t *tar) |
int | mtar_find (mtar_t *tar, const char *name, mtar_header_t *h) |
int | mtar_next (mtar_t *tar) |
int | mtar_open (mtar_t *tar, const char *filename, const char *mode) |
int | mtar_read_data (mtar_t *tar, void *ptr, unsigned size) |
int | mtar_read_header (mtar_t *tar, mtar_header_t *h) |
int | mtar_rewind (mtar_t *tar) |
int | mtar_seek (mtar_t *tar, unsigned pos) |
const char * | mtar_strerror (int err) |
int | mtar_write_data (mtar_t *tar, const void *data, unsigned size) |
int | mtar_write_dir_header (mtar_t *tar, const char *name) |
int | mtar_write_file_header (mtar_t *tar, const char *name, unsigned size) |
int | mtar_write_header (mtar_t *tar, const mtar_header_t *h) |
#define MTAR_VERSION "0.1.0" |
Copyright (c) 2017 rxi
This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See microtar.c
for details.
Definition at line 14 of file microtar.h.
Definition at line 49 of file microtar.h.
anonymous enum |
Enumerator | |
---|---|
MTAR_ESUCCESS | |
MTAR_EFAILURE | |
MTAR_EOPENFAIL | |
MTAR_EREADFAIL | |
MTAR_EWRITEFAIL | |
MTAR_ESEEKFAIL | |
MTAR_EBADCHKSUM | |
MTAR_ENULLRECORD | |
MTAR_ENOTFOUND |
Definition at line 16 of file microtar.h.
anonymous enum |
Enumerator | |
---|---|
MTAR_TREG | |
MTAR_TLNK | |
MTAR_TSYM | |
MTAR_TCHR | |
MTAR_TBLK | |
MTAR_TDIR | |
MTAR_TFIFO |
Definition at line 28 of file microtar.h.
int mtar_close | ( | mtar_t * | tar | ) |
Definition at line 211 of file microtar.cpp.
References mtar_t::close.
Referenced by assets_pack(), TarLoader::load(), and mtar_open().
int mtar_finalize | ( | mtar_t * | tar | ) |
Definition at line 373 of file microtar.cpp.
References write_null_bytes().
Referenced by assets_pack().
int mtar_find | ( | mtar_t * | tar, |
const char * | name, | ||
mtar_header_t * | h | ||
) |
Definition at line 244 of file microtar.cpp.
References hall_of_fame::header, MTAR_ENOTFOUND, MTAR_ENULLRECORD, MTAR_ESUCCESS, mtar_next(), mtar_read_header(), mtar_rewind(), and give::name.
int mtar_next | ( | mtar_t * | tar | ) |
Definition at line 230 of file microtar.cpp.
References mtar_read_header(), mtar_seek(), mtar_t::pos, round_up(), and mtar_header_t::size.
Referenced by TarLoader::load(), and mtar_find().
int mtar_open | ( | mtar_t * | tar, |
const char * | filename, | ||
const char * | mode | ||
) |
Definition at line 177 of file microtar.cpp.
References mtar_t::close, file_close(), file_read(), file_seek(), file_write(), npc_dialog::filename, mtar_close(), MTAR_EOPENFAIL, MTAR_ESUCCESS, mtar_read_header(), mtar_t::read, mtar_t::seek, mtar_t::stream, and mtar_t::write.
Referenced by assets_pack().
int mtar_read_data | ( | mtar_t * | tar, |
void * | ptr, | ||
unsigned | size | ||
) |
Definition at line 290 of file microtar.cpp.
References mtar_t::last_header, MTAR_ESUCCESS, mtar_read_header(), mtar_seek(), mtar_t::pos, mtar_t::remaining_data, mtar_header_t::size, and tread().
Referenced by bufferreader_init_from_tar_file().
int mtar_read_header | ( | mtar_t * | tar, |
mtar_header_t * | h | ||
) |
Definition at line 270 of file microtar.cpp.
References mtar_t::last_header, mtar_seek(), mtar_t::pos, raw_to_header(), and tread().
Referenced by TarLoader::load(), mtar_find(), mtar_next(), mtar_open(), and mtar_read_data().
int mtar_rewind | ( | mtar_t * | tar | ) |
Definition at line 223 of file microtar.cpp.
References mtar_t::last_header, mtar_seek(), and mtar_t::remaining_data.
Referenced by mtar_find().
int mtar_seek | ( | mtar_t * | tar, |
unsigned | pos | ||
) |
Definition at line 216 of file microtar.cpp.
References mtar_t::pos, and mtar_t::seek.
Referenced by mtar_next(), mtar_read_data(), mtar_read_header(), and mtar_rewind().
const char* mtar_strerror | ( | int | err | ) |
Definition at line 140 of file microtar.cpp.
References MTAR_EBADCHKSUM, MTAR_EFAILURE, MTAR_ENOTFOUND, MTAR_ENULLRECORD, MTAR_EOPENFAIL, MTAR_EREADFAIL, MTAR_ESEEKFAIL, MTAR_ESUCCESS, and MTAR_EWRITEFAIL.
int mtar_write_data | ( | mtar_t * | tar, |
const void * | data, | ||
unsigned | size | ||
) |
Definition at line 357 of file microtar.cpp.
References navar-midane_time::data, MTAR_ESUCCESS, mtar_t::pos, mtar_t::remaining_data, round_up(), twrite(), and write_null_bytes().
Referenced by add_to_tar().
int mtar_write_dir_header | ( | mtar_t * | tar, |
const char * | name | ||
) |
Definition at line 345 of file microtar.cpp.
References mtar_header_t::mode, MTAR_TDIR, mtar_write_header(), give::name, mtar_header_t::name, and mtar_header_t::type.
int mtar_write_file_header | ( | mtar_t * | tar, |
const char * | name, | ||
unsigned | size | ||
) |
Definition at line 332 of file microtar.cpp.
References mtar_header_t::mode, MTAR_TREG, mtar_write_header(), give::name, mtar_header_t::name, mtar_header_t::size, and mtar_header_t::type.
int mtar_write_header | ( | mtar_t * | tar, |
const mtar_header_t * | h | ||
) |
Definition at line 323 of file microtar.cpp.
References header_to_raw(), mtar_t::remaining_data, mtar_header_t::size, and twrite().
Referenced by add_to_tar(), mtar_write_dir_header(), and mtar_write_file_header().