From fc9a644002dc501a5c224e5cc1a7dfba3ca2d1d8 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 25 Nov 2019 13:13:05 +0100 Subject: 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 --- include/compat.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/compat.h') 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 #else #include #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 */ -- cgit v1.2.3