Added a wrapper for U16toU8, called AUTOU16TOU8

- U16toU8 now requires a max arument to be passed
This commit is contained in:
2021-03-17 23:41:47 -05:00
parent 610a683804
commit 574f0cab09
9 changed files with 43 additions and 38 deletions

View File

@@ -32,12 +32,16 @@
#define MAPNUM(x) ((x) & 0xffffffff)
#define PLAYERID(x) ((x) >> 32)
// wrapper for U16toU8
#define ARRLEN(x) (sizeof(x)/sizeof(*x))
#define AUTOU16TOU8(x) U16toU8(x, ARRLEN(x))
// typedef for chunk position tuple
typedef std::tuple<int, int, uint64_t> ChunkPos;
// TODO: rewrite U16toU8 & U8toU16 to not use codecvt
std::string U16toU8(char16_t* src);
std::string U16toU8(char16_t* src, size_t max);
size_t U8toU16(std::string src, char16_t* des, size_t max); // returns number of char16_t that was written at des
time_t getTime();
time_t getTimestamp();