9 #if defined(_MSC_VER) || defined(__MINGW32__) 10 #define SIZE_T_FORMAT "%Iu" 12 #define SIZE_T_FORMAT "%zu" 16 #define MB (1024 * KB) 19 #define DIM(S_ARR_) (sizeof(S_ARR_) / sizeof(S_ARR_[0])) 21 #define MIN(A_, B_) ((A_) < (B_) ? (A_) : (B_)) 22 #define MAX(A_, B_) ((A_) > (B_) ? (A_) : (B_)) 25 #define ALIGN(VAL_, ALIGNMENT_) (((VAL_) + ((ALIGNMENT_) - 1)) & ~((ALIGNMENT_) - 1)) 28 #define read_u32_be(buf) (unsigned int)(((buf)[0] << 24) + ((buf)[1] << 16) + ((buf)[2] << 8) + ((buf)[3])) 29 #define read_u32_le(buf) (unsigned int)(((buf)[1] << 24) + ((buf)[0] << 16) + ((buf)[3] << 8) + ((buf)[2])) 30 #define write_u32_be(buf, val) do { \ 31 (buf)[0] = ((val) >> 24) & 0xFF; \ 32 (buf)[1] = ((val) >> 16) & 0xFF; \ 33 (buf)[2] = ((val) >> 8) & 0xFF; \ 34 (buf)[3] = (val) & 0xFF; \ 36 #define read_u16_be(buf) (((buf)[0] << 8) + ((buf)[1])) 37 #define write_u16_be(buf, val) do { \ 38 (buf)[0] = ((val) >> 8) & 0xFF; \ 39 (buf)[1] = ((val)) & 0xFF; \ 43 #define fprint_nibble(FP, NIB_) fputc((NIB_) < 10 ? ('0' + (NIB_)) : ('A' + (NIB_) - 0xA), FP) 44 #define fprint_byte(FP, BYTE_) do { \ 45 fprint_nibble(FP, (BYTE_) >> 4); \ 46 fprint_nibble(FP, (BYTE_) & 0x0F); \ 48 #define print_nibble(NIB_) fprint_nibble(stdout, NIB_) 49 #define print_byte(BYTE_) fprint_byte(stdout, BYTE_) 52 #if defined(_MSC_VER) || defined(__MINGW32__) 54 #define mkdir(DIR_, PERM_) _mkdir(DIR_) 56 #define strcasecmp(A, B) stricmp(A, B) 62 #define MAX_DIR_FILES 128 72 #define ERROR(...) fprintf(stderr, __VA_ARGS__) 73 #define INFO(...) if (g_verbosity) printf(__VA_ARGS__) 74 #define INFO_HEX(...) if (g_verbosity) print_hex(__VA_ARGS__) 92 void fprint_hex(FILE *fp,
const unsigned char *buf,
int length);
94 void print_hex(
const unsigned char *buf,
int length);
104 long filesize(
const char *file_name);
115 long write_file(
const char *file_name,
unsigned char *
data,
long length);
130 void make_dir(
const char *dir_name);
135 long copy_file(
const char *src_name,
const char *dst_name);
void touch_file(const char *filename)
Definition: utils.c:108
only bitfields can omit the member name(10) useless keyword or type name in declaration Type was ignored. '%s' declared within and is limited to this function prototype Possible program error
int read_s16_be(unsigned char *buf)
Definition: utils.c:21
int is_power2(unsigned int val)
Definition: utils.c:40
int str_ends_with(const char *str, const char *suffix)
Definition: utils.c:265
void swap_bytes(unsigned char *data, long length)
Definition: utils.c:72
void generate_filename(const char *in_name, char *out_name, char *extension)
Definition: utils.c:168
void print_hex(const unsigned char *buf, int length)
Definition: utils.c:67
char * basename(const char *name)
Definition: utils.c:187
#define MAX_DIR_FILES
Definition: utils.h:62
data
Definition: seq_decoder.py:292
long filesize(const char *file_name)
Definition: utils.c:97
void make_dir(const char *dir_name)
Definition: utils.c:198
float read_f32_be(unsigned char *buf)
Definition: utils.c:33
long write_file(const char *file_name, unsigned char *data, long length)
Definition: utils.c:153
corresponding parameters shall have compatible types If one type has a parameter type list and the other type is specified by a function declarator that is not part of a function definition and contains an empty identifier list
Definition: err.english.cc:617
filename
Definition: seq_decoder.py:281
void dir_list_free(dir_list *list)
Definition: utils.c:256
int g_verbosity
Definition: utils.c:19
void fprint_hex(FILE *fp, const unsigned char *buf, int length)
Definition: utils.c:48
void fprint_hex_source(FILE *fp, const unsigned char *buf, int length)
Definition: utils.c:57
void dir_list_ext(const char *dir, const char *extension, dir_list *list)
Definition: utils.c:225
long read_file(const char *file_name, unsigned char **data)
Definition: utils.c:119
void reverse_endian(unsigned char *data, long length)
Definition: utils.c:83
long copy_file(const char *src_name, const char *dst_name)
Definition: utils.c:206