summaryrefslogtreecommitdiff
path: root/src/pal/inc/rt/palrt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/inc/rt/palrt.h')
-rw-r--r--src/pal/inc/rt/palrt.h51
1 files changed, 6 insertions, 45 deletions
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h
index c181f38c2b..059d3a68a5 100644
--- a/src/pal/inc/rt/palrt.h
+++ b/src/pal/inc/rt/palrt.h
@@ -223,19 +223,11 @@ inline void *__cdecl operator new(size_t, void *_P)
// PAL_safe_offsetof is a version of offsetof that protects against an
// overridden operator&
-#if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 || __GNUC__ > 3)
#define FIELD_OFFSET(type, field) __builtin_offsetof(type, field)
#ifndef offsetof
#define offsetof(type, field) __builtin_offsetof(type, field)
#endif
#define PAL_safe_offsetof(type, field) __builtin_offsetof(type, field)
-#else
-#define FIELD_OFFSET(type, field) (((LONG)(LONG_PTR)&(((type *)64)->field)) - 64)
-#ifndef offsetof
-#define offsetof(s,m) ((size_t)((ptrdiff_t)&(((s *)64)->m)) - 64)
-#endif
-#define PAL_safe_offsetof(s,m) ((size_t)((ptrdiff_t)&(char&)(((s *)64)->m))-64)
-#endif
#define CONTAINING_RECORD(address, type, field) \
((type *)((LONG_PTR)(address) - FIELD_OFFSET(type, field)))
@@ -243,7 +235,7 @@ inline void *__cdecl operator new(size_t, void *_P)
#define ARGUMENT_PRESENT(ArgumentPointer) (\
(CHAR *)(ArgumentPointer) != (CHAR *)(NULL) )
-#if defined(_WIN64) || defined(_M_ALPHA)
+#if defined(_WIN64)
#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
#else
#define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
@@ -893,7 +885,6 @@ Remember to fix the errcode defintion in safecrt.h.
*/
#define _wcslwr_s _wcslwr_unsafe
-#define _snprintf_s _snprintf_unsafe
#define swscanf_s swscanf
#define _wfopen_s _wfopen_unsafe
@@ -903,8 +894,6 @@ Remember to fix the errcode defintion in safecrt.h.
#define _vscprintf _vscprintf_unsafe
-#define vsprintf_s _vsnprintf
-
extern "C++" {
#include <safemath.h>
@@ -959,8 +948,11 @@ inline int __cdecl _vscprintf_unsafe(const char *_Format, va_list _ArgList)
if(buf == nullptr)
return 0;
- int ret = _vsnprintf(buf, guess, _Format, _ArgList);
+ va_list argListCopy;
+ va_copy(argListCopy, _ArgList);
+ int ret = _vsnprintf_s(buf, guess, _TRUNCATE, _Format, argListCopy);
free(buf);
+ va_end(argListCopy);
if ((ret != -1) && (ret < guess))
return ret;
@@ -969,28 +961,6 @@ inline int __cdecl _vscprintf_unsafe(const char *_Format, va_list _ArgList)
}
}
-inline int __cdecl _vsnprintf_unsafe(char *_Dst, size_t _SizeInWords, size_t _Count, const char *_Format, va_list _ArgList)
-{
- if (_Count == _TRUNCATE) _Count = _SizeInWords - 1;
- int ret = _vsnprintf(_Dst, _Count, _Format, _ArgList);
- _Dst[_SizeInWords - 1] = L'\0';
- if (ret < 0 && errno == 0)
- {
- errno = ERANGE;
- }
- return ret;
-}
-
-inline int __cdecl _snprintf_unsafe(char *_Dst, size_t _SizeInWords, size_t _Count, const char *_Format, ...)
-{
- int ret;
- va_list _ArgList;
- va_start(_ArgList, _Format);
- ret = _vsnprintf_unsafe(_Dst, _SizeInWords, _Count, _Format, _ArgList);
- va_end(_ArgList);
- return ret;
-}
-
inline errno_t __cdecl _wfopen_unsafe(PAL_FILE * *ff, const WCHAR *fileName, const WCHAR *mode)
{
PAL_FILE *result = _wfopen(fileName, mode);
@@ -1208,7 +1178,6 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN);
#define _ReturnAddress() __builtin_return_address(0)
-#ifdef PLATFORM_UNIX
#define DIRECTORY_SEPARATOR_CHAR_A '/'
#define DIRECTORY_SEPARATOR_CHAR_W W('/')
#define DIRECTORY_SEPARATOR_STR_A "/"
@@ -1216,15 +1185,6 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN);
#define PATH_SEPARATOR_CHAR_W W(':')
#define PATH_SEPARATOR_STR_W W(":")
#define VOLUME_SEPARATOR_CHAR_W W('/')
-#else // PLATFORM_UNIX
-#define DIRECTORY_SEPARATOR_CHAR_A '\\'
-#define DIRECTORY_SEPARATOR_CHAR_W W('\\')
-#define DIRECTORY_SEPARATOR_STR_A "\\"
-#define DIRECTORY_SEPARATOR_STR_W W("\\")
-#define PATH_SEPARATOR_CHAR_W W(';')
-#define PATH_SEPARATOR_STR_W W(";")
-#define VOLUME_SEPARATOR_CHAR_W W(':')
-#endif // PLATFORM_UNIX
#ifndef IMAGE_IMPORT_DESC_FIELD
#define IMAGE_IMPORT_DESC_FIELD(img, f) ((img).u.f)
@@ -1546,6 +1506,7 @@ typedef struct _DISPATCHER_CONTEXT {
PEXCEPTION_ROUTINE LanguageHandler;
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
+ BOOLEAN ControlPcIsUnwound;
} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
#else