From: Jan Vorlicek Date: Fri, 20 Jan 2017 23:32:12 +0000 (+0100) Subject: Remove PLATFORM_UNIX and FEATURE_PAL checks in PAL (#8982) X-Git-Tag: accepted/tizen/base/20180629.140029~2552 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e210622d2b4bb3f77333fca635d7b621e5cd7c2a;p=platform%2Fupstream%2Fcoreclr.git Remove PLATFORM_UNIX and FEATURE_PAL checks in PAL (#8982) This change removes all ifdefs for PLATFORM_UNIX and FEATURE_PAL from PAL and also removes dead code that was never compiled in PAL due to both of them being always defined for PAL. --- diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index 369e87a..8a9972f 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -50,7 +50,6 @@ Abstract: extern "C" { #endif -#if defined (PLATFORM_UNIX) // This macro is used to standardize the wide character string literals between UNIX and Windows. // Unix L"" is UTF32, and on windows it's UTF16. Because of built-in assumptions on the size // of string literals, it's important to match behaviour between Unix and Windows. Unix will be defined @@ -65,8 +64,6 @@ extern "C" { #define QUOTE_MACRO_u_HELPER(x) u###x #define QUOTE_MACRO_u(x) QUOTE_MACRO_u_HELPER(x) -#endif - #include #include #include @@ -2526,8 +2523,6 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context, #define GetLogicalProcessorCacheSizeFromOS PAL_GetLogicalProcessorCacheSizeFromOS -#ifdef PLATFORM_UNIX - /* PAL_CS_NATIVE_DATA_SIZE is defined as sizeof(PAL_CRITICAL_SECTION_NATIVE_DATA) */ #if defined(__APPLE__) && defined(__i386__) @@ -2557,8 +2552,6 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context, #error PAL_CS_NATIVE_DATA_SIZE is not defined for this architecture #endif -#endif // PLATFORM_UNIX - // typedef struct _CRITICAL_SECTION { PVOID DebugInfo; @@ -2568,7 +2561,6 @@ typedef struct _CRITICAL_SECTION { HANDLE LockSemaphore; ULONG_PTR SpinCount; -#ifdef PLATFORM_UNIX BOOL bInternal; volatile DWORD dwInitState; union CSNativeDataStorage @@ -2576,7 +2568,6 @@ typedef struct _CRITICAL_SECTION { BYTE rgNativeDataStorage[PAL_CS_NATIVE_DATA_SIZE]; VOID * pvAlign; // make sure the storage is machine-pointer-size aligned } csnds; -#endif // PLATFORM_UNIX } CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION; PALIMPORT VOID PALAPI EnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection); @@ -4859,7 +4850,6 @@ CoCreateGuid(OUT GUID * pguid); /* Some C runtime functions needs to be reimplemented by the PAL. To avoid name collisions, those functions have been renamed using defines */ -#ifdef PLATFORM_UNIX #ifndef PAL_STDCPP_COMPAT #define exit PAL_exit #define atexit PAL_atexit @@ -4962,7 +4952,6 @@ CoCreateGuid(OUT GUID * pguid); #endif // _AMD64_ #endif // !PAL_STDCPP_COMPAT -#endif // PLATFORM_UNIX #ifndef _CONST_RETURN #ifdef __cplusplus @@ -5241,17 +5230,11 @@ PALIMPORT char * __cdecl _strdup(const char *); #if defined(_MSC_VER) #define alloca _alloca -#elif defined(PLATFORM_UNIX) -#define _alloca alloca #else -// MingW -#define _alloca __builtin_alloca -#define alloca __builtin_alloca +#define _alloca alloca #endif //_MSC_VER -#if defined(__GNUC__) && defined(PLATFORM_UNIX) #define alloca __builtin_alloca -#endif // __GNUC__ #define max(a, b) (((a) > (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b)) @@ -6012,7 +5995,6 @@ public: // Platform-specific library naming // -#ifdef PLATFORM_UNIX #ifdef __APPLE__ #define MAKEDLLNAME_W(name) u"lib" name u".dylib" #define MAKEDLLNAME_A(name) "lib" name ".dylib" @@ -6020,10 +6002,6 @@ public: #define MAKEDLLNAME_W(name) u"lib" name u".so" #define MAKEDLLNAME_A(name) "lib" name ".so" #endif -#else // PLATFORM_UNIX -#define MAKEDLLNAME_W(name) name L".dll" -#define MAKEDLLNAME_A(name) name ".dll" -#endif // PLATFORM_UNIX #ifdef UNICODE #define MAKEDLLNAME(x) MAKEDLLNAME_W(x) diff --git a/src/pal/inc/pal_char16.h b/src/pal/inc/pal_char16.h index 4600cc7..0697b23 100644 --- a/src/pal/inc/pal_char16.h +++ b/src/pal/inc/pal_char16.h @@ -27,12 +27,10 @@ This file is used to define the wchar_t type as a 16-bit type on Unix. // vc++, for whom wchar_t is already a typedef instead of a built-in. #ifndef PAL_STDCPP_COMPAT -#if defined (PLATFORM_UNIX) && defined(__GNUC__) #undef wchar_t #undef __WCHAR_TYPE__ #define __WCHAR_TYPE__ __wchar_16_cpp__ #define wchar_t __wchar_16_cpp__ -#endif // PLATFORM_UNIX // Set up the wchar_t type (which got preprocessed to __wchar_16_cpp__). // In C++11, the standard gives us char16_t, which is what we want (and matches types with u"") @@ -40,7 +38,6 @@ This file is used to define the wchar_t type as a 16-bit type on Unix. // **** WARNING: Linking C and C++ objects will break with -fstrict-aliasing with GCC/Clang // due to conditional typedef #if !defined(_WCHAR_T_DEFINED) || !defined(_MSC_VER) -#if defined (PLATFORM_UNIX) #if defined(__cplusplus) #undef __WCHAR_TYPE__ #define __WCHAR_TYPE__ char16_t @@ -50,7 +47,7 @@ typedef char16_t wchar_t; #define __WCHAR_TYPE__ unsigned short typedef unsigned short wchar_t; #endif // __cplusplus -#endif // PLATFORM_UNIX + #ifndef _WCHAR_T_DEFINED #define _WCHAR_T_DEFINED #endif // !_WCHAR_T_DEFINED diff --git a/src/pal/inc/pal_mstypes.h b/src/pal/inc/pal_mstypes.h index b9c3ac2..1f5c11d 100644 --- a/src/pal/inc/pal_mstypes.h +++ b/src/pal/inc/pal_mstypes.h @@ -235,13 +235,8 @@ typedef long double LONG_DOUBLE; typedef void VOID; -#ifndef PLATFORM_UNIX -typedef long LONG; -typedef unsigned long ULONG; -#else typedef int LONG; // NOTE: diff from windows.h, for LP64 compat typedef unsigned int ULONG; // NOTE: diff from windows.h, for LP64 compat -#endif typedef __int64 LONGLONG; typedef unsigned __int64 ULONGLONG; @@ -260,12 +255,7 @@ typedef UCHAR *PUCHAR; typedef char *PSZ; typedef ULONGLONG DWORDLONG; -#ifndef PLATFORM_UNIX -typedef unsigned long DWORD; -#else typedef unsigned int DWORD; // NOTE: diff from windows.h, for LP64 compat -#endif - typedef unsigned int DWORD32, *PDWORD32; typedef int BOOL; diff --git a/src/pal/inc/rt/intsafe.h b/src/pal/inc/rt/intsafe.h index 5cdf659..4ed70e7 100644 --- a/src/pal/inc/rt/intsafe.h +++ b/src/pal/inc/rt/intsafe.h @@ -38,47 +38,6 @@ UnsignedMultiply128 ( #endif #endif // _AMD64_ -#ifndef FEATURE_PAL - -#ifdef _WIN64 -typedef unsigned __int64 size_t; -typedef unsigned __int64 UINT_PTR; -typedef unsigned __int64 ULONG_PTR; -typedef unsigned __int64 DWORD_PTR; -typedef unsigned __int64 SIZE_T; -#else -typedef __w64 unsigned int size_t; -typedef __w64 unsigned int UINT_PTR; -typedef __w64 unsigned long ULONG_PTR; -typedef __w64 unsigned long DWORD_PTR; -typedef __w64 unsigned long SIZE_T; -#endif -typedef char CHAR; -typedef int INT; -typedef long LONG; -typedef unsigned char UCHAR; -typedef unsigned short USHORT; -typedef unsigned short WORD; -typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef unsigned long DWORD; -typedef unsigned __int64 ULONGLONG; - - -typedef LONG HRESULT; - -#ifndef SUCCEEDED -#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) -#endif - -#ifndef FAILED -#define FAILED(hr) (((HRESULT)(hr)) < 0) -#endif - -#define S_OK ((HRESULT)0x00000000L) - -#endif // !FEATURE_PAL - #define INTSAFE_E_ARITHMETIC_OVERFLOW ((HRESULT)0x80070216L) // 0x216 = 534 = ERROR_ARITHMETIC_OVERFLOW #ifndef LOWORD diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h index e2d844d..0bb0c1f 100644 --- a/src/pal/inc/rt/palrt.h +++ b/src/pal/inc/rt/palrt.h @@ -1186,7 +1186,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 "/" @@ -1194,15 +1193,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) diff --git a/src/pal/inc/rt/vsassert.h b/src/pal/inc/rt/vsassert.h index 1f16cf1..2a7fa5f 100644 --- a/src/pal/inc/rt/vsassert.h +++ b/src/pal/inc/rt/vsassert.h @@ -11,10 +11,6 @@ #ifndef __VSASSERT_H__ #define __VSASSERT_H__ -#ifndef FEATURE_PAL -#error "FEATURE_PAL must be defined for this file" -#else // FEATURE_PAL - #define VSASSERT(e, szMsg) \ do { \ if (!(e)) { \ @@ -94,5 +90,4 @@ do { \ #define VsIgnoreAllocs(f) -#endif // FEATURE_PAL #endif // __VSASSERT_H__ diff --git a/src/pal/inc/strsafe.h b/src/pal/inc/strsafe.h index 58749f2..f32f5e6 100644 --- a/src/pal/inc/strsafe.h +++ b/src/pal/inc/strsafe.h @@ -24,14 +24,6 @@ #pragma once #endif -#if defined(PLATFORM_UNIX) && !defined (FEATURE_PAL) -#define _NATIVE_WCHAR_T_DEFINED -#endif // defined(PLATFORM_UNIX) && !defined (FEATURE_PAL) - -#if defined(PLATFORM_UNIX) && !defined (FEATURE_PAL) -#define _vsnprintf vsnprintf -#endif // defined(PLATFORM_UNIX) && !defined (FEATURE_PAL) - #include // for _vsnprintf, getc, getwc #include // for memset #include // for va_start, etc. @@ -51,13 +43,6 @@ typedef char16_t WCHAR; #define _WCHAR_T_DEFINED #endif -#ifndef FEATURE_PAL -#ifndef _HRESULT_DEFINED -#define _HRESULT_DEFINED -typedef LONG HRESULT; -#endif // !_HRESULT_DEFINED -#endif // !FEATURE_PAL - #ifndef SUCCEEDED #define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) #endif @@ -150,14 +135,6 @@ STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch); STRSAFEAPI StringLengthWorkerW(const WCHAR* psz, size_t cchMax, size_t* pcch); #endif // STRSAFE_INLINE -#ifndef STRSAFE_LIB_IMPL -#ifndef FEATURE_PAL -// these functions are always inline -STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); -STRSAFE_INLINE_API StringGetsExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); -#endif // !FEATURE_PAL -#endif - #ifndef STRSAFE_NO_CCH_FUNCTIONS /*++ @@ -247,7 +224,6 @@ STRSAFEAPI StringCchCopyA(char* pszDest, size_t cchDest, const char* pszSrc) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCopyW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc) { HRESULT hr; @@ -263,7 +239,6 @@ STRSAFEAPI StringCchCopyW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -361,7 +336,6 @@ STRSAFEAPI StringCbCopyA(char* pszDest, size_t cbDest, const char* pszSrc) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCopyW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc) { HRESULT hr; @@ -381,7 +355,6 @@ STRSAFEAPI StringCbCopyW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -506,7 +479,6 @@ STRSAFEAPI StringCchCopyExA(char* pszDest, size_t cchDest, const char* pszSrc, c return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCopyExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr; @@ -527,7 +499,6 @@ STRSAFEAPI StringCchCopyExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -660,7 +631,6 @@ STRSAFEAPI StringCbCopyExA(char* pszDest, size_t cbDest, const char* pszSrc, cha return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCopyExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) { HRESULT hr; @@ -689,7 +659,6 @@ STRSAFEAPI StringCbCopyExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, W return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -784,7 +753,6 @@ STRSAFEAPI StringCchCopyNA(char* pszDest, size_t cchDest, const char* pszSrc, si return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCopyNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc) { HRESULT hr; @@ -801,7 +769,6 @@ STRSAFEAPI StringCchCopyNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -902,7 +869,6 @@ STRSAFEAPI StringCbCopyNA(char* pszDest, size_t cbDest, const char* pszSrc, size return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCopyNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbSrc) { HRESULT hr; @@ -925,7 +891,6 @@ STRSAFEAPI StringCbCopyNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, si return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -1060,7 +1025,6 @@ STRSAFEAPI StringCchCopyNExA(char* pszDest, size_t cchDest, const char* pszSrc, return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCopyNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr; @@ -1082,7 +1046,6 @@ STRSAFEAPI StringCchCopyNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -1226,7 +1189,6 @@ STRSAFEAPI StringCbCopyNExA(char* pszDest, size_t cbDest, const char* pszSrc, si return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCopyNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbSrc, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) { HRESULT hr; @@ -1258,7 +1220,6 @@ STRSAFEAPI StringCbCopyNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -1345,7 +1306,6 @@ STRSAFEAPI StringCchCatA(char* pszDest, size_t cchDest, const char* pszSrc) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCatW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc) { HRESULT hr; @@ -1361,7 +1321,6 @@ STRSAFEAPI StringCchCatW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -1451,7 +1410,6 @@ STRSAFEAPI StringCbCatA(char* pszDest, size_t cbDest, const char* pszSrc) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCatW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc) { HRESULT hr; @@ -1470,7 +1428,6 @@ STRSAFEAPI StringCbCatW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -1598,7 +1555,6 @@ STRSAFEAPI StringCchCatExA(char* pszDest, size_t cchDest, const char* pszSrc, ch return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCatExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr; @@ -1619,7 +1575,6 @@ STRSAFEAPI StringCchCatExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -1755,7 +1710,6 @@ STRSAFEAPI StringCbCatExA(char* pszDest, size_t cbDest, const char* pszSrc, char return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCatExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) { HRESULT hr; @@ -1784,7 +1738,6 @@ STRSAFEAPI StringCbCatExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, WC return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -1877,7 +1830,6 @@ STRSAFEAPI StringCchCatNA(char* pszDest, size_t cchDest, const char* pszSrc, siz return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCatNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend) { HRESULT hr; @@ -1893,7 +1845,6 @@ STRSAFEAPI StringCchCatNW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, s return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -1993,7 +1944,6 @@ STRSAFEAPI StringCbCatNA(char* pszDest, size_t cbDest, const char* pszSrc, size_ return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCatNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbMaxAppend) { HRESULT hr; @@ -2016,7 +1966,6 @@ STRSAFEAPI StringCbCatNW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, siz return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -2147,7 +2096,6 @@ STRSAFEAPI StringCchCatNExA(char* pszDest, size_t cchDest, const char* pszSrc, s return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchCatNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr; @@ -2168,7 +2116,6 @@ STRSAFEAPI StringCchCatNExW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -2311,7 +2258,6 @@ STRSAFEAPI StringCbCatNExA(char* pszDest, size_t cbDest, const char* pszSrc, siz return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbCatNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, size_t cbMaxAppend, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) { HRESULT hr; @@ -2344,7 +2290,6 @@ STRSAFEAPI StringCbCatNExW(WCHAR* pszDest, size_t cbDest, const WCHAR* pszSrc, s return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -2403,62 +2348,7 @@ Return Value: --*/ -#ifndef FEATURE_PAL -#ifndef STRSAFE_LIB_IMPL -STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest); -STRSAFE_INLINE_API StringCchGetsW(WCHAR* pszDest, size_t cchDest); -#ifdef UNICODE -#define StringCchGets StringCchGetsW -#else -#define StringCchGets StringCchGetsA -#endif // !UNICODE - -STRSAFE_INLINE_API StringCchGetsA(char* pszDest, size_t cchDest) -{ - HRESULT hr; - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0); - } - - return hr; -} - -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) -STRSAFE_INLINE_API StringCchGetsW(WCHAR* pszDest, size_t cchDest) -{ - HRESULT hr; - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(WCHAR) since cchDest < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2 - cbDest = cchDest * sizeof(WCHAR); - - hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0); - } - - return hr; -} -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // !STRSAFE_NO_CCH_FUNCTIONS -#endif // !STRSAFE_LIB_IMPL -#endif // !FEATURE_PAL #ifndef STRSAFE_NO_CB_FUNCTIONS /*++ @@ -2514,60 +2404,7 @@ Return Value: --*/ -#ifndef FEATURE_PAL -#ifndef STRSAFE_LIB_IMPL -STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest); -STRSAFE_INLINE_API StringCbGetsW(WCHAR* pszDest, size_t cbDest); -#ifdef UNICODE -#define StringCbGets StringCbGetsW -#else -#define StringCbGets StringCbGetsA -#endif // !UNICODE - -STRSAFE_INLINE_API StringCbGetsA(char* pszDest, size_t cbDest) -{ - HRESULT hr; - size_t cchDest; - - // convert to count of characters - cchDest = cbDest / sizeof(char); - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, NULL, NULL, 0); - } - - return hr; -} - -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) -STRSAFE_INLINE_API StringCbGetsW(WCHAR* pszDest, size_t cbDest) -{ - HRESULT hr; - size_t cchDest; - - // convert to count of characters - cchDest = cbDest / sizeof(WCHAR); - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, NULL, NULL, 0); - } - - return hr; -} -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // !STRSAFE_NO_CB_FUNCTIONS -#endif // !STRSAFE_LIB_IMPL -#endif // !FEATURE_PAL #ifndef STRSAFE_NO_CCH_FUNCTIONS /*++ @@ -2650,62 +2487,7 @@ Return Value: --*/ -#ifndef FEATURE_PAL -#ifndef STRSAFE_LIB_IMPL -STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); -STRSAFE_INLINE_API StringCchGetsExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags); -#ifdef UNICODE -#define StringCchGetsEx StringCchGetsExW -#else -#define StringCchGetsEx StringCchGetsExA -#endif // !UNICODE - -STRSAFE_INLINE_API StringCchGetsExA(char* pszDest, size_t cchDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) -{ - HRESULT hr; - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(char) since cchDest < STRSAFE_MAX_CCH and sizeof(char) is 1 - cbDest = cchDest * sizeof(char); - - hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags); - } - - return hr; -} - -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) -STRSAFE_INLINE_API StringCchGetsExW(WCHAR* pszDest, size_t cchDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) -{ - HRESULT hr; - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - size_t cbDest; - - // safe to multiply cchDest * sizeof(WCHAR) since cchDest < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2 - cbDest = cchDest * sizeof(WCHAR); - - hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, pcchRemaining, dwFlags); - } - - return hr; -} -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // !STRSAFE_NO_CCH_FUNCTIONS -#endif // !STRSAFE_LIB_IMPL -#endif // !FEATURE_PAL #ifndef STRSAFE_NO_CB_FUNCTIONS /*++ @@ -2788,82 +2570,7 @@ Return Value: --*/ -#ifndef FEATURE_PAL -#ifndef STRSAFE_LIB_IMPL -STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pbRemaining, unsigned long dwFlags); -STRSAFE_INLINE_API StringCbGetsExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags); -#ifdef UNICODE -#define StringCbGetsEx StringCbGetsExW -#else -#define StringCbGetsEx StringCbGetsExA -#endif // !UNICODE - -STRSAFE_INLINE_API StringCbGetsExA(char* pszDest, size_t cbDest, char** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) -{ - HRESULT hr; - size_t cchDest; - size_t cchRemaining = 0; - - cchDest = cbDest / sizeof(char); - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - hr = StringGetsExWorkerA(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags); - } - - if (SUCCEEDED(hr) || - (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || - (hr == STRSAFE_E_END_OF_FILE)) - { - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(char) since cchRemaining < STRSAFE_MAX_CCH and sizeof(char) is 1 - *pcbRemaining = (cchRemaining * sizeof(char)) + (cbDest % sizeof(char)); - } - } - - return hr; -} - -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) -STRSAFE_INLINE_API StringCbGetsExW(WCHAR* pszDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcbRemaining, unsigned long dwFlags) -{ - HRESULT hr; - size_t cchDest; - size_t cchRemaining = 0; - - cchDest = cbDest / sizeof(WCHAR); - - if (cchDest > STRSAFE_MAX_CCH) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - hr = StringGetsExWorkerW(pszDest, cchDest, cbDest, ppszDestEnd, &cchRemaining, dwFlags); - } - - if (SUCCEEDED(hr) || - (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || - (hr == STRSAFE_E_END_OF_FILE)) - { - if (pcbRemaining) - { - // safe to multiply cchRemaining * sizeof(WCHAR) since cchRemaining < STRSAFE_MAX_CCH and sizeof(WCHAR) is 2 - *pcbRemaining = (cchRemaining * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR)); - } - } - - return hr; -} -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // !STRSAFE_NO_CB_FUNCTIONS -#endif // !STRSAFE_LIB_IMPL -#endif // !FEATURE_PAL #ifndef STRSAFE_NO_CCH_FUNCTIONS /*++ @@ -2937,7 +2644,6 @@ STRSAFEAPI StringCchLengthA(const char* psz, size_t cchMax, size_t* pcch) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCchLengthW(const WCHAR* psz, size_t cchMax, size_t* pcch) { HRESULT hr; @@ -2953,7 +2659,6 @@ STRSAFEAPI StringCchLengthW(const WCHAR* psz, size_t cchMax, size_t* pcch) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CCH_FUNCTIONS @@ -3040,7 +2745,6 @@ STRSAFEAPI StringCbLengthA(const char* psz, size_t cbMax, size_t* pcb) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cbMax, size_t* pcb) { HRESULT hr; @@ -3066,7 +2770,6 @@ STRSAFEAPI StringCbLengthW(const WCHAR* psz, size_t cbMax, size_t* pcb) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE #endif // !STRSAFE_NO_CB_FUNCTIONS @@ -3103,7 +2806,6 @@ STRSAFEAPI StringCopyWorkerA(char* pszDest, size_t cchDest, const char* pszSrc) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCopyWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc) { HRESULT hr = S_OK; @@ -3133,7 +2835,6 @@ STRSAFEAPI StringCopyWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { @@ -3273,7 +2974,6 @@ STRSAFEAPI StringCopyExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCopyExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr = S_OK; @@ -3411,7 +3111,6 @@ STRSAFEAPI StringCopyExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchSrc) { @@ -3444,7 +3143,6 @@ STRSAFEAPI StringCopyNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchSrc) { HRESULT hr = S_OK; @@ -3475,7 +3173,6 @@ STRSAFEAPI StringCopyNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSr return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { @@ -3616,7 +3313,6 @@ STRSAFEAPI StringCopyNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, co return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr = S_OK; @@ -3755,7 +3451,6 @@ STRSAFEAPI StringCopyNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, c return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc) { @@ -3774,7 +3469,6 @@ STRSAFEAPI StringCatWorkerA(char* pszDest, size_t cchDest, const char* pszSrc) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCatWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc) { HRESULT hr; @@ -3791,7 +3485,6 @@ STRSAFEAPI StringCatWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { @@ -3940,7 +3633,6 @@ STRSAFEAPI StringCatExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, cons return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr = S_OK; @@ -4086,7 +3778,6 @@ STRSAFEAPI StringCatExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, con return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, size_t cchMaxAppend) { @@ -4106,7 +3797,6 @@ STRSAFEAPI StringCatNWorkerA(char* pszDest, size_t cchDest, const char* pszSrc, return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCatNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc, size_t cchMaxAppend) { HRESULT hr; @@ -4124,7 +3814,6 @@ STRSAFEAPI StringCatNWorkerW(WCHAR* pszDest, size_t cchDest, const WCHAR* pszSrc return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, const char* pszSrc, size_t cchMaxAppend, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { @@ -4272,7 +3961,6 @@ STRSAFEAPI StringCatNExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, con return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, const WCHAR* pszSrc, size_t cchMaxAppend, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) { HRESULT hr = S_OK; @@ -4419,7 +4107,6 @@ STRSAFEAPI StringCatNExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, co return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch) { @@ -4446,7 +4133,6 @@ STRSAFEAPI StringLengthWorkerA(const char* psz, size_t cchMax, size_t* pcch) return hr; } -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) STRSAFEAPI StringLengthWorkerW(const WCHAR* psz, size_t cchMax, size_t* pcch) { HRESULT hr = S_OK; @@ -4471,285 +4157,6 @@ STRSAFEAPI StringLengthWorkerW(const WCHAR* psz, size_t cchMax, size_t* pcch) return hr; } -#endif // FEATURE_PAL || !PLATFORM_UNIX #endif // STRSAFE_INLINE -#ifndef STRSAFE_LIB_IMPL -#ifndef FEATURE_PAL -STRSAFE_INLINE_API StringGetsExWorkerA(char* pszDest, size_t cchDest, size_t cbDest, char** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) -{ - HRESULT hr = S_OK; - char* pszDestEnd = pszDest; - size_t cchRemaining = 0; - - // ASSERT(cbDest == (cchDest * sizeof(char)) || - // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); - - // only accept valid flags - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - if (dwFlags & STRSAFE_IGNORE_NULLS) - { - if (pszDest == NULL) - { - if ((cchDest != 0) || (cbDest != 0)) - { - // NULL pszDest and non-zero cchDest/cbDest is invalid - hr = STRSAFE_E_INVALID_PARAMETER; - } - } - } - - if (SUCCEEDED(hr)) - { - if (cchDest <= 1) - { - pszDestEnd = pszDest; - cchRemaining = cchDest; - - if (cchDest == 1) - { - *pszDestEnd = '\0'; - } - - hr = STRSAFE_E_INSUFFICIENT_BUFFER; - } - else - { - char ch; - - pszDestEnd = pszDest; - cchRemaining = cchDest; - - while ((cchRemaining > 1) && (ch = (char)getc(stdin)) != '\n') - { - if (ch == EOF) - { - if (pszDestEnd == pszDest) - { - // we failed to read anything from stdin - hr = STRSAFE_E_END_OF_FILE; - } - break; - } - - *pszDestEnd = ch; - - pszDestEnd++; - cchRemaining--; - } - - if (cchRemaining > 0) - { - // there is extra room - if (dwFlags & STRSAFE_FILL_BEHIND_NULL) - { - memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(char)) + (cbDest % sizeof(char))); - } - } - - *pszDestEnd = '\0'; - } - } - } - - if (FAILED(hr)) - { - if (pszDest) - { - if (dwFlags & STRSAFE_FILL_ON_FAILURE) - { - memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); - - if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) - { - pszDestEnd = pszDest; - cchRemaining = cchDest; - } - else if (cchDest > 0) - { - pszDestEnd = pszDest + cchDest - 1; - cchRemaining = 1; - - // null terminate the end of the string - *pszDestEnd = '\0'; - } - } - - if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) - { - if (cchDest > 0) - { - pszDestEnd = pszDest; - cchRemaining = cchDest; - - // null terminate the beginning of the string - *pszDestEnd = '\0'; - } - } - } - } - - if (SUCCEEDED(hr) || - (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || - (hr == STRSAFE_E_END_OF_FILE)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - - return hr; -} - -#if defined(FEATURE_PAL) || !defined(PLATFORM_UNIX) -STRSAFE_INLINE_API StringGetsExWorkerW(WCHAR* pszDest, size_t cchDest, size_t cbDest, WCHAR** ppszDestEnd, size_t* pcchRemaining, unsigned long dwFlags) -{ - HRESULT hr = S_OK; - WCHAR* pszDestEnd = pszDest; - size_t cchRemaining = 0; - - // ASSERT(cbDest == (cchDest * sizeof(char)) || - // cbDest == (cchDest * sizeof(char)) + (cbDest % sizeof(char))); - - // only accept valid flags - if (dwFlags & (~STRSAFE_VALID_FLAGS)) - { - hr = STRSAFE_E_INVALID_PARAMETER; - } - else - { - if (dwFlags & STRSAFE_IGNORE_NULLS) - { - if (pszDest == NULL) - { - if ((cchDest != 0) || (cbDest != 0)) - { - // NULL pszDest and non-zero cchDest/cbDest is invalid - hr = STRSAFE_E_INVALID_PARAMETER; - } - } - } - - if (SUCCEEDED(hr)) - { - if (cchDest <= 1) - { - pszDestEnd = pszDest; - cchRemaining = cchDest; - - if (cchDest == 1) - { - *pszDestEnd = L'\0'; - } - - hr = STRSAFE_E_INSUFFICIENT_BUFFER; - } - else - { - WCHAR ch; - - pszDestEnd = pszDest; - cchRemaining = cchDest; - - while ((cchRemaining > 1) && (ch = (WCHAR)getwc(stdin)) != L'\n') - { - if (ch == EOF) - { - if (pszDestEnd == pszDest) - { - // we failed to read anything from stdin - hr = STRSAFE_E_END_OF_FILE; - } - break; - } - - *pszDestEnd = ch; - - pszDestEnd++; - cchRemaining--; - } - - if (cchRemaining > 0) - { - // there is extra room - if (dwFlags & STRSAFE_FILL_BEHIND_NULL) - { - memset(pszDestEnd + 1, STRSAFE_GET_FILL_PATTERN(dwFlags), ((cchRemaining - 1) * sizeof(WCHAR)) + (cbDest % sizeof(WCHAR))); - } - } - - *pszDestEnd = L'\0'; - } - } - } - - if (FAILED(hr)) - { - if (pszDest) - { - if (dwFlags & STRSAFE_FILL_ON_FAILURE) - { - memset(pszDest, STRSAFE_GET_FILL_PATTERN(dwFlags), cbDest); - - if (STRSAFE_GET_FILL_PATTERN(dwFlags) == 0) - { - pszDestEnd = pszDest; - cchRemaining = cchDest; - } - else if (cchDest > 0) - { - pszDestEnd = pszDest + cchDest - 1; - cchRemaining = 1; - - // null terminate the end of the string - *pszDestEnd = L'\0'; - } - } - - if (dwFlags & (STRSAFE_NULL_ON_FAILURE | STRSAFE_NO_TRUNCATION)) - { - if (cchDest > 0) - { - pszDestEnd = pszDest; - cchRemaining = cchDest; - - // null terminate the beginning of the string - *pszDestEnd = L'\0'; - } - } - } - } - - if (SUCCEEDED(hr) || - (hr == STRSAFE_E_INSUFFICIENT_BUFFER) || - (hr == STRSAFE_E_END_OF_FILE)) - { - if (ppszDestEnd) - { - *ppszDestEnd = pszDestEnd; - } - - if (pcchRemaining) - { - *pcchRemaining = cchRemaining; - } - } - - return hr; -} -#endif // FEATURE_PAL || !PLATFORM_UNIX -#endif // !FEATURE_PAL -#endif // !STRSAFE_LIB_IMPL - #endif // _STRSAFE_H_INCLUDED_ diff --git a/src/pal/src/include/pal/palinternal.h b/src/pal/src/include/pal/palinternal.h index 8e1a5f1..93f607f 100644 --- a/src/pal/src/include/pal/palinternal.h +++ b/src/pal/src/include/pal/palinternal.h @@ -335,7 +335,7 @@ function_name() to call the system's implementation #undef va_arg #endif -#if !defined(_MSC_VER) && defined(FEATURE_PAL) && defined(_WIN64) +#if !defined(_MSC_VER) && defined(_WIN64) #undef _BitScanForward64 #endif diff --git a/src/pal/src/misc/perftrace.cpp b/src/pal/src/misc/perftrace.cpp index 9c66d4a..fdefdf6 100644 --- a/src/pal/src/misc/perftrace.cpp +++ b/src/pal/src/misc/perftrace.cpp @@ -23,26 +23,6 @@ Abstract: #ifdef PAL_PERF -#ifndef PLATFORM_UNIX -/* PAL Headers */ -#include "perftrace.h" - -/* Standard Headers */ -#include -#include -#include -#include - -#define snprintf _snprintf -#define MiscGetenv getenv -#define pthread_getspecific TlsGetValue -#define THREADSilentGetCurrentThreadId GetCurrentThreadId -#define getpid GetCurrentProcessId -#define PAL_fgets fgets // on Windows, we want fgets. -#define PAL_fwrite fwrite // on Windows, we want fwrite. -#define PAL_fseek fseek // on Windows, we want fseek. - -#else /* PAL Headers */ #include "pal/palinternal.h" #include "pal/perftrace.h" @@ -60,7 +40,6 @@ Abstract: #include SET_DEFAULT_DEBUG_CHANNEL(MISC); -#endif //End of PLATFORM_UNIX #define PAL_PERF_MAX_LOGLINE 0x400 /* 1K */ @@ -110,21 +89,12 @@ typedef struct _pal_perf_program_info ULONGLONG total_duration; /* Total CPU clock ticks of all the threads */ ULONGLONG pal_duration; /* Total CPU clock ticks spent inside PAL */ -#ifndef PLATFORM_UNIX - DWORD process_id; -#else pid_t process_id; -#endif char start_time[32]; /* must be at least 26 characters */ } pal_perf_program_info; -#ifndef PLATFORM_UNIX -typedef FILE PERF_FILE; -#define PERF_FILEFN(x) x -#else typedef PAL_FILE PERF_FILE; #define PERF_FILEFN(x) PAL_ ## x -#endif static ULONGLONG PERFGetTicks(); static double PERFComputeStandardDeviation(pal_perf_api_info *api); @@ -144,11 +114,7 @@ typedef char PAL_API_NAME[PAL_PERF_MAX_FUNCTION_NAME]; static PAL_API_NAME API_list[PAL_API_NUMBER] ; static pal_perf_program_info program_info; -#ifndef PLATFORM_UNIX -static DWORD PERF_tlsTableKey=0 ; -#else static pthread_key_t PERF_tlsTableKey=0 ; -#endif static pal_thread_list_node * process_pal_thread_list=NULL; static BOOL pal_profile_on=FALSE; @@ -199,19 +165,11 @@ static const char PAL_PERF_HISTOGRAM_SIZE[]="PAL_PERF_HISTOGRAM_SIZE"; static const char PAL_PERF_HISTOGRAM_STEP[]="PAL_PERF_HISTOGRAM_STEP"; static const char traced_apis_filename[]="PerfTracedAPIs.txt"; static const char perf_enabled_filename[]="AllPerfEnabledAPIs.txt"; -#ifndef PLATFORM_UNIX -static const char PATH_SEPARATOR[] = "\\"; -#else static const char PATH_SEPARATOR[] = "/"; -#endif -#ifndef PLATFORM_UNIX -#define LLFORMAT "%I64u" -#else #define LLFORMAT "%llu" -#endif static ULONGLONG @@ -279,11 +237,7 @@ BOOL PERFInitProgramInfo(LPWSTR command_line, LPWSTR exe_path) { ULONGLONG start_tick; -#ifndef PLATFORM_UNIX - time_t tv; -#else struct timeval tv; -#endif if (WideCharToMultiByte(CP_ACP, 0, command_line, -1, program_info.command_line, PAL_PERF_MAX_LOGLINE-1, NULL, NULL) == 0) @@ -295,23 +249,14 @@ PERFInitProgramInfo(LPWSTR command_line, LPWSTR exe_path) gethostname(program_info.hostname, PAL_PERF_MAX_FUNCTION_NAME); program_info.process_id = getpid(); -#ifndef PLATFORM_UNIX - time( &tv ); - strcpy(program_info.start_time, ctime( &tv )); -#else gettimeofday(&tv, NULL); ctime_r(&tv.tv_sec, program_info.start_time); -#endif // estimate the cpu clock cycles start_tick = PERFGetTicks(); if (start_tick != 0) { -#ifndef PLATFORM_UNIX - Sleep(1000); //Sleep on Windows takes milliseconds as argument -#else sleep(1); -#endif program_info.cpu_clock_frequency = (double) (PERFGetTicks() - start_tick); } else @@ -375,13 +320,8 @@ PERFInitialize(LPWSTR command_line, LPWSTR exe_path) pal_profile_on = FALSE; // turn it off until we setup everything. // allocate the TLS index for structures -#ifndef PLATFORM_UNIX - if( ( PERF_tlsTableKey = TlsAlloc() ) == -1 ) - ret = FALSE; -#else if( pthread_key_create(&PERF_tlsTableKey , NULL) != 0 ) ret = FALSE; -#endif if( ret == TRUE ) { @@ -395,11 +335,7 @@ PERFInitialize(LPWSTR command_line, LPWSTR exe_path) else { -#ifndef PLATFORM_UNIX - TlsFree(PERF_tlsTableKey ); -#else pthread_key_delete(PERF_tlsTableKey ); -#endif ret = FALSE; } } @@ -422,11 +358,7 @@ void PERFTerminate( ) return; PERFlushAllLogs(); -#ifndef PLATFORM_UNIX - TlsFree(PERF_tlsTableKey ); -#else - pthread_key_delete(PERF_tlsTableKey ); -#endif + pthread_key_delete(PERF_tlsTableKey ); PAL_free(pal_function_map); } @@ -512,13 +444,8 @@ BOOL PERFAllocThreadInfo( ) local_info->start_ticks = 0; memset(log_buf, 0, PAL_PERF_PROFILE_BUFFER_SIZE); -#ifndef PLATFORM_UNIX - if ( TlsSetValue(PERF_tlsTableKey, local_info) == 0) - ret = FALSE; -#else if (pthread_setspecific(PERF_tlsTableKey, local_info) != 0) ret = FALSE; -#endif PERFAllocThreadInfoExit: if (ret == TRUE) @@ -795,11 +722,7 @@ PERFReadSetting( ) char * pal_perf_histogram_size_env; char * pal_perf_histogram_step_env; -#ifdef PLATFORM_UNIX PAL_FILE * hFile; -#else - FILE * hFile; -#endif if((pal_function_map == NULL) || (PAL_API_NUMBER < 0) ) { @@ -932,11 +855,7 @@ PERFReadSetting( ) if(input_file_name) { -#ifdef PLATFORM_UNIX hFile = PAL_fopen(input_file_name, "r+"); -#else - hFile = fopen(input_file_name, "r+"); -#endif if ( hFile == NULL ) { memset(pal_function_map, 1, PAL_API_NUMBER); @@ -975,11 +894,7 @@ PERFReadSetting( ) } -#ifdef PLATFORM_UNIX PAL_fclose(hFile); -#else - fclose(hFile); -#endif ret = TRUE; } } @@ -1027,11 +942,7 @@ PERFReadSetting( ) return ret; } -#ifdef PLATFORM_UNIX hFile = PAL_fopen(input_file_name, "r+"); -#else - hFile = fopen(input_file_name, "r+"); -#endif if ( hFile != NULL ) { @@ -1061,11 +972,7 @@ PERFReadSetting( ) } } -#ifdef PLATFORM_UNIX PAL_fclose(hFile); -#else - fclose(hFile); -#endif } return ret; @@ -1122,13 +1029,7 @@ PERFLogFunctionEntry(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick ) short bufused = 0; -#ifndef PLATFORM_UNIX - DWORD tv; - DWORD last_error; - last_error = GetLastError(); -#else struct timeval tv; -#endif if(!pal_perf_enabled || pal_function_map==NULL || !pal_profile_on ) // haven't initialize, just quit. @@ -1159,28 +1060,17 @@ PERFLogFunctionEntry(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick ) PERFFlushLog(local_info, FALSE); } -#ifndef PLATFORM_UNIX - tv = GetTickCount(); -#else gettimeofday(&tv, NULL); -#endif buf_off = local_info->buf_offset; -#ifndef PLATFORM_UNIX - bufused = snprintf(&write_buf[buf_off], PAL_PERF_MAX_LOGLINE, "----> %d %lu entry.\n", pal_api_id, tv ); -#else bufused = snprintf(&write_buf[buf_off], PAL_PERF_MAX_LOGLINE, "----> %d %lu %06u entry.\n", pal_api_id, tv.tv_sec, tv.tv_usec ); -#endif local_info->buf_offset += bufused; } if(nested_tracing) local_info->profile_enabled = TRUE; *pal_perf_start_tick = PERFGetTicks(); } -#ifndef PLATFORM_UNIX - SetLastError( last_error ); -#endif return; } @@ -1219,14 +1109,8 @@ PERFLogFunctionExit(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick ) short bufused = 0; DWORD off; ULONGLONG duration = 0; -#ifndef PLATFORM_UNIX - DWORD timev; - DWORD last_error; - last_error = GetLastError(); -#else struct timeval timev; -#endif if(!pal_perf_enabled || (pal_function_map == NULL) || !pal_profile_on ) // haven't initiallize yet, just quit. return; @@ -1253,17 +1137,10 @@ PERFLogFunctionExit(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick ) if(summary_only) { local_info->profile_enabled = TRUE; -#ifndef PLATFORM_UNIX - SetLastError( last_error ); -#endif return; } -#ifndef PLATFORM_UNIX - timev = GetTickCount(); -#else gettimeofday(&timev, NULL); -#endif buf = local_info->pal_write_buf; if(local_info->buf_offset >= PAL_PERF_BUFFER_FULL) @@ -1272,17 +1149,10 @@ PERFLogFunctionExit(unsigned int pal_api_id, ULONGLONG *pal_perf_start_tick ) } off = local_info->buf_offset; -#ifndef PLATFORM_UNIX - bufused = snprintf(&buf[off], PAL_PERF_MAX_LOGLINE, "<---- %d %lu exit. \n", pal_api_id, timev); -#else bufused = snprintf(&buf[off], PAL_PERF_MAX_LOGLINE, "<---- %d %lu %06u exit. \n", pal_api_id, timev.tv_sec, timev.tv_usec ); -#endif local_info->buf_offset += bufused; local_info->profile_enabled = TRUE; } -#ifndef PLATFORM_UNIX - SetLastError( last_error ); -#endif return; } @@ -1291,10 +1161,6 @@ PERFNoLatencyProfileEntry(unsigned int pal_api_id ) { pal_perf_thread_info * local_info=NULL; pal_perf_api_info * table; -#ifndef PLATFORM_UNIX - DWORD last_error; - last_error = GetLastError(); -#endif if(!pal_perf_enabled || pal_function_map==NULL || !pal_profile_on ) // haven't initialize, just quit. return; @@ -1303,9 +1169,6 @@ PERFNoLatencyProfileEntry(unsigned int pal_api_id ) local_info= (pal_perf_thread_info * )pthread_getspecific(PERF_tlsTableKey); if (local_info==NULL ) { -#ifndef PLATFORM_UNIX - SetLastError( last_error ); -#endif return; } else{ @@ -1313,9 +1176,6 @@ PERFNoLatencyProfileEntry(unsigned int pal_api_id ) table[pal_api_id].entries++; } } -#ifndef PLATFORM_UNIX - SetLastError( last_error ); -#endif return; } @@ -1324,10 +1184,6 @@ void PERFEnableThreadProfile(BOOL isInternal) { pal_perf_thread_info * local_info; -#ifndef PLATFORM_UNIX - DWORD last_error; - last_error = GetLastError(); -#endif if (!pal_perf_enabled) return; if (NULL != (local_info = (pal_perf_thread_info*)pthread_getspecific(PERF_tlsTableKey))) @@ -1337,9 +1193,6 @@ PERFEnableThreadProfile(BOOL isInternal) local_info->start_ticks = PERFGetTicks(); } } -#ifndef PLATFORM_UNIX - SetLastError( last_error ); -#endif } @@ -1347,10 +1200,6 @@ void PERFDisableThreadProfile(BOOL isInternal) { pal_perf_thread_info * local_info; -#ifndef PLATFORM_UNIX - DWORD last_error; - last_error = GetLastError(); -#endif if (!pal_perf_enabled) return; if (NULL != (local_info = (pal_perf_thread_info*)pthread_getspecific(PERF_tlsTableKey))) @@ -1360,9 +1209,6 @@ PERFDisableThreadProfile(BOOL isInternal) local_info->total_duration = PERFGetTicks() - local_info->start_ticks; } } -#ifndef PLATFORM_UNIX - SetLastError( last_error ); -#endif } @@ -1402,29 +1248,17 @@ static char * PERFIsValidPath( const char * path ) { -#ifndef PLATFORM_UNIX - DWORD result; -#else DIR * dir; -#endif if(( path==NULL) || (strlen(path)==0)) return NULL; -#ifndef PLATFORM_UNIX - result = GetFileAttributesA( path ); - if ((result != INVALID_FILE_ATTRIBUTES) && (result & FILE_ATTRIBUTE_DIRECTORY)) - { - return ((char *) path ); - } -#else dir = opendir(path); if( dir!=NULL) { closedir(dir); return ((char *)path); } -#endif return NULL; } @@ -1504,13 +1338,6 @@ PAL_GetCpuTickCount(VOID) return PERFGetTicks(); } -#ifndef PLATFORM_UNIX -#undef snprintf -#undef MiscGetenv -#undef pthread_key_t -#undef pthread_getspecific -#endif /* ifndef PLATFORM_UNIX definitions */ - #endif /* PAL_PERF */ diff --git a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp index 216557f..7c06152 100644 --- a/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/_snprintf_s/test4/test4.cpp @@ -33,7 +33,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ - #if defined(BIT64) && defined(PLATFORM_UNIX) + #if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest("%p", NULL, "NULL", "0000000000000000"); DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); @@ -61,7 +61,7 @@ int __cdecl main(int argc, char *argv[]) DoPointerTest("%Lp", ptr, "pointer to 0x123456", "00123456"); DoI64Test("%I64p", lptr, "pointer to 0x1234567887654321", "1234567887654321"); - #endif //defined(BIT64) && defined(PLATFORM_UNIX) + #endif //defined(BIT64) PAL_Terminate(); return PASS; diff --git a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp index 02d4781..0819a7e 100644 --- a/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/_snwprintf_s/test4/test4.cpp @@ -33,7 +33,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest(convert("%p"), NULL, convert("0000000000000000")); DoPointerTest(convert("%p"), ptr, convert("0000000000123456")); diff --git a/src/pal/tests/palsuite/c_runtime/_vsnprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_vsnprintf_s/test4/test4.cpp index 0cf25cb..c4a77f9 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnprintf_s/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/_vsnprintf_s/test4/test4.cpp @@ -58,7 +58,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest("%p", NULL, "NULL", "0000000000000000"); DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp index 3627ff8..006e154 100644 --- a/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test4/test4.cpp @@ -64,7 +64,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000")); DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"), diff --git a/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.cpp index 51ec1f0..ef3108d 100644 --- a/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/fprintf/test4/test4.cpp @@ -75,7 +75,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoTest("%p", NULL, "NULL", "0000000000000000", "0x0"); DoTest("%p", ptr, "pointer to 0x123456", "0000000000123456", "0x123456"); diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.cpp index 96fb472..a894120 100644 --- a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.cpp @@ -32,7 +32,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest(convert("%p"), NULL, "NULL", "0000000000000000", "0x0"); DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "0000000000123456", diff --git a/src/pal/tests/palsuite/c_runtime/printf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/printf/test4/test4.cpp index bcdc201..7b0178c 100644 --- a/src/pal/tests/palsuite/c_runtime/printf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/printf/test4/test4.cpp @@ -29,7 +29,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest("%p", NULL, "NULL", "0000000000000000"); DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); diff --git a/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp index 46115ad..bb3a6d8 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp @@ -33,7 +33,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest("%p", NULL, "NULL", "0000000000000000"); DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.cpp index 02cc3f9..9a68bda 100644 --- a/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/swprintf/test4/test4.cpp @@ -33,7 +33,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest(convert("%p"), NULL, convert("0000000000000000")); DoPointerTest(convert("%p"), ptr, convert("0000000000123456")); diff --git a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.cpp index d24f08d..75d11f6 100644 --- a/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/vfprintf/test4/test4.cpp @@ -32,7 +32,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest("%p", NULL, "NULL", "0000000000000000"); DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); diff --git a/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.cpp index 3b66cde..2cbdb35 100644 --- a/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/vprintf/test4/test4.cpp @@ -32,7 +32,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest("%p", NULL, "NULL", "0000000000000000"); DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); diff --git a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp index dc43a9e..e052d8e 100644 --- a/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/vsprintf/test4/test4.cpp @@ -31,7 +31,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest("%p", NULL, "NULL", "0000000000000000"); DoPointerTest("%p", ptr, "pointer to 0x123456", "0000000000123456"); diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp index 583cf0c..c54fe6a 100644 --- a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.cpp @@ -62,7 +62,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("0000000000000000")); DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"), diff --git a/src/pal/tests/palsuite/common/ResultTime.h b/src/pal/tests/palsuite/common/ResultTime.h index df706e7..82daeb8 100644 --- a/src/pal/tests/palsuite/common/ResultTime.h +++ b/src/pal/tests/palsuite/common/ResultTime.h @@ -11,11 +11,7 @@ const char *szDotNetInstallEnvVar = "DOTNET_INSTALL"; const char *szQASupportDirEnvVar = "QA_SUPPORT_DIR"; -#ifdef PLATFORM_UNIX #define SEPERATOR "/" -#else -#define SEPERATOR "\\" -#endif char *getBuildNumber() { char *szBuildFileName = "buildinfo.txt"; @@ -34,16 +30,6 @@ char *getBuildNumber() Fail("ERROR: Couldn't allocate enough memory to potentially store build number\n"); } -#ifndef PLATFORM_UNIX - pDirectoryName = getenv(szDotNetInstallEnvVar); - if (pDirectoryName == NULL) - { - /* This condition may exist if the test is being run in say the Dev environment.*/ - Trace("WARNING: Coriolis Test Environment may not be setup correctly. Variable DOTNET_INSTALL not set\n"); - _snprintf(szTempValue, 99, "0000.00"); - return szTempValue; - } -#else pDirectoryName = getenv(szQASupportDirEnvVar); if (pDirectoryName == NULL) { @@ -52,14 +38,8 @@ char *getBuildNumber() return szTempValue; } -#endif //PLATFORM_UNIX - -#ifndef PLATFORM_UNIX - _snprintf(szBuildFileLoc, MAX_PATH, "%s%s%s", pDirectoryName, SEPERATOR, szBuildFileName); -#else // To avoid buffer overruns for pDirectoryName _snprintf(szBuildFileLoc, MAX_PATH, "%s/../1.0%s%s", pDirectoryName, SEPERATOR, szBuildFileName); -#endif //PLATFORM_UNIX fp = fopen( szBuildFileLoc, "r"); if( fp == NULL) { diff --git a/src/pal/tests/palsuite/composite/object_management/semaphore/shared/main.cpp b/src/pal/tests/palsuite/composite/object_management/semaphore/shared/main.cpp index deb8252..d3cfa76 100644 --- a/src/pal/tests/palsuite/composite/object_management/semaphore/shared/main.cpp +++ b/src/pal/tests/palsuite/composite/object_management/semaphore/shared/main.cpp @@ -129,8 +129,6 @@ make the most sense to just skip the named semaphore test on Windows - from an object management perspective it doesn't really gain us anything over what we already have." */ -#ifdef PLATFORM_UNIX - ZeroMemory( objectSuffix, MAX_PATH ); if(GetParameters(argc, argv)) @@ -272,7 +270,6 @@ us anything over what we already have." Trace("Test Failed\n"); } -#endif //PLATFORM_UNIX PAL_Terminate(); return testReturnCode; } diff --git a/src/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp b/src/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp index 6c2d80b..d45dc92 100644 --- a/src/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp +++ b/src/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp @@ -460,7 +460,7 @@ int test11(int num, ...) /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) Trace("Testing for 64 Bit Platforms \n"); if(memcmp(OutBuffer, convert("Pal 00000000000123AB and foo Testing"), diff --git a/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.cpp index ca9e5bb..a68a1f6 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.cpp +++ b/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.cpp @@ -36,7 +36,7 @@ int __cdecl main(int argc, char *argv[]) -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) ptrValue = (LONG *) malloc(sizeof(LONG)); if(ptrValue == NULL) diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.cpp index 56430e6..bb5981c 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.cpp +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.cpp @@ -42,7 +42,7 @@ int __cdecl main(int argc, char *argv[]) { /* ** Run only on 64 bit platforms */ -#if defined(BIT64) && defined(PLATFORM_UNIX) +#if defined(BIT64) /* Compare START_VALUE with BaseVariableToManipulate, they're equal, so exchange */ @@ -55,18 +55,10 @@ int __cdecl main(int argc, char *argv[]) { /* Exchanged, these should be equal now */ if(BaseVariableToManipulate != ValueToExchange) { -#ifdef PLATFORM_UNIX Fail("ERROR: A successful compare and exchange should have occurred, " "making the variable have the value of %ll, as opposed to the " "current value of %ll.", ValueToExchange,BaseVariableToManipulate); -#else - Fail("ERROR: A successful compare and exchange should have occurred, " - "making the variable have the value of %I64, as opposed to the " - "current value of %d.", - ValueToExchange,BaseVariableToManipulate); - -#endif } /* Check to make sure it returns the original number which @@ -74,15 +66,9 @@ int __cdecl main(int argc, char *argv[]) { */ if(TheReturn != START_VALUE) { -#ifdef PLATFORM_UNIX Fail("ERROR: The return value after the first exchange should be the " "former value of the variable, which was %ll, but it is now %ll.", START_VALUE,TheReturn); -#else - Fail("ERROR: The return value after the first exchange should be the " - "former value of the variable, which was %I64, but it is now %I64.", - START_VALUE,TheReturn); -#endif } @@ -103,20 +89,13 @@ int __cdecl main(int argc, char *argv[]) { if(BaseVariableToManipulate != TempValue) { -#ifdef PLATFORM_UNIX Fail("ERROR: An attempted exchange should have failed due to " "the compare failing. But, it seems to have succeeded. The " "value should be %ll but is %ll in this case.", TempValue,BaseVariableToManipulate); -#else - Fail("ERROR: An attempted exchange should have failed due to " - "the compare failing. But, it seems to have succeeded. The " - "value should be %I64 but is %I64 in this case.", - TempValue,BaseVariableToManipulate); -#endif } -#endif //if defined(BIT64) && defined(PLATFORM_UNIX) +#endif //if defined(BIT64) PAL_Terminate(); return PASS; } diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.cpp b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.cpp index 2440543..b2b0b63 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.cpp +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.cpp @@ -47,7 +47,7 @@ int __cdecl main(int argc, char *argv[]) /* ** Run only on 64 bit platforms */ - #if defined(BIT64) && defined(PLATFORM_UNIX) + #if defined(BIT64) //Create MAX_THREADS threads that will operate on the global counter for (i=0;i -#ifndef PLATFORM_UNIX -#define LLFORMAT "%I64u" -#else #define LLFORMAT "%llu" -#endif ULONGLONG dwCreateThreadTestParameter = 0;