diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-25 13:13:05 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-25 13:20:08 +0100 |
commit | fc9a644002dc501a5c224e5cc1a7dfba3ca2d1d8 (patch) | |
tree | 6fb1acf211a1bf9005236d16d22f03f8fac746d4 /include/compat.h | |
parent | 2d303a7f0a6076bbf5739bae4f0fa443d0da5203 (diff) |
Cleanup: move overflow safe alloc code into libsquashfs
There were only a hand full of instances outside libsquashfs that used
the alloc code. In most cases, the thing allocated hat its size derived
from something already in memory anyway, so it is safe to assume its
size fits into a size_t.
At the same time, the opencoded Windows path conversion functions are
all unified into a single helper function.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/compat.h')
-rw-r--r-- | include/compat.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/compat.h b/include/compat.h index 26ad69b..82b1c7e 100644 --- a/include/compat.h +++ b/include/compat.h @@ -59,6 +59,9 @@ #define le16toh(x) (x) #define le32toh(x) (x) #define le64toh(x) (x) + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> #else #include <endian.h> #endif @@ -164,4 +167,8 @@ char *strndup(const char *str, size_t max_len); int getsubopt(char **opt, char *const *keys, char **val); #endif +#if defined(_WIN32) || defined(__WINDOWS__) +WCHAR *path_to_windows(const char *input); +#endif + #endif /* COMPAT_H */ |