-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathutils.h
67 lines (54 loc) · 1.39 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef _UTILS_H_
#define _UTILS_H_
#include "types.h"
#ifdef _WIN32
#define PATH_SEPERATOR '\\'
#else
#define PATH_SEPERATOR '/'
#endif
#ifndef MAX_PATH
#define MAX_PATH 255
#endif
#ifdef __cplusplus
extern "C" {
#endif
u32 align(u32 offset, u32 alignment);
u64 align64(u64 offset, u32 alignment);
int getuleb128(const u8** stream);
int getsleb128(const u8** stream);
u64 getle64(const u8* p);
u64 getle48(const u8* p);
u32 getle32(const u8* p);
u32 getle16(const u8* p);
u64 getbe64(const u8* p);
u64 getbe48(const u8* p);
u32 getbe32(const u8* p);
u32 getbe16(const u8* p);
void putle16(u8* p, u16 n);
void putle32(u8* p, u32 n);
void putle48(u8* p, u64 n);
void putle64(u8* p, u64 n);
void putbe16(u8* p, u16 n);
void putbe32(u8* p, u32 n);
void putbe48(u8* p, u64 n);
void putbe64(u8* p, u64 n);
void readkeyfile(u8* key, const char* keyfname);
void memdump(FILE* fout, const char* prefix, const u8* data, u32 size);
void hexdump(void *ptr, int buflen);
int key_load(char *name, u8 *out_buf);
int makedir(const char* dir);
u64 _fsize(const char *filename);
#ifdef _MSC_VER
__inline int fseeko64(FILE *__stream, long long __off, int __whence)
{
return _fseeki64(__stream, __off, __whence);
}
#elif __APPLE__
#define fseeko64 fseek // OS X file I/O is 64bit
#elif __linux__
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
#endif
#ifdef __cplusplus
}
#endif
#endif // _UTILS_H_