aboutsummaryrefslogtreecommitdiff
path: root/src/StormPort.h
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avast.com>2021-05-15 17:49:53 +0200
committerLadislav Zezula <ladislav.zezula@avast.com>2021-05-15 17:49:53 +0200
commit013b12f860ccb2e418bb10766c57fcc18b7b966a (patch)
tree086afb48bf9df13cc6b0f99f548762a006b1723b /src/StormPort.h
parent3d6095e1ddb104986728fce2a6fb28fb28f9e005 (diff)
Fixed thread_local
Diffstat (limited to 'src/StormPort.h')
-rw-r--r--src/StormPort.h44
1 files changed, 13 insertions, 31 deletions
diff --git a/src/StormPort.h b/src/StormPort.h
index 4cd967f..ec9fc07 100644
--- a/src/StormPort.h
+++ b/src/StormPort.h
@@ -94,7 +94,10 @@
#endif
#define PKEXPORT
- #define __SYS_ZLIB
+
+ #ifndef __SYS_ZLIB
+ #define __SYS_ZLIB
+ #endif
#ifndef __SYS_BZLIB
#define __SYS_BZLIB
@@ -274,7 +277,7 @@
#define STORMLIB_LITTLE_ENDIAN
#endif
- #define STORMLIB_LINUX
+ #define THREAD_LOCAL thread_local
// Platforms with mmap support
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
@@ -282,6 +285,7 @@
#define STORMLIB_HAS_MMAP
#endif
+ #define STORMLIB_LINUX
#define STORMLIB_PLATFORM_DEFINED
#endif
@@ -366,8 +370,8 @@
#define O_LARGEFILE 0
#endif
-// Platform-specific error codes for UNIX-based platforms
-#if defined(STORMLIB_MAC) || defined(STORMLIB_LINUX)
+// Platform-specific error codes for non-Windows platforms
+#ifndef ERROR_SUCCESS
#define ERROR_SUCCESS 0
#define ERROR_FILE_NOT_FOUND ENOENT
#define ERROR_ACCESS_DENIED EPERM
@@ -386,10 +390,15 @@
#define ERROR_FILE_CORRUPT 1004 // No such error code under Linux
#endif
+// Macros that can sometimes be missing
#ifndef _countof
#define _countof(x) (sizeof(x) / sizeof(x[0]))
#endif
+#ifndef THREAD_LOCAL
+ #define THREAD_LOCAL
+#endif
+
//-----------------------------------------------------------------------------
// Swapping functions
@@ -439,31 +448,4 @@
#define BSWAP_TMPKHEADER(a) ConvertTMPKHeader((a))
#endif
-//-----------------------------------------------------------------------------
-// Macro for deprecated symbols
-
-/*
-#ifdef _MSC_VER
- #if _MSC_FULL_VER >= 140050320
- #define STORMLIB_DEPRECATED(_Text) __declspec(deprecated(_Text))
- #else
- #define STORMLIB_DEPRECATED(_Text) __declspec(deprecated)
- #endif
-#else
- #ifdef __GNUC__
- #define STORMLIB_DEPRECATED(_Text) __attribute__((deprecated))
- #else
- #define STORMLIB_DEPRECATED(_Text) __attribute__((deprecated(_Text)))
- #endif
-#endif
-
-// When a flag is deprecated, use this macro
-#ifndef _STORMLIB_NO_DEPRECATE
- #define STORMLIB_DEPRECATED_FLAG(type, oldflag, newflag) \
- const STORMLIB_DEPRECATED(#oldflag " is deprecated. Use " #newflag ". To supress this warning, define _STORMLIB_NO_DEPRECATE") static type oldflag = (type)newflag;
-#else
-#define STORMLIB_DEPRECATED_FLAG(type, oldflag, newflag) static type oldflag = (type)newflag;
-#endif
-*/
-
#endif // __STORMPORT_H__