Definition in file lbfileio.c.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lbfileio.h"
Go to the source code of this file.
Functions | |
void | write_int16_le_file (FILE *fp, unsigned short x) |
Writes 2-byte little-endian number to given FILE. | |
void | write_int16_le_buf (unsigned char *buff, unsigned short x) |
Writes 2-byte little-endian number into given buffer. | |
void | write_int32_le_file (FILE *fp, unsigned long x) |
Writes 4-byte little-endian number to given FILE. | |
void | write_int32_le_buf (unsigned char *buff, unsigned long x) |
Writes 4-byte little-endian number into given buffer. | |
long | read_int32_le_file (FILE *fp) |
Reads 4-byte little-endian number from given FILE. | |
long | read_int32_le_buf (const unsigned char *buff) |
Reads 4-byte little-endian number from given buffer. | |
unsigned short | read_int16_le_buf (const unsigned char *buff) |
Reads 2-byte little-endian number from given buffer. | |
unsigned short | read_int16_le_file (FILE *fp) |
Reads 2-byte little-endian number from given FILE. | |
long | read_int32_be_file (FILE *fp) |
Reads 4-byte big-endian number from given FILE. | |
long | read_int32_be_buf (const unsigned char *buff) |
Reads 4-byte big-endian number from given buffer. | |
unsigned short | read_int16_be_buf (const unsigned char *buff) |
Reads 2-byte big-endian number from given buffer. | |
unsigned short | read_int16_be_file (FILE *fp) |
Reads 2-byte big-endian number from given FILE. | |
void | write_int16_be_buf (unsigned char *buff, unsigned short x) |
Writes 2-byte big-endian number into given buffer. | |
void | write_int32_be_buf (unsigned char *buff, unsigned long x) |
Writes 4-byte big-endian number into given buffer. | |
long | file_length (char *path) |
Returns length of given file. | |
long | file_length_opened (FILE *fp) |
Returns length of opened file. | |
unsigned char | read_int8_buf (const unsigned char *buff) |
Reads 1-byte number from given buffer. | |
short | nth_bit (unsigned char c, short n) |
Returns the nth bit of character c. | |
short | nth_bit_fourbytes (unsigned char c[4], short n) |
Returns the nth bit of c. |
long file_length | ( | char * | path | ) | [inline] |
long file_length_opened | ( | FILE * | fp | ) | [inline] |
Returns length of opened file.
Value -1 means error.
Definition at line 203 of file lbfileio.c.
Referenced by read_datfile_data(), read_jtytabfile_data(), and read_tabfile_data().
short nth_bit | ( | unsigned char | c, | |
short | n | |||
) | [inline] |
Returns the nth bit of character c.
c | Source character. | |
n | Source bit number. |
Definition at line 233 of file lbfileio.c.
Referenced by nth_bit_fourbytes().
short nth_bit_fourbytes | ( | unsigned char | c[4], | |
short | n | |||
) | [inline] |
Returns the nth bit of c.
Goes like this: [31 30 29 28 27 26 25 24][...][...][7 6 5 4 3 2 1 0]
c | Source characters array. | |
n | Source bit number. |
Definition at line 250 of file lbfileio.c.
unsigned short read_int16_be_buf | ( | const unsigned char * | buff | ) | [inline] |
Reads 2-byte big-endian number from given buffer.
Definition at line 141 of file lbfileio.c.
Referenced by rnc_unpack().
unsigned short read_int16_be_file | ( | FILE * | fp | ) | [inline] |
unsigned short read_int16_le_buf | ( | const unsigned char * | buff | ) | [inline] |
Reads 2-byte little-endian number from given buffer.
Definition at line 93 of file lbfileio.c.
Referenced by bit_advance(), bitread_fix(), bitread_init(), get_clm_entry_base(), get_clm_entry_solid(), get_clm_entry_topcube(), load_cubedata(), load_dat(), load_flg(), load_slb(), load_textureanim(), load_tng(), and write_def_clm_source().
unsigned short read_int16_le_file | ( | FILE * | fp | ) | [inline] |
Reads 2-byte little-endian number from given FILE.
Definition at line 104 of file lbfileio.c.
Referenced by read_datfile_data().
long read_int32_be_buf | ( | const unsigned char * | buff | ) | [inline] |
Reads 4-byte big-endian number from given buffer.
Definition at line 128 of file lbfileio.c.
Referenced by rnc_plen(), rnc_ulen(), and rnc_unpack().
long read_int32_be_file | ( | FILE * | fp | ) | [inline] |
long read_int32_le_buf | ( | const unsigned char * | buff | ) | [inline] |
Reads 4-byte little-endian number from given buffer.
Definition at line 80 of file lbfileio.c.
Referenced by load_apt(), load_clm(), load_cubedata(), load_lgt(), read_jtytabfile_data(), and read_tabfile_data().
long read_int32_le_file | ( | FILE * | fp | ) | [inline] |
unsigned char read_int8_buf | ( | const unsigned char * | buff | ) | [inline] |
Reads 1-byte number from given buffer.
Simple wrapper for use with both little and big endian files.
Definition at line 222 of file lbfileio.c.
Referenced by bit_advance(), bitread_fix(), and bitread_init().
void write_int16_be_buf | ( | unsigned char * | buff, | |
unsigned short | x | |||
) | [inline] |
void write_int16_le_buf | ( | unsigned char * | buff, | |
unsigned short | x | |||
) | [inline] |
void write_int16_le_file | ( | FILE * | fp, | |
unsigned short | x | |||
) | [inline] |
Writes 2-byte little-endian number to given FILE.
Definition at line 27 of file lbfileio.c.
Referenced by write_bmp_fp_24b(), write_bmp_fp_idx(), write_cubedata(), write_dat(), write_flg(), write_slb(), and write_tng().
void write_int32_be_buf | ( | unsigned char * | buff, | |
unsigned long | x | |||
) | [inline] |
void write_int32_le_buf | ( | unsigned char * | buff, | |
unsigned long | x | |||
) | [inline] |
Writes 4-byte little-endian number into given buffer.
Definition at line 56 of file lbfileio.c.
Referenced by level_clear_datclm(), and write_clm().
void write_int32_le_file | ( | FILE * | fp, | |
unsigned long | x | |||
) | [inline] |
Writes 4-byte little-endian number to given FILE.
Definition at line 45 of file lbfileio.c.
Referenced by write_apt(), write_bmp_fp_24b(), write_bmp_fp_idx(), write_cubedata(), write_jtytabfile_data(), write_lgt(), and write_tabfile_data().