Crossfire Server, Trunk
|
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "microtar.h"
Go to the source code of this file.
Data Structures | |
struct | mtar_raw_header_t |
Functions | |
static unsigned | checksum (const mtar_raw_header_t *rh) |
static int | file_close (mtar_t *tar) |
static int | file_read (mtar_t *tar, void *data, unsigned size) |
static int | file_seek (mtar_t *tar, unsigned offset) |
static int | file_write (mtar_t *tar, const void *data, unsigned size) |
static int | header_to_raw (mtar_raw_header_t *rh, const mtar_header_t *h) |
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) |
static int | raw_to_header (mtar_header_t *h, const mtar_raw_header_t *rh) |
static unsigned | round_up (unsigned n, unsigned incr) |
static int | tread (mtar_t *tar, void *data, unsigned size) |
static int | twrite (mtar_t *tar, const void *data, unsigned size) |
static int | write_null_bytes (mtar_t *tar, int n) |
|
static |
Definition at line 49 of file microtar.cpp.
References offsetof, altar_valkyrie::res, and is_valid_types_gen::type.
Referenced by header_to_raw(), raw_to_header(), save_player(), and send_image_info().
|
static |
Definition at line 171 of file microtar.cpp.
References MTAR_ESUCCESS, and mtar_t::stream.
Referenced by mtar_open().
|
static |
Definition at line 161 of file microtar.cpp.
References navar-midane_time::data, MTAR_EREADFAIL, MTAR_ESUCCESS, altar_valkyrie::res, and mtar_t::stream.
Referenced by mtar_open().
|
static |
Definition at line 166 of file microtar.cpp.
References MTAR_ESEEKFAIL, MTAR_ESUCCESS, altar_valkyrie::res, and mtar_t::stream.
Referenced by mtar_open().
|
static |
Definition at line 156 of file microtar.cpp.
References navar-midane_time::data, MTAR_ESUCCESS, MTAR_EWRITEFAIL, altar_valkyrie::res, and mtar_t::stream.
Referenced by mtar_open().
|
static |
Definition at line 118 of file microtar.cpp.
References mtar_raw_header_t::checksum, checksum(), mtar_raw_header_t::linkname, mtar_header_t::linkname, mtar_raw_header_t::mode, mtar_header_t::mode, MTAR_ESUCCESS, MTAR_TREG, mtar_raw_header_t::mtime, mtar_header_t::mtime, mtar_raw_header_t::name, mtar_header_t::name, mtar_raw_header_t::owner, mtar_header_t::owner, mtar_raw_header_t::size, mtar_header_t::size, mtar_raw_header_t::type, and mtar_header_t::type.
Referenced by mtar_write_header().
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().
|
static |
Definition at line 90 of file microtar.cpp.
References mtar_raw_header_t::checksum, checksum(), mtar_raw_header_t::linkname, mtar_header_t::linkname, mtar_raw_header_t::mode, mtar_header_t::mode, MTAR_EBADCHKSUM, MTAR_ENULLRECORD, MTAR_ESUCCESS, mtar_raw_header_t::mtime, mtar_header_t::mtime, mtar_raw_header_t::name, mtar_header_t::name, mtar_raw_header_t::owner, mtar_header_t::owner, mtar_raw_header_t::size, mtar_header_t::size, mtar_raw_header_t::type, and mtar_header_t::type.
Referenced by mtar_read_header().
|
static |
Definition at line 44 of file microtar.cpp.
Referenced by mtar_next(), and mtar_write_data().
|
static |
Definition at line 63 of file microtar.cpp.
References navar-midane_time::data, mtar_t::pos, and mtar_t::read.
Referenced by mtar_read_data(), and mtar_read_header().
|
static |
Definition at line 70 of file microtar.cpp.
References navar-midane_time::data, mtar_t::pos, and mtar_t::write.
Referenced by mtar_write_data(), mtar_write_header(), and write_null_bytes().
|
static |
Definition at line 77 of file microtar.cpp.
References MTAR_ESUCCESS, and twrite().
Referenced by mtar_finalize(), and mtar_write_data().