diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-04-16 06:39:55 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-04-16 06:39:55 -0700 |
commit | baa57a0bd737d2cb43bd947274a552d3f0b7c202 (patch) | |
tree | 1c978bb7ba24eae9b0d508d2659b7c70d174b1cb | |
parent | 806f7a19245d657bde26f4e3219bf05586a30236 (diff) | |
parent | 5c140f7d758e6f446e386b7d2753d53acfb9a9fa (diff) | |
download | coreclr-baa57a0bd737d2cb43bd947274a552d3f0b7c202.tar.gz coreclr-baa57a0bd737d2cb43bd947274a552d3f0b7c202.tar.bz2 coreclr-baa57a0bd737d2cb43bd947274a552d3f0b7c202.zip |
Merge pull request #718 from janvorli/cleanup-safecrt
Cleanup safecrt in PAL
-rw-r--r-- | src/pal/src/safecrt/crtdefs.h | 1909 | ||||
-rw-r--r-- | src/pal/src/safecrt/input.inl | 37 | ||||
-rw-r--r-- | src/pal/src/safecrt/output.inl | 858 | ||||
-rw-r--r-- | src/pal/src/safecrt/safecrt_output_l.c | 845 | ||||
-rw-r--r-- | src/pal/src/safecrt/safecrt_woutput_s.c | 5 |
5 files changed, 7 insertions, 3647 deletions
diff --git a/src/pal/src/safecrt/crtdefs.h b/src/pal/src/safecrt/crtdefs.h deleted file mode 100644 index 2666196a33..0000000000 --- a/src/pal/src/safecrt/crtdefs.h +++ /dev/null @@ -1,1909 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -/*** -*crtdefs.h - definitions/declarations common to all CRT -* - -* -*Purpose: -* This file has mostly defines used by the entire CRT. -* -* [Public] -* -****/ - -/* Lack of pragma once is deliberate */ - -/* Define _CRTIMP */ -#ifndef _CRTIMP -#ifdef CRTDLL -#define _CRTIMP __declspec(dllexport) -#else /* CRTDLL */ -#ifdef _DLL -#define _CRTIMP __declspec(dllimport) -#else /* _DLL */ -#define _CRTIMP -#endif /* _DLL */ -#endif /* CRTDLL */ -#endif /* _CRTIMP */ - -#ifndef _INC_CRTDEFS -#define _INC_CRTDEFS - -#ifndef _CRTBLD -/* This version of the header files is NOT for user programs. - * It is intended for use when building the C runtimes ONLY. - * The version intended for public use will not have this message. - */ -#error ERROR: Use of C runtime library internal header file. -#endif /* _CRTBLD */ - -#ifndef _INTERNAL_IFSTRIP_ - -/* Turn off cpp overloads internally */ -#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 0 -#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 0 -#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 0 - -#endif /* _INTERNAL_IFSTRIP_ */ - -#if defined (__midl) -/* MIDL does not want to see this stuff */ -#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES -#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT -#undef _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES -#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 0 -#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 0 -#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 0 -#endif /* defined (__midl) */ - -#if !defined (_WIN32) -#error ERROR: Only Win32 target supported! -#endif /* !defined (_WIN32) */ - -#ifdef _CRTBLD -#ifndef _INTERNAL_IFSTRIP_ -#ifndef _CRT_NOFORCE_MANIFEST -#define _CRT_FORCE_MANIFEST -#endif /* _CRT_NOFORCE_MANIFEST */ -#endif /* _INTERNAL_IFSTRIP_ */ -#endif /* _CRTBLD */ - -#ifdef _CRT_NOFORCE_MANIFEST - -#ifdef _CRT_FORCE_MANIFEST - #pragma message ("_CRT_FORCE_MANIFEST and _CRT_NOFORCE_MANIFEST defined. Define just one") - #pragma message ("_CRT_FORCE_MANIFEST ignored") -#endif /* _CRT_FORCE_MANIFEST */ - -#else /* _CRT_NOFORCE_MANIFEST */ - -#if !defined (_CRT_FORCE_MANIFEST) && defined (_VC_NODEFAULTLIB) - #define _CRT_NOFORCE_MANIFEST -#endif /* !defined (_CRT_FORCE_MANIFEST) && defined (_VC_NODEFAULTLIB) */ - -#endif /* _CRT_NOFORCE_MANIFEST */ - -#include <sal.h> - -#ifdef _DLL - -#if !defined (_CRT_NOFORCE_MANIFEST) - -#ifdef _DEBUG -#ifdef _CRT_MANIFEST_RETAIL -#define _CRT_MANIFEST_INCONSISTENT -#else /* _CRT_MANIFEST_RETAIL */ -#define _CRT_MANIFEST_DEBUG -#endif /* _CRT_MANIFEST_RETAIL */ -#else /* _DEBUG */ -#ifdef _CRT_MANIFEST_DEBUG -#define _CRT_MANIFEST_INCONSISTENT -#else /* _CRT_MANIFEST_DEBUG */ -#define _CRT_MANIFEST_RETAIL -#endif /* _CRT_MANIFEST_DEBUG */ -#endif /* _DEBUG */ - -#ifdef _CRT_MANIFEST_INCONSISTENT -#error You have included some C++/C library header files with _DEBUG defined and some with _DEBUG not defined. This will not work correctly. Please have _DEBUG set or clear consistently. -#endif /* _CRT_MANIFEST_INCONSISTENT */ - -#include <crtassem.h> - -#ifdef _M_IX86 - -#ifdef _DEBUG -#pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugCRT' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='x86' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") -#else /* _DEBUG */ -#pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='x86' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") -#endif /* _DEBUG */ - -#endif /* _M_IX86 */ - -#ifdef _M_AMD64 - -#ifdef _DEBUG -#pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugCRT' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='amd64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") -#else /* _DEBUG */ -#pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='amd64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") -#endif /* _DEBUG */ - -#endif /* _M_AMD64 */ - -#ifdef _M_IA64 - -#ifdef _DEBUG -#pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugCRT' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='ia64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") -#else /* _DEBUG */ -#pragma comment(linker,"/manifestdependency:\"type='win32' " \ - "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \ - "version='" _CRT_ASSEMBLY_VERSION "' " \ - "processorArchitecture='ia64' " \ - "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") -#endif /* _DEBUG */ - -#endif /* _M_IA64 */ - -#endif /* !defined (_CRT_NOFORCE_MANIFEST) */ - -#endif /* _DLL */ - -#ifdef _MSC_VER -#undef _CRT_PACKING -#define _CRT_PACKING 8 - -#pragma pack(push,_CRT_PACKING) -#endif /* _MSC_VER */ - -#include <vadefs.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* preprocessor string helpers */ -#ifndef _CRT_STRINGIZE -#define __CRT_STRINGIZE(_Value) #_Value -#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value) -#endif /* _CRT_STRINGIZE */ - -#ifndef _CRT_WIDE -#define __CRT_WIDE(_String) L ## _String -#define _CRT_WIDE(_String) __CRT_WIDE(_String) -#endif /* _CRT_WIDE */ - - -#if !defined (_W64) -#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -#define _W64 __w64 -#else /* !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 */ -#define _W64 -#endif /* !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 */ -#endif /* !defined (_W64) */ - -#ifndef _INTERNAL_IFSTRIP_ -/* Define _CRTIMP1 */ - -#ifndef _CRTIMP1 -#ifdef CRTDLL1 -#define _CRTIMP1 __declspec(dllexport) -#else /* CRTDLL1 */ -#define _CRTIMP1 _CRTIMP -#endif /* CRTDLL1 */ -#endif /* _CRTIMP1 */ -#endif /* _INTERNAL_IFSTRIP_ */ - -/* Define _CRTIMP_NOIA64 */ -#ifndef _CRTIMP_NOIA64 -#if defined (_M_IA64) -#define _CRTIMP_NOIA64 -#else /* defined (_M_IA64) */ -#define _CRTIMP_NOIA64 _CRTIMP -#endif /* defined (_M_IA64) */ -#endif /* _CRTIMP_NOIA64 */ - -/* Define _CRTIMP2 */ - -#ifndef _CRTIMP2 -#if defined (CRTDLL2) -#define _CRTIMP2 __declspec(dllexport) -#else /* defined (CRTDLL2) */ -#if defined (_DLL) && !defined (_STATIC_CPPLIB) -#define _CRTIMP2 __declspec(dllimport) -#else /* defined (_DLL) && !defined (_STATIC_CPPLIB) */ -#define _CRTIMP2 -#endif /* defined (_DLL) && !defined (_STATIC_CPPLIB) */ -#endif /* defined (CRTDLL2) */ -#endif /* _CRTIMP2 */ - -/* Define _CRTIMP_ALTERNATIVE */ - -#ifndef _INTERNAL_IFSTRIP_ -/* This _CRTIMP_ALTERNATIVE is used to mark the secure functions implemented in safecrt.lib, which are - meant to be available downlevel. In Windows, they will be merged in msvcrt.lib (the import - library, so Windows should change: - #define _CRTIMP_ALTERNATIVE __declspec(dllimport) - to: - #define _CRTIMP_ALTERNATIVE - since these function will never be compiled in the msvcrt.dll. - Here the trick is done based on _CRT_ALTERNATIVE_INLINES which enforce that safecrt.h is included before - every other standard include files. - */ -#endif /* _INTERNAL_IFSTRIP_ */ -#ifndef _CRTIMP_ALTERNATIVE -#ifdef CRTDLL -#ifdef _SAFECRT_IMPL - #define _CRTIMP_ALTERNATIVE -#else /* _SAFECRT_IMPL */ - #define _CRTIMP_ALTERNATIVE __declspec(dllexport) -#endif /* _SAFECRT_IMPL */ -#else /* CRTDLL */ -#ifdef _DLL -#ifdef _CRT_ALTERNATIVE_INLINES -#define _CRTIMP_ALTERNATIVE -#else /* _CRT_ALTERNATIVE_INLINES */ -#define _CRTIMP_ALTERNATIVE _CRTIMP -#define _CRT_ALTERNATIVE_IMPORTED -#endif /* _CRT_ALTERNATIVE_INLINES */ -#else /* _DLL */ -#define _CRTIMP_ALTERNATIVE -#endif /* _DLL */ -#endif /* CRTDLL */ -#endif /* _CRTIMP_ALTERNATIVE */ - -/* Define _MRTIMP */ - -#ifndef _MRTIMP -#ifdef MRTDLL -#if !defined (_M_CEE_PURE) - #define _MRTIMP __declspec(dllexport) -#else /* !defined (_M_CEE_PURE) */ - #define _MRTIMP -#endif /* !defined (_M_CEE_PURE) */ -#else /* MRTDLL */ -#define _MRTIMP __declspec(dllimport) -#endif /* MRTDLL */ -#endif /* _MRTIMP */ - -/* Define _MRTIMP2 */ -#ifndef _MRTIMP2 -#if defined (CRTDLL2) -#define _MRTIMP2 __declspec(dllexport) -#elif defined (MRTDLL) -#define _MRTIMP2 _MRTIMP -#else /* defined (MRTDLL) */ - -#if defined (_DLL) && !defined (_STATIC_CPPLIB) -#define _MRTIMP2 __declspec(dllimport) - -#else /* defined (_DLL) && !defined (_STATIC_CPPLIB) */ -#define _MRTIMP2 -#endif /* defined (_DLL) && !defined (_STATIC_CPPLIB) */ - -#endif /* defined (MRTDLL) */ -#endif /* _MRTIMP2 */ - - -#ifndef _MCRTIMP -#if defined (CRTDLL) || defined (MRTDLL) -#define _MCRTIMP __declspec(dllexport) -#else /* defined (CRTDLL) || defined (MRTDLL) */ -#ifdef _DLL -#define _MCRTIMP __declspec(dllimport) -#else /* _DLL */ -#define _MCRTIMP -#endif /* _DLL */ -#endif /* defined (CRTDLL) || defined (MRTDLL) */ -#endif /* _MCRTIMP */ - -#ifndef __CLR_OR_THIS_CALL -#if defined (MRTDLL) || defined (_M_CEE_PURE) -#define __CLR_OR_THIS_CALL __clrcall -#else /* defined (MRTDLL) || defined (_M_CEE_PURE) */ -#define __CLR_OR_THIS_CALL -#endif /* defined (MRTDLL) || defined (_M_CEE_PURE) */ -#endif /* __CLR_OR_THIS_CALL */ - -#ifndef __CLRCALL_OR_CDECL -#if defined (MRTDLL) || defined (_M_CEE_PURE) -#define __CLRCALL_OR_CDECL __clrcall -#else /* defined (MRTDLL) || defined (_M_CEE_PURE) */ -#define __CLRCALL_OR_CDECL __cdecl -#endif /* defined (MRTDLL) || defined (_M_CEE_PURE) */ -#endif /* __CLRCALL_OR_CDECL */ - -#ifndef _CRTIMP_PURE -#if defined (_M_CEE_PURE) || defined (_STATIC_CPPLIB) - #define _CRTIMP_PURE -#elif defined (MRTDLL) - #define _CRTIMP_PURE -#else /* defined (MRTDLL) */ - #define _CRTIMP_PURE _CRTIMP -#endif /* defined (MRTDLL) */ -#endif /* _CRTIMP_PURE */ - -#ifndef _PGLOBAL -#ifdef _M_CEE -#if defined (__cplusplus_cli) - #define _PGLOBAL __declspec(process) -#else /* defined (__cplusplus_cli) */ - #define _PGLOBAL -#endif /* defined (__cplusplus_cli) */ -#else /* _M_CEE */ -#define _PGLOBAL -#endif /* _M_CEE */ -#endif /* _PGLOBAL */ - -#ifndef _AGLOBAL -#ifdef _M_CEE -#define _AGLOBAL __declspec(appdomain) -#else /* _M_CEE */ -#define _AGLOBAL -#endif /* _M_CEE */ -#endif /* _AGLOBAL */ - -/* define a specific constant for mixed mode */ -#ifdef _M_CEE -#ifndef _M_CEE_PURE -#define _M_CEE_MIXED -#endif /* _M_CEE_PURE */ -#endif /* _M_CEE */ - -/* Define __STDC_SECURE_LIB__ */ -#define __STDC_SECURE_LIB__ 200411L - -/* Retain__GOT_SECURE_LIB__ for back-compat */ -#define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__ - -/* Default value for __STDC_WANT_SECURE_LIB__ is 1 */ -#ifndef __STDC_WANT_SECURE_LIB__ -#define __STDC_WANT_SECURE_LIB__ 1 -#endif /* __STDC_WANT_SECURE_LIB__ */ - -/* Turn off deprecation if __STDC_WANT_SECURE_LIB__ is 0 */ -#if !__STDC_WANT_SECURE_LIB__ && !defined (_CRT_SECURE_NO_DEPRECATE) -#define _CRT_SECURE_NO_DEPRECATE -#endif /* !__STDC_WANT_SECURE_LIB__ && !defined (_CRT_SECURE_NO_DEPRECATE) */ - -#if _MSC_FULL_VER >= 140050320 -#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text)) -#else /* _MSC_FULL_VER >= 140050320 */ -#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated) -#endif /* _MSC_FULL_VER >= 140050320 */ - -/* Define _CRT_INSECURE_DEPRECATE */ -#ifndef _CRT_INSECURE_DEPRECATE -#ifdef _CRT_SECURE_NO_DEPRECATE -#define _CRT_INSECURE_DEPRECATE(_Replacement) -#else /* _CRT_SECURE_NO_DEPRECATE */ -#define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT("This function or variable may be unsafe. Consider using " #_Replacement " instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.") -#endif /* _CRT_SECURE_NO_DEPRECATE */ -#endif /* _CRT_INSECURE_DEPRECATE */ - -/* Define _CRT_INSECURE_DEPRECATE_MEMORY */ -#ifndef _CRT_INSECURE_DEPRECATE_MEMORY -#if !defined (_CRT_SECURE_DEPRECATE_MEMORY) -#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement) -#else /* !defined (_CRT_SECURE_DEPRECATE_MEMORY) */ -#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement) _CRT_INSECURE_DEPRECATE(_Replacement) -#endif /* !defined (_CRT_SECURE_DEPRECATE_MEMORY) */ -#endif /* _CRT_INSECURE_DEPRECATE_MEMORY */ - -/* Define _CRT_INSECURE_DEPRECATE_GLOBALS */ -#ifndef _CRT_INSECURE_DEPRECATE_GLOBALS -#if defined (RC_INVOKED) -#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement) -#else /* defined (RC_INVOKED) */ -#if defined (_CRT_SECURE_NO_DEPRECATE_GLOBALS) -#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement) -#else /* defined (_CRT_SECURE_NO_DEPRECATE_GLOBALS) */ -#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement) _CRT_INSECURE_DEPRECATE(_Replacement) -#endif /* defined (_CRT_SECURE_NO_DEPRECATE_GLOBALS) */ -#endif /* defined (RC_INVOKED) */ -#endif /* _CRT_INSECURE_DEPRECATE_GLOBALS */ - -/* Define _CRT_MANAGED_HEAP_DEPRECATE */ -#ifndef _CRT_MANAGED_HEAP_DEPRECATE -#ifdef _CRT_MANAGED_HEAP_NO_DEPRECATE -#define _CRT_MANAGED_HEAP_DEPRECATE -#else /* _CRT_MANAGED_HEAP_NO_DEPRECATE */ -#if defined (_M_CEE) -#define _CRT_MANAGED_HEAP_DEPRECATE -/* Disabled to allow QA tests to get fixed -_CRT_DEPRECATE_TEXT("Direct heap access is not safely possible from managed code.") -*/ -#else /* defined (_M_CEE) */ -#define _CRT_MANAGED_HEAP_DEPRECATE -#endif /* defined (_M_CEE) */ -#endif /* _CRT_MANAGED_HEAP_NO_DEPRECATE */ -#endif /* _CRT_MANAGED_HEAP_DEPRECATE */ - -/* _SECURECRT_FILL_BUFFER_PATTERN is the same as _bNoMansLandFill */ -#define _SECURECRT_FILL_BUFFER_PATTERN 0xFD - -/* obsolete stuff */ -#ifdef _CRTBLD -#ifndef _INTERNAL_IFSTRIP_ -/* These are still used in the CRT sources only */ -#define _CRT_OBSOLETE(_NewItem) -#else /* _INTERNAL_IFSTRIP_ */ - -/* Define _CRT_OBSOLETE */ -#ifndef _CRT_OBSOLETE -#ifdef _CRT_OBSOLETE_NO_DEPRECATE -#define _CRT_OBSOLETE(_NewItem) -#else /* _CRT_OBSOLETE_NO_DEPRECATE */ -#define _CRT_OBSOLETE(_NewItem) _CRT_DEPRECATE_TEXT("This function or variable has been superceded by newer library or operating system functionality. Consider using" #_NewItem "instead. See online help for details.") -#endif /* _CRT_OBSOLETE_NO_DEPRECATE */ -#endif /* _CRT_OBSOLETE */ - -#endif /* _INTERNAL_IFSTRIP_ */ -#endif /* _CRTBLD */ - -/* jit64 instrinsic stuff */ -#ifndef _CRT_JIT_INTRINSIC -#if defined (_M_CEE) && (defined (_M_AMD64) || defined (_M_IA64)) -/* This is only needed when managed code is calling the native APIs, targeting the 64-bit runtime */ -#define _CRT_JIT_INTRINSIC __declspec(jitintrinsic) -#else /* defined (_M_CEE) && (defined (_M_AMD64) || defined (_M_IA64)) */ -#define _CRT_JIT_INTRINSIC -#endif /* defined (_M_CEE) && (defined (_M_AMD64) || defined (_M_IA64)) */ -#endif /* _CRT_JIT_INTRINSIC */ - -/* Define overload switches */ -#if !defined (RC_INVOKED) -#if !defined (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES) - #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 0 -#else /* !defined (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES) */ -#if !__STDC_WANT_SECURE_LIB__ && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - #error Cannot use Secure CRT C++ overloads when __STDC_WANT_SECURE_LIB__ is 0 -#endif /* !__STDC_WANT_SECURE_LIB__ && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES */ -#endif /* !defined (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES) */ -#endif /* !defined (RC_INVOKED) */ - -#if !defined (RC_INVOKED) -#if !defined (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT) - /* _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT is ignored if _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES is set to 0 */ - #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 0 -#else /* !defined (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT) */ -#if !__STDC_WANT_SECURE_LIB__ && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT - #error Cannot use Secure CRT C++ overloads when __STDC_WANT_SECURE_LIB__ is 0 -#endif /* !__STDC_WANT_SECURE_LIB__ && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT */ -#endif /* !defined (_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT) */ -#endif /* !defined (RC_INVOKED) */ - -#if !defined (RC_INVOKED) -#if !defined (_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES) -#if __STDC_WANT_SECURE_LIB__ - #define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1 -#else /* __STDC_WANT_SECURE_LIB__ */ - #define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 0 -#endif /* __STDC_WANT_SECURE_LIB__ */ -#else /* !defined (_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES) */ -#if !__STDC_WANT_SECURE_LIB__ && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES - #error Cannot use Secure CRT C++ overloads when __STDC_WANT_SECURE_LIB__ is 0 -#endif /* !__STDC_WANT_SECURE_LIB__ && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES */ -#endif /* !defined (_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES) */ -#endif /* !defined (RC_INVOKED) */ - -/* Define _CRT_NONSTDC_DEPRECATE */ -#if !defined (_CRT_NONSTDC_DEPRECATE) -#if defined (_CRT_NONSTDC_NO_DEPRECATE) -#define _CRT_NONSTDC_DEPRECATE(_NewName) -#else /* defined (_CRT_NONSTDC_NO_DEPRECATE) */ -#define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT("The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: " #_NewName ". See online help for details.") -#endif /* defined (_CRT_NONSTDC_NO_DEPRECATE) */ -#endif /* !defined (_CRT_NONSTDC_DEPRECATE) */ - -#ifndef _SIZE_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 size_t; -#else /* _WIN64 */ -typedef _W64 unsigned int size_t; -#endif /* _WIN64 */ -#define _SIZE_T_DEFINED -#endif /* _SIZE_T_DEFINED */ - -#if __STDC_WANT_SECURE_LIB__ -#ifndef _RSIZE_T_DEFINED -typedef size_t rsize_t; -#define _RSIZE_T_DEFINED -#endif /* _RSIZE_T_DEFINED */ -#endif /* __STDC_WANT_SECURE_LIB__ */ - -#ifndef _INTPTR_T_DEFINED -#ifdef _WIN64 -typedef __int64 intptr_t; -#else /* _WIN64 */ -typedef _W64 int intptr_t; -#endif /* _WIN64 */ -#define _INTPTR_T_DEFINED -#endif /* _INTPTR_T_DEFINED */ - -#ifndef _UINTPTR_T_DEFINED -#ifdef _WIN64 -typedef unsigned __int64 uintptr_t; -#else /* _WIN64 */ -typedef _W64 unsigned int uintptr_t; -#endif /* _WIN64 */ -#define _UINTPTR_T_DEFINED -#endif /* _UINTPTR_T_DEFINED */ - -#ifndef _PTRDIFF_T_DEFINED -#ifdef _WIN64 -typedef __int64 ptrdiff_t; -#else /* _WIN64 */ -typedef _W64 int ptrdiff_t; -#endif /* _WIN64 */ -#define _PTRDIFF_T_DEFINED -#endif /* _PTRDIFF_T_DEFINED */ - -#ifndef _WCHAR_T_DEFINED -typedef unsigned short wchar_t; -#define _WCHAR_T_DEFINED -#endif /* _WCHAR_T_DEFINED */ - -#ifndef _WCTYPE_T_DEFINED -typedef unsigned short wint_t; -typedef unsigned short wctype_t; -#define _WCTYPE_T_DEFINED -#endif /* _WCTYPE_T_DEFINED */ - -#ifndef _VA_LIST_DEFINED -#ifdef _M_CEE_PURE -typedef System::ArgIterator va_list; -#else /* _M_CEE_PURE */ -typedef char * va_list; -#endif /* _M_CEE_PURE */ -#define _VA_LIST_DEFINED -#endif /* _VA_LIST_DEFINED */ - -#ifdef _USE_32BIT_TIME_T -#ifdef _WIN64 -#error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64 -#undef _USE_32BIT_TIME_T -#endif /* _WIN64 */ -#else /* _USE_32BIT_TIME_T */ -#if _INTEGRAL_MAX_BITS < 64 -#define _USE_32BIT_TIME_T -#endif /* _INTEGRAL_MAX_BITS < 64 */ -#endif /* _USE_32BIT_TIME_T */ - -#ifndef _ERRCODE_DEFINED -#define _ERRCODE_DEFINED -/* errcode is deprecated in favor or errno_t, which is part of the standard proposal */ -#if !defined (__midl) -_CRT_DEPRECATE_TEXT("This name was supported during some Whidbey pre-releases. Instead, use the standard name errno_t." ) typedef int errcode; -#else /* !defined (__midl) */ -typedef int errcode; -#endif /* !defined (__midl) */ - -typedef int errno_t; -#endif /* _ERRCODE_DEFINED */ - -#ifndef _TIME32_T_DEFINED -typedef _W64 long __time32_t; /* 32-bit time value */ -#define _TIME32_T_DEFINED -#endif /* _TIME32_T_DEFINED */ - -#ifndef _TIME64_T_DEFINED -#if _INTEGRAL_MAX_BITS >= 64 -typedef __int64 __time64_t; /* 64-bit time value */ -#endif /* _INTEGRAL_MAX_BITS >= 64 */ -#define _TIME64_T_DEFINED -#endif /* _TIME64_T_DEFINED */ - -#ifndef _TIME_T_DEFINED -#ifdef _USE_32BIT_TIME_T -typedef __time32_t time_t; /* time value */ -#else /* _USE_32BIT_TIME_T */ -typedef __time64_t time_t; /* time value */ -#endif /* _USE_32BIT_TIME_T */ -#define _TIME_T_DEFINED /* avoid multiple def's of time_t */ -#endif /* _TIME_T_DEFINED */ - -#ifndef _CONST_RETURN -#ifdef __cplusplus -#define _CONST_RETURN const -#define _CRT_CONST_CORRECT_OVERLOADS -#else /* __cplusplus */ -#define _CONST_RETURN -#endif /* __cplusplus */ -#endif /* _CONST_RETURN */ - -#if !defined (UNALIGNED) -#if defined (_M_IA64) || defined (_M_AMD64) -#define UNALIGNED __unaligned -#else /* defined (_M_IA64) || defined (_M_AMD64) */ -#define UNALIGNED -#endif /* defined (_M_IA64) || defined (_M_AMD64) */ -#endif /* !defined (UNALIGNED) */ - -#if !defined (_CRT_ALIGN) -#if defined (__midl) -#define _CRT_ALIGN(x) -#else /* defined (__midl) */ -#define _CRT_ALIGN(x) __declspec(align(x)) -#endif /* defined (__midl) */ -#endif /* !defined (_CRT_ALIGN) */ - -/* Define _CRTNOALIAS, _CRTRESTRICT */ - -#if _MSC_FULL_VER >= 13102050 -#if !defined (_MSC_VER_GREATER_THEN_13102050) -#define _MSC_VER_GREATER_THEN_13102050 -#endif /* !defined (_MSC_VER_GREATER_THEN_13102050) */ -#endif /* _MSC_FULL_VER >= 13102050 */ - -#if ( defined(_M_IA64) && defined(_MSC_VER_GREATER_THEN_13102050) ) || _MSC_VER >= 1400 -#ifndef _CRTNOALIAS -#define _CRTNOALIAS __declspec(noalias) -#endif /* _CRTNOALIAS */ - -#ifndef _CRTRESTRICT -#define _CRTRESTRICT __declspec(restrict) -#endif /* _CRTRESTRICT */ - -#else /* ( defined(_M_IA64) && defined(_MSC_VER_GREATER_THEN_13102050) ) || _MSC_VER >= 1400 */ - -#ifndef _CRTNOALIAS -#define _CRTNOALIAS -#endif /* _CRTNOALIAS */ - -#ifndef _CRTRESTRICT -#define _CRTRESTRICT -#endif /* _CRTRESTRICT */ - -#endif /* ( defined(_M_IA64) && defined(_MSC_VER_GREATER_THEN_13102050) ) || _MSC_VER >= 1400 */ - -/* Define __cdecl for non-Microsoft compilers */ -#if (!defined (_MSC_VER) && !defined (__cdecl)) -#define __cdecl -#endif /* (!defined (_MSC_VER) && !defined (__cdecl)) */ - -#if !defined (__CRTDECL) -#if defined (_M_CEE_PURE) -#define __CRTDECL -#else /* defined (_M_CEE_PURE) */ -#define __CRTDECL __cdecl -#endif /* defined (_M_CEE_PURE) */ -#endif /* !defined (__CRTDECL) */ - -#ifndef _INTERNAL_IFSTRIP_ -#define __UPDATE_LOCALE(ptd, ptloci) if( ( (ptloci) != __ptlocinfo) && \ - !( (ptd)->_ownlocale & __globallocalestatus)) \ - { \ - (ptloci) = __updatetlocinfo(); \ - } - -#define __UPDATE_MBCP(ptd, ptmbci) if( ( (ptmbci) != __ptmbcinfo) && \ - !( (ptd)->_ownlocale & __globallocalestatus)) \ - { \ - (ptmbci) = __updatetmbcinfo(); \ - } - -/* small function to set global read-only variables */ -#ifndef _DEFINE_SET_FUNCTION -#define _DEFINE_SET_FUNCTION(_FuncName, _Type, _VarName) \ - __inline \ - void _FuncName(_Type _Value) \ - { \ - __pragma(warning(push)) \ - __pragma(warning(disable:4996)) \ - _VarName = _Value; \ - __pragma(warning(pop)) \ - } -#endif /* _DEFINE_SET_FUNCTION */ - -#endif /* _INTERNAL_IFSTRIP_ */ - -#define _ARGMAX 100 - -/* _TRUNCATE */ -#if !defined (_TRUNCATE) -#define _TRUNCATE ((size_t)-1) -#endif /* !defined (_TRUNCATE) */ - -/* helper macros for cpp overloads */ -#if !defined (RC_INVOKED) -#if defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(_ReturnType, _FuncName, _DstType, _Dst) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size]) \ - { \ - return _FuncName(_Dst, _Size); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1) \ - { \ - return _FuncName(_Dst, _Size, _TArg1); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return _FuncName(_Dst, _Size, _TArg1, _TArg2); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_3(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return _FuncName(_Dst, _Size, _TArg1, _TArg2, _TArg3); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4) \ - { \ - return _FuncName(_Dst, _Size, _TArg1, _TArg2, _TArg3, _TArg4); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _DstType (&_Dst)[_Size], _TType1 _TArg1) \ - { \ - return _FuncName(_HArg1, _Dst, _Size, _TArg1); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return _FuncName(_HArg1, _Dst, _Size, _TArg1, _TArg2); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_3(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return _FuncName(_HArg1, _Dst, _Size, _TArg1, _TArg2, _TArg3); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_2_0(_ReturnType, _FuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - extern "C++" \ - { \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _HType2 _HArg2, _DstType (&_Dst)[_Size]) \ - { \ - return _FuncName(_HArg1, _HArg2, _Dst, _Size); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1_ARGLIST(_ReturnType, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1) \ - extern "C++" \ - { \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg1); \ - return _VFuncName(_Dst, _Size, _TArg1, _ArgList); \ - } \ - __pragma(warning(pop)); \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2_ARGLIST(_ReturnType, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - extern "C++" \ - { \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg2); \ - return _VFuncName(_Dst, _Size, _TArg1, _TArg2, _ArgList); \ - } \ - __pragma(warning(pop)); \ - } - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_SPLITPATH(_ReturnType, _FuncName, _DstType, _Src) \ - extern "C++" \ - { \ - template <size_t _DriveSize, size_t _DirSize, size_t _NameSize, size_t _ExtSize> \ - inline \ - _ReturnType __CRTDECL _FuncName(__in const _DstType *_Src, __out_ecount_opt(_DriveSize) _DstType (&_Drive)[_DriveSize], __out_ecount_opt(_DirSize) _DstType (&_Dir)[_DirSize], __out_ecount_opt(_NameSize) _DstType (&_Name)[_NameSize], __out_ecount_opt(_ExtSize) _DstType (&_Ext)[_ExtSize]) \ - { \ - return _FuncName(_Src, _Drive, _DriveSize, _Dir, _DirSize, _Name, _NameSize, _Ext, _ExtSize); \ - } \ - } - -#else /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES */ - -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(_ReturnType, _FuncName, _DstType, _Dst) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_3(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(_ReturnType, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_3(_ReturnType, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_2_0(_ReturnType, _FuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1_ARGLIST(_ReturnType, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2_ARGLIST(_ReturnType, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) -#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_SPLITPATH(_ReturnType, _FuncName, _DstType, _Src) - -#endif /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES */ -#endif /* !defined (RC_INVOKED) */ - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_2_0(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_ARGLIST(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _VFuncName, _VFuncName##_s, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_ARGLIST(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _VFuncName##_s, _DstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_SIZE(_DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_SIZE(_DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) - - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst) \ - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_4(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_1_1(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_2_0(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_ARGLIST(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _FuncName##_s, _VFuncName, _VFuncName##_s, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE(_DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE(_DeclSpec, _FuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _FuncName##_s, _DstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) - - -#if !defined (RC_INVOKED) -#if defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - -#define __RETURN_POLICY_SAME(_FunctionCall, _Dst) return (_FunctionCall) -#define __RETURN_POLICY_DST(_FunctionCall, _Dst) return ((_FunctionCall) == 0 ? _Dst : 0) -#define __RETURN_POLICY_VOID(_FunctionCall, _Dst) (_FunctionCall); return -#define __EMPTY_DECLSPEC - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_DstType *_Dst) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_DstType *); \ - return _FuncName(_Dst); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst)); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst)); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst) \ - { \ - return __insecure_##_FuncName(_Dst); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size]) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, _Size), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1]) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, 1), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_CGETS(_ReturnType, _DeclSpec, _FuncName, _DstType, _Dst) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_DstType *_Dst) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_DstType *); \ - return _FuncName(_Dst); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst)); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst)); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst) \ - { \ - return __insecure_##_FuncName(_Dst); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size]) \ - { \ - size_t _SizeRead = 0; \ - errno_t _Err = _FuncName##_s(_Dst + 2, (_Size - 2) < ((size_t)_Dst[0]) ? (_Size - 2) : ((size_t)_Dst[0]), &_SizeRead); \ - _Dst[1] = (_DstType)(_SizeRead); \ - return (_Err == 0 ? _Dst + 2 : 0); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1]) \ - { \ - return __insecure_##_FuncName((_DstType *)_Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName<2>(_DstType (&_Dst)[2]) \ - { \ - return __insecure_##_FuncName((_DstType *)_Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_DstType *_Dst, _TType1 _TArg1) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_DstType *, _TType1); \ - return _FuncName(_Dst, _TArg1); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1) \ - { \ - return __insecure_##_FuncName(_Dst, _TArg1); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, _Size, _TArg1), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, 1, _TArg1), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_DstType *, _TType1, _TType2); \ - return _FuncName(_Dst, _TArg1, _TArg2); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return __insecure_##_FuncName(_Dst, _TArg1, _TArg2); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_SecureDstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, _Size, _TArg1, _TArg2), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, _TType2 _TArg2) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, 1, _TArg1, _TArg2), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_DstType *, _TType1, _TType2, _TType3); \ - return _FuncName(_Dst, _TArg1, _TArg2, _TArg3); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _TArg3); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _TArg3); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return __insecure_##_FuncName(_Dst, _TArg1, _TArg2, _TArg3); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, _Size, _TArg1, _TArg2, _TArg3), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, 1, _TArg1, _TArg2, _TArg3), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_DstType *, _TType1, _TType2, _TType3, _TType4); \ - return _FuncName(_Dst, _TArg1, _TArg2, _TArg3, _TArg4); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _TArg3, _TArg4); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _TArg3, _TArg4); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4) \ - { \ - return __insecure_##_FuncName(_Dst, _TArg1, _TArg2, _TArg3, _TArg4); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, _Size, _TArg1, _TArg2, _TArg3, _TArg4), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4) \ - { \ - _ReturnPolicy(_SecureFuncName(_Dst, 1, _TArg1, _TArg2, _TArg3, _TArg4), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_HType1 _HArg1, _DstType *_Dst, _TType1 _TArg1) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_HType1, _DstType *, _TType1); \ - return _FuncName(_HArg1, _Dst, _TArg1); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _T &_Dst, _TType1 _TArg1) \ - { \ - return __insecure_##_FuncName(_HArg1, static_cast<_DstType *>(_Dst), _TArg1); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, const _T &_Dst, _TType1 _TArg1) \ - { \ - return __insecure_##_FuncName(_HArg1, static_cast<_DstType *>(_Dst), _TArg1); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _DstType * &_Dst, _TType1 _TArg1) \ - { \ - return __insecure_##_FuncName(_HArg1, _Dst, _TArg1); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _DstType (&_Dst)[_Size], _TType1 _TArg1) \ - { \ - _ReturnPolicy(_SecureFuncName(_HArg1, _Dst, _Size, _TArg1), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_HType1 _HArg1, _DstType (&_Dst)[1], _TType1 _TArg1) \ - { \ - _ReturnPolicy(_SecureFuncName(_HArg1, _Dst, 1, _TArg1), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_FuncName(_HType1 _HArg1, _HType2 _HArg2, _DstType *_Dst) \ - { \ - _DeclSpec _ReturnType __cdecl _FuncName(_HType1, _HType2, _DstType *); \ - return _FuncName(_HArg1, _HArg2, _Dst); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _HType2 _HArg2, _T &_Dst) \ - { \ - return __insecure_##_FuncName(_HArg1, _HArg2, static_cast<_DstType *>(_Dst)); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _HType2 _HArg2, const _T &_Dst) \ - { \ - return __insecure_##_FuncName(_HArg1, _HArg2, static_cast<_DstType *>(_Dst)); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _HType2 _HArg2, _DstType * &_Dst) \ - { \ - return __insecure_##_FuncName(_HArg1, _HArg2, _Dst); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_HType1 _HArg1, _HType2 _HArg2, _DstType (&_Dst)[_Size]) \ - { \ - _ReturnPolicy(_SecureFuncName(_HArg1, _HArg2, _Dst, _Size), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_HType1 _HArg1, _HType2 _HArg2, _DstType (&_Dst)[1]) \ - { \ - _ReturnPolicy(_SecureFuncName(_HArg1, _HArg2, _Dst, 1), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _VFuncName, _SecureVFuncName, _DstType, _Dst, _TType1, _TArg1) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_VFuncName(_DstType *_Dst, _TType1 _TArg1, va_list _ArgList) \ - { \ - _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *, _TType1, va_list); \ - return _VFuncName(_Dst, _TArg1, _ArgList); \ - } \ - extern "C++" \ - { \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg1); \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _ArgList); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg1); \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _ArgList); \ - } \ - __pragma(warning(pop)); \ - \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg1); \ - return __insecure_##_VFuncName(_Dst, _TArg1, _ArgList); \ - } \ - __pragma(warning(pop)); \ - \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg1); \ - _ReturnPolicy(_SecureVFuncName(_Dst, _Size, _TArg1, _ArgList), _Dst); \ - } \ - __pragma(warning(pop)); \ - \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg1); \ - _ReturnPolicy(_SecureVFuncName(_Dst, 1, _TArg1, _ArgList), _Dst); \ - } \ - __pragma(warning(pop)); \ - \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName(_T &_Dst, _TType1 _TArg1, va_list _ArgList) \ - { \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _ArgList); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName(const _T &_Dst, _TType1 _TArg1, va_list _ArgList) \ - { \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _ArgList); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName(_DstType *&_Dst, _TType1 _TArg1, va_list _ArgList) \ - { \ - return __insecure_##_VFuncName(_Dst, _TArg1, _ArgList); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _VFuncName(_DstType (&_Dst)[_Size], _TType1 _TArg1, va_list _ArgList) \ - { \ - _ReturnPolicy(_SecureVFuncName(_Dst, _Size, _TArg1, _ArgList), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, va_list _ArgList) \ - { \ - _ReturnPolicy(_SecureVFuncName(_Dst, 1, _TArg1, _ArgList), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _SecureVFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __inline \ - _ReturnType __CRTDECL __insecure_##_VFuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _ArgList) \ - { \ - _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *, _TType1, _TType2, va_list); \ - return _VFuncName(_Dst, _TArg1, _TArg2, _ArgList); \ - } \ - extern "C++" \ - { \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1, _TType2 _TArg2, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg2); \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _ArgList); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1, _TType2 _TArg2, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg2); \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _ArgList); \ - } \ - __pragma(warning(pop)); \ - \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1, _TType2 _TArg2, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg2); \ - return __insecure_##_VFuncName(_Dst, _TArg1, _TArg2, _ArgList); \ - } \ - __pragma(warning(pop)); \ - \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _FuncName(_SecureDstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg2); \ - _ReturnPolicy(_SecureVFuncName(_Dst, _Size, _TArg1, _TArg2, _ArgList), _Dst); \ - } \ - __pragma(warning(pop)); \ - \ - __pragma(warning(push)); \ - __pragma(warning(disable: 4793)); \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) \ - _ReturnType __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, _TType2 _TArg2, ...) \ - { \ - va_list _ArgList; \ - _crt_va_start(_ArgList, _TArg2); \ - _ReturnPolicy(_SecureVFuncName(_Dst, 1, _TArg1, _TArg2, _ArgList), _Dst); \ - } \ - __pragma(warning(pop)); \ - \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName(_T &_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _ArgList) \ - { \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _ArgList); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName(const _T &_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _ArgList) \ - { \ - return __insecure_##_VFuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _ArgList); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName(_DstType *&_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _ArgList) \ - { \ - return __insecure_##_VFuncName(_Dst, _TArg1, _TArg2, _ArgList); \ - } \ - template <size_t _Size> \ - inline \ - _ReturnType __CRTDECL _VFuncName(_SecureDstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, va_list _ArgList) \ - { \ - _ReturnPolicy(_SecureVFuncName(_Dst, _Size, _TArg1, _TArg2, _ArgList), _Dst); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) \ - _ReturnType __CRTDECL _VFuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, _TType2 _TArg2, va_list _ArgList) \ - { \ - _ReturnPolicy(_SecureVFuncName(_Dst, 1, _TArg1, _TArg2, _ArgList), _Dst); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __inline \ - size_t __CRTDECL __insecure_##_FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - _DeclSpec size_t __cdecl _FuncName(_DstType *, _TType1, _TType2); \ - return _FuncName(_Dst, _TArg1, _TArg2); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1, _TType2 _TArg2) \ - { \ - return __insecure_##_FuncName(_Dst, _TArg1, _TArg2); \ - } \ - template <size_t _Size> \ - inline \ - size_t __CRTDECL _FuncName(_SecureDstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2) \ - { \ - size_t _Ret = 0; \ - _SecureFuncName(&_Ret, _Dst, _Size, _TArg1, _TArg2); \ - return (_Ret > 0 ? (_Ret - 1) : _Ret); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, _TType2 _TArg2) \ - { \ - size_t _Ret = 0; \ - _SecureFuncName(&_Ret, _Dst, 1, _TArg1, _TArg2); \ - return (_Ret > 0 ? (_Ret - 1) : _Ret); \ - } \ - } - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __inline \ - size_t __CRTDECL __insecure_##_FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - _DeclSpec size_t __cdecl _FuncName(_DstType *, _TType1, _TType2, _TType3); \ - return _FuncName(_Dst, _TArg1, _TArg2, _TArg3); \ - } \ - extern "C++" \ - { \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName(_T &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _TArg3); \ - } \ - template <typename _T> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName(const _T &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return __insecure_##_FuncName(static_cast<_DstType *>(_Dst), _TArg1, _TArg2, _TArg3); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName(_DstType * &_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - return __insecure_##_FuncName(_Dst, _TArg1, _TArg2, _TArg3); \ - } \ - template <size_t _Size> \ - inline \ - size_t __CRTDECL _FuncName(_SecureDstType (&_Dst)[_Size], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - size_t _Ret = 0; \ - _SecureFuncName(&_Ret, _Dst, _Size, _TArg1, _TArg2, _TArg3); \ - return (_Ret > 0 ? (_Ret - 1) : _Ret); \ - } \ - template <> \ - inline \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) \ - size_t __CRTDECL _FuncName<1>(_DstType (&_Dst)[1], _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3) \ - { \ - size_t _Ret = 0; \ - _SecureFuncName(&_Ret, _Dst, 1, _TArg1, _TArg2, _TArg3); \ - return (_Ret > 0 ? (_Ret - 1) : _Ret); \ - } \ - } - -#if !defined (RC_INVOKED) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0_CGETS(_ReturnType, _DeclSpec, _FuncName, _DstType, _Dst) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_CGETS(_ReturnType, _DeclSpec, _FuncName, _DstType, _Dst) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _VFuncName, _SecureVFuncName, _DstType, _Dst, _TType1, _TArg1) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _VFuncName, _SecureVFuncName, _DstType, _Dst, _TType1, _TArg1) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_ARGLIST(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_ARGLIST(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _VFuncName##_s, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) - -#else /* !defined (RC_INVOKED) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT */ - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0_GETS(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_HType1 _HArg1, _DstType *_Dst, _TType1 _TArg1); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_HType1 _HArg1, _HType2 _HArg2, _DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName,_VFuncName, _SecureVFuncName, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, ...); \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_ARGLIST(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, ...); \ - _CRT_INSECURE_DEPRECATE(_VFuncName##_s) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, ...); \ - _CRT_INSECURE_DEPRECATE(_VFuncName##_s) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3); - -#endif /* !defined (RC_INVOKED) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT */ - -#else /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES */ - -#define __RETURN_POLICY_SAME(_FunctionCall) -#define __RETURN_POLICY_DST(_FunctionCall) -#define __RETURN_POLICY_VOID(_FunctionCall) -#define __EMPTY_DECLSPEC - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_CGETS(_ReturnType, _DeclSpec, _FuncName, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_HType1 _HArg1, _DstType *_Dst, _TType1 _TArg1); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_HType1 _HArg1, _HType2 _HArg2, _DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _VFuncName, _SecureVFuncName, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, ...); \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _SecureVFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, ...); \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_0_GETS(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_4_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3, _TType4, _TArg4) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3, _TType4 _TArg4); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_1_1_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_HType1 _HArg1, _DstType *_Dst, _TType1 _TArg1); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_2_0_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _HType1, _HArg1, _HType2, _HArg2, _DstType, _Dst) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_HType1 _HArg1, _HType2 _HArg2, _DstType *_Dst); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_1_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _SecureFuncName, _VFuncName, _SecureVFuncName, _DstType, _Dst, _TType1, _TArg1) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, ...); \ - _CRT_INSECURE_DEPRECATE(_SecureVFuncName) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_ARGLIST(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, ...); \ - _CRT_INSECURE_DEPRECATE(_VFuncName##_s) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_ARGLIST_EX(_ReturnType, _ReturnPolicy, _DeclSpec, _FuncName, _VFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_FuncName##_s) _DeclSpec _ReturnType __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, ...); \ - _CRT_INSECURE_DEPRECATE(_VFuncName##_s) _DeclSpec _ReturnType __cdecl _VFuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, va_list _Args); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2); - -#define __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_3_SIZE_EX(_DeclSpec, _FuncName, _SecureFuncName, _SecureDstType, _DstType, _Dst, _TType1, _TArg1, _TType2, _TArg2, _TType3, _TArg3) \ - _CRT_INSECURE_DEPRECATE(_SecureFuncName) _DeclSpec size_t __cdecl _FuncName(_DstType *_Dst, _TType1 _TArg1, _TType2 _TArg2, _TType3 _TArg3); - -#endif /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES */ -#endif /* !defined (RC_INVOKED) */ - -struct threadlocaleinfostruct; -struct threadmbcinfostruct; -typedef struct threadlocaleinfostruct * pthreadlocinfo; -typedef struct threadmbcinfostruct * pthreadmbcinfo; -struct __lc_time_data; - -typedef struct localeinfo_struct -{ - pthreadlocinfo locinfo; - pthreadmbcinfo mbcinfo; -} _locale_tstruct, *_locale_t; - -#ifndef _TAGLC_ID_DEFINED -typedef struct tagLC_ID { - unsigned short wLanguage; - unsigned short wCountry; - unsigned short wCodePage; -} LC_ID, *LPLC_ID; -#define _TAGLC_ID_DEFINED -#endif /* _TAGLC_ID_DEFINED */ - -#ifndef _THREADLOCALEINFO -typedef struct threadlocaleinfostruct { - int refcount; - unsigned int lc_codepage; - unsigned int lc_collate_cp; - unsigned long lc_handle[6]; /* LCID */ - LC_ID lc_id[6]; - struct { - char *locale; - wchar_t *wlocale; - int *refcount; - int *wrefcount; - } lc_category[6]; - int lc_clike; - int mb_cur_max; - int * lconv_intl_refcount; - int * lconv_num_refcount; - int * lconv_mon_refcount; - struct lconv * lconv; - int * ctype1_refcount; - unsigned short * ctype1; - const unsigned short * pctype; - const unsigned char * pclmap; - const unsigned char * pcumap; - struct __lc_time_data * lc_time_curr; -} threadlocinfo; -#define _THREADLOCALEINFO -#endif /* _THREADLOCALEINFO */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#if defined (_PREFAST_) && defined (_PFT_SHOULD_CHECK_RETURN) -#define __checkReturn_opt __checkReturn -#else /* defined (_PREFAST_) && defined (_PFT_SHOULD_CHECK_RETURN) */ -#define __checkReturn_opt -#endif /* defined (_PREFAST_) && defined (_PFT_SHOULD_CHECK_RETURN) */ - -#if defined (_PREFAST_) && defined (_PFT_SHOULD_CHECK_RETURN_WAT) -#define __checkReturn_wat __checkReturn -#else /* defined (_PREFAST_) && defined (_PFT_SHOULD_CHECK_RETURN_WAT) */ -#define __checkReturn_wat -#endif /* defined (_PREFAST_) && defined (_PFT_SHOULD_CHECK_RETURN_WAT) */ - -#if !defined (__midl) && !defined (MIDL_PASS) && defined (_PREFAST_) -#define __crt_typefix(ctype) __declspec("SAL_typefix(" __CRT_STRINGIZE(ctype) ")") -#else /* !defined (__midl) && !defined (MIDL_PASS) && defined (_PREFAST_) */ -#define __crt_typefix(ctype) -#endif /* !defined (__midl) && !defined (MIDL_PASS) && defined (_PREFAST_) */ - -#if (defined (__midl)) -/* suppress tchar inlines */ -#ifndef _NO_INLINING -#define _NO_INLINING -#endif /* _NO_INLINING */ -#endif /* (defined (__midl)) */ - -#ifndef _CRT_UNUSED -#define _CRT_UNUSED(x) (void)x -#endif /* _CRT_UNUSED */ - -#ifdef _MSC_VER -#pragma pack(pop) -#endif /* _MSC_VER */ - -#endif /* _INC_CRTDEFS */ diff --git a/src/pal/src/safecrt/input.inl b/src/pal/src/safecrt/input.inl index efb2e8f315..0e01f6b945 100644 --- a/src/pal/src/safecrt/input.inl +++ b/src/pal/src/safecrt/input.inl @@ -80,14 +80,10 @@ #define _istspace(x) isspace(x) #endif -#ifdef _SAFECRT_IMPL - #define _malloc_crt PAL_malloc #define _realloc_crt PAL_realloc #define _free_crt PAL_free -#endif /* _SAFECRT_IMPL */ - #define _FASSIGN(flag, argument, number, dec_point, locale) _safecrt_fassign((flag), (argument), (number)) #define _WFASSIGN(flag, argument, number, dec_point, locale) _safecrt_wfassign((flag), (argument), (number)) @@ -243,14 +239,7 @@ static int __check_float_string(size_t nFloatStrUsed, * *******************************************************************************/ -#ifdef _SAFECRT_IMPL #define _INTRN_LOCALE_CONV( x ) localeconv() -#else /* _SAFECRT_IMPL */ - inline const lconv* _INTRN_LOCALE_CONV( _LocaleUpdate& l ) - { - return l.GetLocaleT()->locinfo->lconv; - } -#endif /* _SAFECRT_IMPL */ #ifndef _UNICODE int __cdecl __tinput_s (miniFILE* stream, const _TUCHAR* format, va_list arglist) @@ -330,10 +319,6 @@ static int __check_float_string(size_t nFloatStrUsed, _VALIDATE_RETURN( (stream != NULL), EINVAL, EOF); #endif /* CPRFLAG */ -#ifndef _SAFECRT_IMPL - _LocaleUpdate _loc_update(plocinfo); -#endif /* _SAFECRT_IMPL */ - /* count = # fields assigned charcount = # chars read @@ -700,14 +685,7 @@ scanit: temp[1] = (char) INC(); } #endif /* 0 */ -#ifdef _SAFECRT_IMPL _MBTOWC(&wctemp, temp, MB_CUR_MAX); -#else /* _SAFECRT_IMPL */ - _mbtowc_l(&wctemp, - temp, - _loc_update.GetLocaleT()->locinfo->mb_cur_max, - _loc_update.GetLocaleT()); -#endif /* _SAFECRT_IMPL */ *(wchar_t UNALIGNED *)pointer = wctemp; /* just copy L'?' if mbtowc fails, errno is set by mbtowc */ pointer = (wchar_t *)pointer + 1; @@ -742,7 +720,6 @@ scanit: } #else /* _SECURE_SCANF */ /* convert wide to multibyte */ -#ifdef _SAFECRT_IMPL if (array_width >= ((size_t)MB_CUR_MAX)) { _BEGIN_SECURE_CRT_DEPRECATION_DISABLE @@ -763,13 +740,6 @@ _END_SECURE_CRT_DEPRECATION_DISABLE } memcpy(pointer, tmpbuf, temp); } -#else /* _SAFECRT_IMPL */ - if(wctomb_s(&temp,(char *)pointer, array_width, ch) == ERANGE) { - /* We have exhausted the user's buffer */ - enomem = 1; - break; - } -#endif /* _SAFECRT_IMPL */ if (temp > 0) { /* do nothing if wctomb fails, errno will be set to EILSEQ */ @@ -1081,14 +1051,7 @@ f_incwidth: /* convert decimal point to wide-char */ /* if mbtowc fails (should never happen), we use L'.' */ decimal = L'.'; -#ifdef _SAFECRT_IMPL _MBTOWC(&decimal, _INTRN_LOCALE_CONV(_loc_update)->decimal_point, MB_CUR_MAX); -#else /* _SAFECRT_IMPL */ - _mbtowc_l(&decimal, - _INTRN_LOCALE_CONV(_loc_update)->decimal_point, - _loc_update.GetLocaleT()->locinfo->mb_cur_max, - _loc_update.GetLocaleT()); -#endif /* _SAFECRT_IMPL */ #else /* _UNICODE */ decimal=*((_INTRN_LOCALE_CONV(_loc_update))->decimal_point); diff --git a/src/pal/src/safecrt/output.inl b/src/pal/src/safecrt/output.inl index 3f9508e66e..1a333187ec 100644 --- a/src/pal/src/safecrt/output.inl +++ b/src/pal/src/safecrt/output.inl @@ -28,7 +28,6 @@ //typedef __int64_t __int64; -#define _SAFECRT_IMPL #define FORMAT_VALIDATIONS typedef double _CRT_DOUBLE; @@ -41,18 +40,10 @@ Buffer size required to be passed to _gcvt, fcvt and other fp conversion routine #define _CVTBUFSIZE (309+40) /* # of digits in max. dp value + slop */ /* temporary work-around for compiler without 64-bit support */ -#ifndef _SAFECRT_IMPL -extern "C" -{ -#endif /* _SAFECRT_IMPL */ #ifndef _INTEGRAL_MAX_BITS #define _INTEGRAL_MAX_BITS 64 #endif /* _INTEGRAL_MAX_BITS */ -#ifdef POSITIONAL_PARAMETERS -#define FORMAT_VALIDATIONS -#endif /* POSITIONAL_PARAMETERS */ - //#include <mtdll.h> //#include <cruntime.h> //#include <limits.h> @@ -76,8 +67,6 @@ extern "C" #define _WCTOMB_S wctomb_s #endif /* _WCTOMB_S */ -#ifdef _SAFECRT_IMPL - #undef _malloc_crt #define _malloc_crt malloc @@ -165,7 +154,6 @@ int __cdecl _swoutput_s(wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_ return -2; } -#endif /* _SAFECRT_IMPL */ #ifndef _CFLTCVT #define _CFLTCVT _cfltcvt @@ -270,10 +258,6 @@ int __cdecl _swoutput_s(wchar_t *_Dst, size_t _Size, const wchar_t *_Format, va_ #define FL_WIDECHAR 0x00800 /* wide characters */ #define FL_LONGLONG 0x01000 /* long long value given */ #define FL_I64 0x08000 /* __int64 value given */ -#ifdef POSITIONAL_PARAMETERS -/* We set this flag if %I is passed without I32 or I64 */ -#define FL_PTRSIZE 0x10000 /* platform dependent number */ -#endif /* POSITIONAL_PARAMETERS */ /* state definitions */ enum STATE { @@ -366,11 +350,7 @@ extern const char __lookuptable[] = { /* '>' */ 0x00, /* '?' */ 0x00, /* '@' */ 0x00, -#if defined (_SAFECRT_IMPL) /* 'A' */ 0x20, // Disable %A format -#else /* defined (_SAFECRT_IMPL) */ - /* 'A' */ 0x28, -#endif /* defined (_SAFECRT_IMPL) */ /* 'B' */ 0x20, /* 'C' */ 0x38, /* 'D' */ 0x50, @@ -402,11 +382,7 @@ extern const char __lookuptable[] = { /* '^' */ 0x60, /* '_' */ 0x00, /* '`' */ 0x00, -#if defined (_SAFECRT_IMPL) /* 'a' */ 0x70, // Disable %a format -#else /* defined (_SAFECRT_IMPL) */ - /* 'a' */ 0x78, -#endif /* defined (_SAFECRT_IMPL) */ /* 'b' */ 0x70, /* 'c' */ 0x78, /* 'd' */ 0x78, @@ -419,11 +395,7 @@ extern const char __lookuptable[] = { /* 'k' */ 0x00, /* 'l' */ 0x07, /* 'm' */ 0x00, -#if defined (_SAFECRT_IMPL) /* 'n' */ 0x00, // Disable %n format -#else /* defined (_SAFECRT_IMPL) */ - /* 'n' */ 0x08, -#endif /* defined (_SAFECRT_IMPL) */ /* 'o' */ 0x08, /* 'p' */ 0x08, /* 'q' */ 0x00, @@ -440,9 +412,9 @@ extern const char __lookuptable[] = { #else /* FORMAT_VALIDATIONS */ -//#if defined (_UNICODE) || defined (CPRFLAG) || defined (POSITIONAL_PARAMETERS) +//#if defined (_UNICODE) || defined (CPRFLAG) //extern const unsigned char __lookuptable_s[]; -//#else /* defined (_UNICODE) || defined (CPRFLAG) || defined (POSITIONAL_PARAMETERS) */ +//#else /* defined (_UNICODE) || defined (CPRFLAG) */ static const unsigned char __lookuptable_s[] = { /* ' ' */ 0x06, /* '!' */ 0x80, @@ -477,11 +449,7 @@ static const unsigned char __lookuptable_s[] = { /* '>' */ 0x80, /* '?' */ 0x50, /* '@' */ 0x80, -#if defined (_SAFECRT_IMPL) /* 'A' */ 0x80, // Disable %A format -#else /* defined (_SAFECRT_IMPL) */ - /* 'A' */ 0x88, -#endif /* defined (_SAFECRT_IMPL) */ /* 'B' */ 0x00, /* 'C' */ 0x08, /* 'D' */ 0x00, @@ -513,11 +481,7 @@ static const unsigned char __lookuptable_s[] = { /* '^' */ 0x00, /* '_' */ 0x00, /* '`' */ 0x60, -#if defined (_SAFECRT_IMPL) /* 'a' */ 0x60, // Disable %a format -#else /* defined (_SAFECRT_IMPL) */ - /* 'a' */ 0x68, -#endif /* defined (_SAFECRT_IMPL) */ /* 'b' */ 0x60, /* 'c' */ 0x68, /* 'd' */ 0x68, @@ -542,150 +506,10 @@ static const unsigned char __lookuptable_s[] = { /* 'w' */ 0x07, /* 'x' */ 0x08 }; -//#endif /* defined (_UNICODE) || defined (CPRFLAG) || defined (POSITIONAL_PARAMETERS) */ +//#endif /* defined (_UNICODE) || defined (CPRFLAG) */ #endif /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS - -#define POSITION_CHAR _T('$') - -#define FORMAT_POSSCAN_PASS 0 -#define FORMAT_OUTPUT_PASS 1 - -#define FMT_TYPE_NOTSET -1 -#define FMT_TYPE_NONPOSITIONAL 0 -#define FMT_TYPE_POSITIONAL 1 - -enum ARG_TYPE{ -eblank, -e_int_arg, -#ifndef _UNICODE -e_short_arg, -#endif /* _UNICODE */ -e_ptr_arg, -e_int64_arg, -e_long_long_arg, -e_long_arg, -e_double_arg -}; - -struct positional_param -{ - enum ARG_TYPE arg_type; - va_list arg_ptr; - TCHAR type; - int flags; -}; - - - -#ifndef _UNICODE -#define _IS_FMTTYPE_WIDE(fl) ((fl & (FL_LONG|FL_WIDECHAR)) != 0) -#else /* _UNICODE */ -#define _IS_FMTTYPE_WIDE(fl) ((fl & FL_SHORT) == 0) -#endif /* _UNICODE */ - -#define _IS_FMTTYPE_PTRSIZE(fl) ((fl & FL_PTRSIZE) != 0) -#define _IS_FMTTYPE_SHORT(fl) ((fl & FL_SHORT) != 0) - -#define _IS_FMTTYPE_POINTER(type) (type == _T('p')) -#define _IS_FMTTYPE_STRING(type) ( (type == _T('s')) || (type == _T('S')) ) -#define _IS_FMTTYPE_NUMERIC(type) ( (type == _T('d')) || (type == _T('i')) || (type == _T('o')) || \ - (type == _T('u')) || (type == _T('x')) || (type == _T('X')) ) - -#ifdef _UNICODE -#define _tvalidate_param_reuse _validate_param_reuseW -#else /* _UNICODE */ -#define _tvalidate_param_reuse _validate_param_reuseA -#endif /* _UNICODE */ - - -/*** -*int _tvalidate_param_reuse(struct positional_param * pos, enum ARG_TYPE get_fn_type, TCHAR cur_type, int cur_flags) -* -*Purpose: -* Validates if the reused positional parameter is doesn't breaking any rules. -* a) %p - shouldn't be mixed with other format types. -* b) Wide & Ansi strings shouldn't be mixed -* c) Numeric types shouldn't mix if their sizes are different -* d) %I (without I32 or I64) shouldn't mix with other numeric types -* -*Entry: -* struct positional_param * pos -* enum ARG_TYPE get_fn_type -* TCHAR cur_type -* int cur_flags -* -*Exit: -* Returns 0 if any non-allowed reuse is happening otherwise 1 -* -*******************************************************************************/ - -#ifndef CPRFLAG -int _tvalidate_param_reuse(struct positional_param * pos, enum ARG_TYPE get_fn_type, TCHAR cur_type, int cur_flags) -{ - int stored_value = 0 ; - int new_value = 0 ; - - if(_IS_FMTTYPE_POINTER(pos->type) || _IS_FMTTYPE_POINTER(cur_type)) - { - /* %p param shouldn't be mixed with other types. If both are %p, - then we don't need to do any more validations */ - return (pos->type == cur_type) ; - } - - stored_value = _IS_FMTTYPE_STRING(pos->type); - new_value = _IS_FMTTYPE_STRING(cur_type); - - if(stored_value || new_value) - { - /* If one type is a string, then the other also should be a string. Also - Wide & Ansi String parameters shouldn't be interchangebly used. - If these conditions are met, we don't need to do any more validations. - */ - return ( (stored_value == new_value) && (_IS_FMTTYPE_WIDE(pos->flags) == _IS_FMTTYPE_WIDE(cur_flags)) ); - } - - if( _IS_FMTTYPE_NUMERIC(pos->type) || _IS_FMTTYPE_NUMERIC(cur_type)) - { - /* If one type is numeric, then the other should also be numeric. */ - if (_IS_FMTTYPE_NUMERIC(pos->type) != _IS_FMTTYPE_NUMERIC(cur_type)) - return 0; - - /* For Numeric Types, we should allow mixing only if the size is the - same. Also, we shouldn't allow %I (without 32/64) which is platform - dependent to mix with other fixed numeric types */ - if( (_IS_FMTTYPE_PTRSIZE(pos->flags) != _IS_FMTTYPE_PTRSIZE(cur_flags)) || - (_IS_FMTTYPE_SHORT(pos->flags) != _IS_FMTTYPE_SHORT(cur_flags)) ) - { - return 0; - } - } - - return (pos->arg_type == get_fn_type); -} -#else /* CPRFLAG */ -int _tvalidate_param_reuse(struct positional_param * pos, enum ARG_TYPE get_fn_type, TCHAR cur_type, int cur_flags); -#endif /* CPRFLAG */ - -#define STORE_ARGPTR(pos_struct, get_fn_type, pos, cur_type, cur_flags) \ - if(pos_struct[pos].arg_type == eblank) \ - { \ - pos_struct[pos].arg_type = get_fn_type; \ - pos_struct[pos].type = cur_type; \ - pos_struct[pos].flags = cur_flags; \ - } \ - else \ - { \ - _VALIDATE_RETURN(_tvalidate_param_reuse(&pos_struct[pos], get_fn_type, cur_type, cur_flags), EINVAL, -1); \ - } - - -#define GET_ARG(get_fn_type, arg_ptr, lhs, type) { va_list lst = arg_ptr ;lhs = type get_fn_type(&lst);} - -#endif /* POSITIONAL_PARAMETERS */ - #define FIND_CHAR_CLASS(lookuptbl, c) \ ((c) < _T(' ') || (c) > _T('x') ? \ CH_OTHER \ @@ -748,10 +572,6 @@ __inline long long __cdecl get_long_long_arg(va_list *pargptr); __inline __int64 __cdecl get_int64_arg(va_list *pargptr); #endif /* _INTEGRAL_MAX_BITS >= 64 */ -#ifdef POSITIONAL_PARAMETERS -__inline _CRT_DOUBLE __cdecl get_crtdouble_arg(va_list *pargptr); -#endif /* POSITIONAL_PARAMETERS */ - #endif // __GNUC_VA_LIST #ifdef CPRFLAG @@ -784,19 +604,11 @@ _CRTIMP int __cdecl _tcprintf_l ( ... ) #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _tcprintf_p_l ( - const _TCHAR * format, - _locale_t plocinfo, - ... - ) -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _tcprintf_s_l ( const _TCHAR * format, _locale_t plocinfo, ... ) -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ { @@ -807,11 +619,7 @@ _CRTIMP int __cdecl _tcprintf_s_l ( #ifndef FORMAT_VALIDATIONS ret = _vtcprintf_l(format, plocinfo, arglist); #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS - ret = _vtcprintf_p_l(format, plocinfo, arglist); -#else /* POSITIONAL_PARAMETERS */ ret = _vtcprintf_s_l(format, plocinfo, arglist); -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ @@ -826,17 +634,10 @@ _CRTIMP int __cdecl _tcprintf ( ... ) #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _tcprintf_p ( - const _TCHAR * format, - ... - ) -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _tcprintf_s ( const _TCHAR * format, ... ) -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ { @@ -848,11 +649,7 @@ _CRTIMP int __cdecl _tcprintf_s ( #ifndef FORMAT_VALIDATIONS ret = _vtcprintf_l(format, NULL, arglist); #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS - ret = _vtcprintf_p_l(format, NULL, arglist); -#else /* POSITIONAL_PARAMETERS */ ret = _vtcprintf_s_l(format, NULL, arglist); -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ @@ -906,16 +703,6 @@ _CRTIMP int __cdecl _vtcprintf ( } #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _vtcprintf_p ( - const _TCHAR *format, - va_list argptr - ) -{ - return _vtcprintf_p_l(format, NULL, argptr); -} - -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _vtcprintf_s ( const _TCHAR *format, va_list argptr @@ -924,7 +711,6 @@ _CRTIMP int __cdecl _vtcprintf_s ( return _vtcprintf_s_l(format, NULL, argptr); } -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #endif /* CPRFLAG */ @@ -932,72 +718,31 @@ _CRTIMP int __cdecl _vtcprintf_s ( #ifndef FORMAT_VALIDATIONS _CRTIMP int __cdecl _vtcprintf_l ( #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _vtcprintf_p_l ( -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _vtcprintf_s_l ( -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #else /* CPRFLAG */ #ifdef _UNICODE #ifndef FORMAT_VALIDATIONS -#ifdef _SAFECRT_IMPL int __cdecl _woutput ( -#else /* _SAFECRT_IMPL */ -int __cdecl _woutput_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -#ifdef _SAFECRT_IMPL -int __cdecl _woutput_p ( -#else /* _SAFECRT_IMPL */ -int __cdecl _woutput_p_l ( -#endif /* _SAFECRT_IMPL */ - miniFILE *stream, -#else /* POSITIONAL_PARAMETERS */ -#ifdef _SAFECRT_IMPL int __cdecl _woutput_s ( -#else /* _SAFECRT_IMPL */ -int __cdecl _woutput_s_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #else /* _UNICODE */ #ifndef FORMAT_VALIDATIONS -#ifdef _SAFECRT_IMPL int __cdecl _output ( -#else /* _SAFECRT_IMPL */ -int __cdecl _output_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -#ifdef _SAFECRT_IMPL - int __cdecl _output_p ( -#else /* _SAFECRT_IMPL */ - int __cdecl _output_p_l ( -#endif /* _SAFECRT_IMPL */ - miniFILE *stream, -#else /* POSITIONAL_PARAMETERS */ -#ifdef _SAFECRT_IMPL int __cdecl _output_s ( -#else /* _SAFECRT_IMPL */ - int __cdecl _output_s_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #endif /* _UNICODE */ #endif /* CPRFLAG */ const _TCHAR *format, -#ifndef _SAFECRT_IMPL - _locale_t plocinfo, -#endif /* _SAFECRT_IMPL */ va_list argptr ) { @@ -1031,65 +776,15 @@ int __cdecl _output_l ( int buffersize; /* size of text.sz (used only for the call to _cfltcvt) */ int bufferiswide=0; /* non-zero = buffer contains wide chars already */ -#ifndef _SAFECRT_IMPL - _LocaleUpdate _loc_update(plocinfo); -#endif /* _SAFECRT_IMPL */ - -#ifdef POSITIONAL_PARAMETERS - /* Used for parsing the format */ - const _TCHAR * saved_format = NULL; - _TCHAR * end_pos = NULL; - - /* This is the structure which stores the values corresponding to - each positional param */ - struct positional_param pos_value[_ARGMAX]; - - int pass = 0; /* Ctr for scanning the format string in diff passes */ - int noofpasses = 0; /* Set to 2 for positional formats, otherwise 1 */ - int max_pos = -1; /* Keeping track of the current max positional arg */ - int type_pos = -1; /* position of an arg denoting a type */ - int width_pos = -1; /* position of an arg denoting width */ - int precis_pos = -1; /* position of an arg denoting precision */ - int format_type = FMT_TYPE_NOTSET; /* type of format string */ -#endif /* POSITIONAL_PARAMETERS */ - #ifndef CPRFLAG _VALIDATE_RETURN( (stream != NULL), EINVAL, -1); #endif /* CPRFLAG */ _VALIDATE_RETURN( (format != NULL), EINVAL, -1); charsout = 0; /* no characters written yet */ -#ifdef POSITIONAL_PARAMETERS - - saved_format = format; - - for(pass = 0 ; pass < 2; ++pass) - { - - if((pass == FORMAT_OUTPUT_PASS) && (format_type == FMT_TYPE_NONPOSITIONAL)) - { - /* If in pass2, we still have format_type isn't positional, it means - that we do not need a 2nd pass */ - break; - } -#endif /* POSITIONAL_PARAMETERS */ textlen = 0; /* no text yet */ state = ST_NORMAL; /* starting state */ buffersize = 0; -#ifdef POSITIONAL_PARAMETERS - max_pos = -1; - fldwidth = 0; - precision = 0; - format = saved_format; - type_pos = -1; - width_pos = -1; - precis_pos = -1; - - /* All chars before the first format specifier get output in the first - pass itself. Hence we have to reset format_type to FMT_TYPE_NOTSET to ensure - that they do not get output again in the 2nd pass */ - format_type = FMT_TYPE_NOTSET; -#endif /* POSITIONAL_PARAMETERS */ /* main loop -- loop while format character exist and no I/O errors */ while ((ch = *format++) != _T('\0') && charsout >= 0) { @@ -1100,50 +795,7 @@ int __cdecl _output_l ( chclass = FIND_CHAR_CLASS(__lookuptable_s, ch); /* find character class */ state = FIND_NEXT_STATE(__lookuptable_s, chclass, state); /* find next state */ -#ifdef POSITIONAL_PARAMETERS - if((state == ST_PERCENT) && (*format != _T('%'))) - { - if(format_type == FMT_TYPE_NOTSET) - { - /* We set the value of format_type when we hit the first type specifier */ - if(_tcstol(format, &end_pos, 10) > 0 && (*end_pos == POSITION_CHAR)) - { - if(pass == FORMAT_POSSCAN_PASS) - { - memset(pos_value,0,sizeof(pos_value)); - } - format_type = FMT_TYPE_POSITIONAL; - } - else - { - format_type = FMT_TYPE_NONPOSITIONAL; - } - } - - if(format_type == FMT_TYPE_POSITIONAL) - { - type_pos = _tcstol(format, &end_pos, 10) - 1; - format = end_pos + 1; - - if(pass == FORMAT_POSSCAN_PASS) - { - /* We don't redo the validations in the 2nd pass */ - _VALIDATE_RETURN(((type_pos >= 0) && (*end_pos == POSITION_CHAR) && (type_pos < _ARGMAX)), EINVAL, -1); - - /* Update max_pos with the current maximum pos argument */ - max_pos = type_pos > max_pos ? type_pos : max_pos; - } - } - - } - else - { - /* If state is ST_INVALID, that means an invalid format specifier */ - _VALIDATE_RETURN((state != ST_INVALID), EINVAL, -1); - } -#else /* POSITIONAL_PARAMETERS */ _VALIDATE_RETURN((state != ST_INVALID), EINVAL, -1); -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ @@ -1152,19 +804,6 @@ int __cdecl _output_l ( case ST_NORMAL: -#ifdef POSITIONAL_PARAMETERS - if(((pass == FORMAT_POSSCAN_PASS) && (format_type == FMT_TYPE_POSITIONAL)) - || ((pass == FORMAT_OUTPUT_PASS) && (format_type == FMT_TYPE_NOTSET))) - { - - /* Do not output in the 1st pass, if we have already come across - a positional format specifier. All chars before the first format - specifier get output in the first pass itself. Hence we need to - check the format_type to make sure that they don't get output - again in the 2nd pass */ - break; - } -#endif /* POSITIONAL_PARAMETERS */ NORMAL_STATE: /* normal state -- just write character */ @@ -1209,37 +848,7 @@ int __cdecl _output_l ( /* update width value */ if (ch == _T('*')) { /* get width from arg list */ -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ fldwidth = get_int_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - width_pos = _tcstol(format, &end_pos, 10) - 1; - format = end_pos + 1; - - if(pass == FORMAT_POSSCAN_PASS) - { - _VALIDATE_RETURN(((width_pos >= 0) && (*end_pos == POSITION_CHAR) && (type_pos < _ARGMAX)), EINVAL, -1); - - /* Update max_pos with the current maximum pos argument */ - max_pos = width_pos > max_pos ? width_pos : max_pos; - - STORE_ARGPTR(pos_value, e_int_arg, width_pos, ch, flags) - break; - - } - else - { - /* get width from arg list */ - GET_ARG(get_int_arg,pos_value[width_pos].arg_ptr, fldwidth, ) - } - - } -#endif /* POSITIONAL_PARAMETERS */ if (fldwidth < 0) { /* ANSI says neg fld width means '-' flag and pos width */ flags |= FL_LEFT; @@ -1262,35 +871,7 @@ int __cdecl _output_l ( /* update precison value */ if (ch == _T('*')) { /* get precision from arg list */ -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ precision = get_int_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - precis_pos = _tcstol(format, &end_pos, 10) - 1; - format = end_pos + 1; - - if(pass == FORMAT_POSSCAN_PASS) - { - _VALIDATE_RETURN(((precis_pos >= 0) && (*end_pos == POSITION_CHAR) && (type_pos < _ARGMAX)), EINVAL, -1); - - /* Update max_pos with the current maximum pos argument */ - max_pos = precis_pos > max_pos ? precis_pos : max_pos; - - STORE_ARGPTR(pos_value, e_int_arg, precis_pos, ch, flags) - break; - } - else - { - /* get width from arg list */ - GET_ARG(get_int_arg,pos_value[precis_pos].arg_ptr, precision, ) - } - } -#endif /* POSITIONAL_PARAMETERS */ if (precision < 0) precision = -1; /* neg precision means default */ } @@ -1346,17 +927,11 @@ int __cdecl _output_l ( (*format == _T('x')) || (*format == _T('X')) ) { -#ifdef POSITIONAL_PARAMETERS - /* %I without 32/64 is platform dependent. We set FL_PTRSIZE to indicate - this - this is used in the positional parameter reuse validation */ - flags |= FL_PTRSIZE; -#else /* POSITIONAL_PARAMETERS */ /* * Nothing further needed. %Id (et al) is * handled just like %d, except that it defaults to 64 bits * on WIN64. Fall through to the next iteration. */ -#endif /* POSITIONAL_PARAMETERS */ } else { state = ST_NORMAL; @@ -1400,28 +975,7 @@ int __cdecl _output_l ( /* print a single character specified by int argument */ #ifdef _UNICODE bufferiswide = 1; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ - wchar = (wchar_t) get_int_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, wchar, (wchar_t)) - } - } -#endif /* POSITIONAL_PARAMETERS */ + wchar = (wchar_t) get_int_arg(&argptr); if (flags & FL_SHORT) { /* format multibyte character */ /* this is an extension of ANSI */ @@ -1431,14 +985,7 @@ int __cdecl _output_l ( tempchar[1] = '\0'; } -#ifdef _SAFECRT_IMPL if (_MBTOWC(buffer.wz,tempchar, MB_CUR_MAX) < 0) -#else /* _SAFECRT_IMPL */ - if (_mbtowc_l(buffer.wz, - tempchar, - _loc_update.GetLocaleT()->locinfo->mb_cur_max, - _loc_update.GetLocaleT()) < 0) -#endif /* _SAFECRT_IMPL */ { /* ignore if conversion was unsuccessful */ no_output = 1; @@ -1450,56 +997,14 @@ int __cdecl _output_l ( textlen = 1; /* print just a single character */ #else /* _UNICODE */ if (flags & (FL_LONG|FL_WIDECHAR)) { -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ wchar = (wchar_t) get_int_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_short_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, wchar, (wchar_t)) - } - } -#endif /* POSITIONAL_PARAMETERS */ no_output = 1; } else { /* format multibyte character */ /* this is an extension of ANSI */ unsigned short temp; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ wchar = (wchar_t)get_int_arg(&argptr); temp = (unsigned short)wchar; -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, temp, (unsigned short)) - } - } -#endif /* POSITIONAL_PARAMETERS */ { buffer.sz[0] = (char) temp; textlen = 1; @@ -1518,28 +1023,7 @@ int __cdecl _output_l ( char *Buffer; } *pstr; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ pstr = (struct _count_string *)get_ptr_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_ptr_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_ptr_arg,pos_value[type_pos].arg_ptr, pstr, (struct _count_string *) ) - } - } -#endif /* POSITIONAL_PARAMETERS */ if (pstr == NULL || pstr->Buffer == NULL) { /* null ptr passed, use special string */ text.sz = __nullstring; @@ -1584,28 +1068,7 @@ int __cdecl _output_l ( /* at all. Thus, we must do our own scan. */ i = (precision == -1) ? INT_MAX : precision; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ text.sz = (char *)get_ptr_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_ptr_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_ptr_arg,pos_value[type_pos].arg_ptr, text.sz,(char *)) - } - } -#endif /* POSITIONAL_PARAMETERS */ /* scan for null upto i characters */ #ifdef _UNICODE @@ -1657,28 +1120,7 @@ int __cdecl _output_l ( void *p; /* temp */ -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ p = get_ptr_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_ptr_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_ptr_arg,pos_value[type_pos].arg_ptr,p,) - } - } -#endif /* POSITIONAL_PARAMETERS */ /* %n is disabled */ _VALIDATE_RETURN(("'n' format specifier disabled" && 0), EINVAL, -1); @@ -1715,15 +1157,6 @@ int __cdecl _output_l ( /* floating point conversion -- we call cfltcvt routines */ /* to do the work for us. */ flags |= FL_SIGNED; /* floating point is signed conversion */ -#ifdef POSITIONAL_PARAMETERS - if((format_type == FMT_TYPE_POSITIONAL) && (pass == FORMAT_POSSCAN_PASS)) - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - STORE_ARGPTR(pos_value, e_double_arg, type_pos, ch, flags) - - break; - } -#endif /* POSITIONAL_PARAMETERS */ text.sz = buffer.sz; /* put result in buffer */ buffersize = BUFFERSIZE; @@ -1740,58 +1173,17 @@ int __cdecl _output_l ( precision = BUFFERSIZE - _CVTBUFSIZE; } -#ifdef _SAFECRT_IMPL /* for safecrt, we pass along the FL_ALTERNATE flag to _safecrt_cfltcvt */ if (flags & FL_ALTERNATE) { capexp |= FL_ALTERNATE; } -#endif /* _SAFECRT_IMPL */ _CRT_DOUBLE tmp; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ tmp=va_arg(argptr, _CRT_DOUBLE); -#ifdef POSITIONAL_PARAMETERS - } - else - { - /* Will get here only for pass == FORMAT_OUTPUT_PASS because - pass == FORMAT_POSSCAN_PASS has a break Above */ - va_list tmp_arg; - - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - _ASSERTE(pass == FORMAT_OUTPUT_PASS); - tmp_arg = pos_value[type_pos].arg_ptr; - tmp=va_arg(tmp_arg, _CRT_DOUBLE); - } -#endif /* POSITIONAL_PARAMETERS */ /* Note: assumes ch is in ASCII range */ /* In safecrt, we provide a special version of _cfltcvt which internally calls printf (see safecrt_output_s.c) */ -#ifndef _SAFECRT_IMPL - _cfltcvt_l(&tmp.x, buffer.sz, buffersize, (char)ch, precision, capexp, _loc_update.GetLocaleT()); -#else /* _SAFECRT_IMPL */ _CFLTCVT(&tmp, buffer.sz, buffersize, (char)ch, precision, capexp); -#endif /* _SAFECRT_IMPL */ - -#ifndef _SAFECRT_IMPL - /* For safecrt, this is done already in _safecrt_cfltcvt */ - - /* '#' and precision == 0 means force a decimal point */ - if ((flags & FL_ALTERNATE) && precision == 0) - { - _forcdecpt_l(text.sz, _loc_update.GetLocaleT()); - } - - /* 'g' format means crop zero unless '#' given */ - if (ch == _T('g') && !(flags & FL_ALTERNATE)) - { - _cropzeros_l(text.sz, _loc_update.GetLocaleT()); - } -#endif /* _SAFECRT_IMPL */ /* check if result was negative, save '-' for later */ /* and point to positive part (this is for '0' padding) */ @@ -1877,197 +1269,35 @@ int __cdecl _output_l ( /* 1. read argument into l, sign extend as needed */ #if _INTEGRAL_MAX_BITS >= 64 if (flags & FL_I64) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_int64_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int64_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int64_arg,pos_value[type_pos].arg_ptr,l,) - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else #endif /* _INTEGRAL_MAX_BITS >= 64 */ if (flags & FL_LONGLONG) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_long_long_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_long_long_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_long_long_arg,pos_value[type_pos].arg_ptr,l,) - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else #if !LONG_IS_INT if (flags & FL_LONG) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_long_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_long_arg, type_pos, ch, flags) - break; - } - else - { - l = GETARG(get_long_arg,pos_value[type_pos].arg_ptr); - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else #endif /* !LONG_IS_INT */ #if !SHORT_IS_INT if (flags & FL_SHORT) { if (flags & FL_SIGNED) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = (short) get_int_arg(&argptr); /* sign extend */ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr,l, (short)) /* sign extend */ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = (unsigned short) get_int_arg(&argptr); /* zero-extend*/ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr,l, (unsigned short)) /* zero-extend*/ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ } else #endif /* !SHORT_IS_INT */ { if (flags & FL_SIGNED) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_int_arg(&argptr); /* sign extend */ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, l, ) /* sign extend */ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = (unsigned int) get_int_arg(&argptr); /* zero-extend*/ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, l, (unsigned int)) /* zero-extend*/ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ - } /* 2. check for negative; copy into number */ @@ -2134,13 +1364,6 @@ int __cdecl _output_l ( break; } -#ifdef POSITIONAL_PARAMETERS - if((format_type == FMT_TYPE_POSITIONAL) && (pass == FORMAT_POSSCAN_PASS)) - { - break; - } -#endif /* POSITIONAL_PARAMETERS */ - /* At this point, we have done the specific conversion, and */ /* 'text' points to text to print; 'textlen' is length. Now we */ @@ -2203,14 +1426,7 @@ int __cdecl _output_l ( p = text.sz; count = textlen; while (count-- > 0) { -#ifdef _SAFECRT_IMPL retval = _MBTOWC(&wchar, p, MB_CUR_MAX); -#else /* _SAFECRT_IMPL */ - retval = _mbtowc_l(&wchar, - p, - _loc_update.GetLocaleT()->locinfo->mb_cur_max, - _loc_update.GetLocaleT()); -#endif /* _SAFECRT_IMPL */ if (retval <= 0) { charsout = -1; break; @@ -2245,62 +1461,6 @@ int __cdecl _output_l ( _VALIDATE_RETURN(((state == ST_NORMAL) || (state == ST_TYPE)), EINVAL, -1); #endif /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS - if((format_type == FMT_TYPE_POSITIONAL) && (pass == FORMAT_POSSCAN_PASS)) - { - /* At the end of the 1st pass, we have the types filled into the - arg_type member of the struct. We now need to get argument pointer on - the stack & store it into the arg_ptr member */ - for(type_pos = 0; type_pos <= max_pos; ++type_pos) - { - switch(pos_value[type_pos].arg_type) - { - case e_int_arg : - pos_value[type_pos].arg_ptr = argptr; - get_int_arg(&argptr); - break; -#ifndef _UNICODE - case e_short_arg: - pos_value[type_pos].arg_ptr = argptr; - get_int_arg(&argptr); - break; -#endif /* _UNICODE */ - case e_ptr_arg: - pos_value[type_pos].arg_ptr = argptr; - get_ptr_arg(&argptr); - break; - - case e_int64_arg: - pos_value[type_pos].arg_ptr = argptr; - get_int64_arg(&argptr); - break; - - case e_long_long_arg: - pos_value[type_pos].arg_ptr = argptr; - get_long_long_arg(&argptr); - break; - - case e_long_arg: - pos_value[type_pos].arg_ptr = argptr; - get_long_arg(&argptr); - break; - - case e_double_arg : - pos_value[type_pos].arg_ptr = argptr; - get_crtdouble_arg(&argptr); - break; - default: - /* Should never get here */ - _VALIDATE_RETURN(("Missing position in the format string", 0), EINVAL, -1); - break; - } - } - } - - - } -#endif /* POSITIONAL_PARAMETERS */ - return charsout; /* return value = number of characters written */ } @@ -2576,17 +1736,7 @@ __inline __int64 __cdecl get_int64_arg ( #ifndef _UNICODE -#ifdef POSITIONAL_PARAMETERS -__inline _CRT_DOUBLE __cdecl get_crtdouble_arg(va_list *pargptr) -{ - return va_arg(*pargptr, _CRT_DOUBLE); -} -#endif /* POSITIONAL_PARAMETERS */ #endif /* _UNICODE */ #endif // __GNUC_VA_LIST -#ifndef _SAFECRT_IMPL -} -#endif /* _SAFECRT_IMPL */ - diff --git a/src/pal/src/safecrt/safecrt_output_l.c b/src/pal/src/safecrt/safecrt_output_l.c index 8cd7cd8575..36b98c2975 100644 --- a/src/pal/src/safecrt/safecrt_output_l.c +++ b/src/pal/src/safecrt/safecrt_output_l.c @@ -62,19 +62,10 @@ Buffer size required to be passed to _gcvt, fcvt and other fp conversion routine /* temporary work-around for compiler without 64-bit support */ -#ifndef _SAFECRT_IMPL -extern "C" -{ -#endif /* _SAFECRT_IMPL */ #ifndef _INTEGRAL_MAX_BITS #define _INTEGRAL_MAX_BITS 64 #endif /* _INTEGRAL_MAX_BITS */ -#ifdef POSITIONAL_PARAMETERS -#error DO NOT use POSITIONAL_PARAMETERS without validating code! -steshaw 7/3/07 -#define FORMAT_VALIDATIONS -#endif /* POSITIONAL_PARAMETERS */ - #include <limits.h> #include <string.h> #include <stddef.h> @@ -85,8 +76,6 @@ extern "C" #define _MBTOWC(x,y,z) _minimal_chartowchar( x, y ) -#ifdef _SAFECRT_IMPL - #undef _malloc_crt #define _malloc_crt malloc @@ -94,7 +83,6 @@ extern "C" #define _free_crt free // SNIP -srs 7/3/07 -#endif /* _SAFECRT_IMPL */ #ifndef _CFLTCVT #define _CFLTCVT _cfltcvt @@ -216,10 +204,6 @@ extern "C" #define FL_WIDECHAR 0x00800 /* wide characters */ #define FL_LONGLONG 0x01000 /* long long value given */ #define FL_I64 0x08000 /* __int64 value given */ -#ifdef POSITIONAL_PARAMETERS -/* We set this flag if %I is passed without I32 or I64 */ -#define FL_PTRSIZE 0x10000 /* platform dependent number */ -#endif /* POSITIONAL_PARAMETERS */ /* state definitions */ enum STATE { @@ -312,11 +296,7 @@ const char __lookuptable[] = { /* '>' */ 0x00, /* '?' */ 0x00, /* '@' */ 0x00, -#if defined (_SAFECRT_IMPL) /* 'A' */ 0x20, // Disable %A format -#else /* defined (_SAFECRT_IMPL) */ - /* 'A' */ 0x28, -#endif /* defined (_SAFECRT_IMPL) */ /* 'B' */ 0x20, /* 'C' */ 0x38, /* 'D' */ 0x50, @@ -348,11 +328,7 @@ const char __lookuptable[] = { /* '^' */ 0x60, /* '_' */ 0x00, /* '`' */ 0x00, -#if defined (_SAFECRT_IMPL) /* 'a' */ 0x70, // Disable %a format -#else /* defined (_SAFECRT_IMPL) */ - /* 'a' */ 0x78, -#endif /* defined (_SAFECRT_IMPL) */ /* 'b' */ 0x70, /* 'c' */ 0x78, /* 'd' */ 0x78, @@ -365,11 +341,7 @@ const char __lookuptable[] = { /* 'k' */ 0x00, /* 'l' */ 0x07, /* 'm' */ 0x00, -#if defined (_SAFECRT_IMPL) /* 'n' */ 0x00, // Disable %n format -#else /* defined (_SAFECRT_IMPL) */ - /* 'n' */ 0x08, -#endif /* defined (_SAFECRT_IMPL) */ /* 'o' */ 0x08, /* 'p' */ 0x08, /* 'q' */ 0x00, @@ -389,149 +361,6 @@ const char __lookuptable[] = { #error code has been removed #endif /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -#error DO NOT use POSITIONAL_PARAMETERS without validating code! -steshaw 7/3/07 - -#define POSITION_CHAR _T('$') - -#define FORMAT_POSSCAN_PASS 0 -#define FORMAT_OUTPUT_PASS 1 - -#define FMT_TYPE_NOTSET -1 -#define FMT_TYPE_NONPOSITIONAL 0 -#define FMT_TYPE_POSITIONAL 1 - -enum ARG_TYPE{ -eblank, -e_int_arg, -#ifndef _UNICODE -e_short_arg, -#endif /* _UNICODE */ -e_ptr_arg, -e_int64_arg, -e_long_long_arg, -e_long_arg, -e_double_arg -}; - -struct positional_param -{ - enum ARG_TYPE arg_type; - va_list arg_ptr; - TCHAR type; - int flags; -}; - - - -#ifndef _UNICODE -#define _IS_FMTTYPE_WIDE(fl) ((fl & (FL_LONG|FL_WIDECHAR)) != 0) -#else /* _UNICODE */ -#define _IS_FMTTYPE_WIDE(fl) ((fl & FL_SHORT) == 0) -#endif /* _UNICODE */ - -#define _IS_FMTTYPE_PTRSIZE(fl) ((fl & FL_PTRSIZE) != 0) -#define _IS_FMTTYPE_SHORT(fl) ((fl & FL_SHORT) != 0) - -#define _IS_FMTTYPE_POINTER(type) (type == _T('p')) -#define _IS_FMTTYPE_STRING(type) ( (type == _T('s')) || (type == _T('S')) ) -#define _IS_FMTTYPE_NUMERIC(type) ( (type == _T('d')) || (type == _T('i')) || (type == _T('o')) || \ - (type == _T('u')) || (type == _T('x')) || (type == _T('X')) ) - -#ifdef _UNICODE -#define _tvalidate_param_reuse _validate_param_reuseW -#else /* _UNICODE */ -#define _tvalidate_param_reuse _validate_param_reuseA -#endif /* _UNICODE */ - - -/*** -*int _tvalidate_param_reuse(struct positional_param * pos, enum ARG_TYPE get_fn_type, TCHAR cur_type, int cur_flags) -* -*Purpose: -* Validates if the reused positional parameter is doesn't breaking any rules. -* a) %p - shouldn't be mixed with other format types. -* b) Wide & Ansi strings shouldn't be mixed -* c) Numeric types shouldn't mix if their sizes are different -* d) %I (without I32 or I64) shouldn't mix with other numeric types -* -*Entry: -* struct positional_param * pos -* enum ARG_TYPE get_fn_type -* TCHAR cur_type -* int cur_flags -* -*Exit: -* Returns 0 if any non-allowed reuse is happening otherwise 1 -* -*******************************************************************************/ - -#ifndef CPRFLAG - -int _tvalidate_param_reuse(struct positional_param * pos, enum ARG_TYPE get_fn_type, TCHAR cur_type, int cur_flags) -{ - int stored_value = 0 ; - int new_value = 0 ; - - if(_IS_FMTTYPE_POINTER(pos->type) || _IS_FMTTYPE_POINTER(cur_type)) - { - /* %p param shouldn't be mixed with other types. If both are %p, - then we don't need to do any more validations */ - return (pos->type == cur_type) ; - } - - stored_value = _IS_FMTTYPE_STRING(pos->type); - new_value = _IS_FMTTYPE_STRING(cur_type); - - if(stored_value || new_value) - { - /* If one type is a string, then the other also should be a string. Also - Wide & Ansi String parameters shouldn't be interchangebly used. - If these conditions are met, we don't need to do any more validations. - */ - return ( (stored_value == new_value) && (_IS_FMTTYPE_WIDE(pos->flags) == _IS_FMTTYPE_WIDE(cur_flags)) ); - } - - if( _IS_FMTTYPE_NUMERIC(pos->type) || _IS_FMTTYPE_NUMERIC(cur_type)) - { - /* If one type is numeric, then the other should also be numeric. */ - if (_IS_FMTTYPE_NUMERIC(pos->type) != _IS_FMTTYPE_NUMERIC(cur_type)) - return 0; - - /* For Numeric Types, we should allow mixing only if the size is the - same. Also, we shouldn't allow %I (without 32/64) which is platform - dependent to mix with other fixed numeric types */ - if( (_IS_FMTTYPE_PTRSIZE(pos->flags) != _IS_FMTTYPE_PTRSIZE(cur_flags)) || - (_IS_FMTTYPE_SHORT(pos->flags) != _IS_FMTTYPE_SHORT(cur_flags)) ) - { - return 0; - } - } - - return (pos->arg_type == get_fn_type); -} -#else /* CPRFLAG */ - -int _tvalidate_param_reuse(struct positional_param * pos, enum ARG_TYPE get_fn_type, TCHAR cur_type, int cur_flags); -#endif /* CPRFLAG */ - -#define STORE_ARGPTR(pos_struct, get_fn_type, pos, cur_type, cur_flags) \ - if(pos_struct[pos].arg_type == eblank) \ - { \ - pos_struct[pos].arg_type = get_fn_type; \ - pos_struct[pos].type = cur_type; \ - pos_struct[pos].flags = cur_flags; \ - } \ - else \ - { \ - _VALIDATE_RETURN(_tvalidate_param_reuse(&pos_struct[pos], get_fn_type, cur_type, cur_flags), EINVAL, -1); \ - } - - -#define GET_ARG(get_fn_type, arg_ptr, lhs, type) { va_list lst = arg_ptr ;lhs = type get_fn_type(&lst);} - -#endif /* POSITIONAL_PARAMETERS */ - #define FIND_CHAR_CLASS(lookuptbl, c) \ ((c) < _T(' ') || (c) > _T('x') ? \ CH_OTHER \ @@ -605,10 +434,6 @@ __inline long long __cdecl get_long_long_arg(va_list *pargptr); __inline __int64 __cdecl get_int64_arg(va_list *pargptr); #endif /* _INTEGRAL_MAX_BITS >= 64 */ -#ifdef POSITIONAL_PARAMETERS -__inline _CRT_DOUBLE __cdecl get_crtdouble_arg(va_list *pargptr); -#endif /* POSITIONAL_PARAMETERS */ - #endif // __GNUC_VA_LIST #ifdef CPRFLAG @@ -641,19 +466,11 @@ _CRTIMP int __cdecl _tcprintf_l ( ... ) #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _tcprintf_p_l ( - const _TCHAR * format, - _locale_t plocinfo, - ... - ) -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _tcprintf_s_l ( const _TCHAR * format, _locale_t plocinfo, ... ) -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ { @@ -664,11 +481,7 @@ _CRTIMP int __cdecl _tcprintf_s_l ( #ifndef FORMAT_VALIDATIONS ret = _vtcprintf_l(format, plocinfo, arglist); #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS - ret = _vtcprintf_p_l(format, plocinfo, arglist); -#else /* POSITIONAL_PARAMETERS */ ret = _vtcprintf_s_l(format, plocinfo, arglist); -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ @@ -683,17 +496,10 @@ _CRTIMP int __cdecl _tcprintf ( ... ) #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _tcprintf_p ( - const _TCHAR * format, - ... - ) -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _tcprintf_s ( const _TCHAR * format, ... ) -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ { @@ -705,11 +511,7 @@ _CRTIMP int __cdecl _tcprintf_s ( #ifndef FORMAT_VALIDATIONS ret = _vtcprintf_l(format, NULL, arglist); #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS - ret = _vtcprintf_p_l(format, NULL, arglist); -#else /* POSITIONAL_PARAMETERS */ ret = _vtcprintf_s_l(format, NULL, arglist); -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ @@ -763,16 +565,6 @@ _CRTIMP int __cdecl _vtcprintf ( } #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _vtcprintf_p ( - const _TCHAR *format, - va_list argptr - ) -{ - return _vtcprintf_p_l(format, NULL, argptr); -} - -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _vtcprintf_s ( const _TCHAR *format, va_list argptr @@ -781,7 +573,6 @@ _CRTIMP int __cdecl _vtcprintf_s ( return _vtcprintf_s_l(format, NULL, argptr); } -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #endif /* CPRFLAG */ @@ -789,72 +580,31 @@ _CRTIMP int __cdecl _vtcprintf_s ( #ifndef FORMAT_VALIDATIONS _CRTIMP int __cdecl _vtcprintf_l ( #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -_CRTIMP int __cdecl _vtcprintf_p_l ( -#else /* POSITIONAL_PARAMETERS */ _CRTIMP int __cdecl _vtcprintf_s_l ( -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #else /* CPRFLAG */ #ifdef _UNICODE #ifndef FORMAT_VALIDATIONS -#ifdef _SAFECRT_IMPL int __cdecl _woutput ( -#else /* _SAFECRT_IMPL */ -int __cdecl _woutput_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -#ifdef _SAFECRT_IMPL -int __cdecl _woutput_p ( -#else /* _SAFECRT_IMPL */ -int __cdecl _woutput_p_l ( -#endif /* _SAFECRT_IMPL */ - miniFILE *stream, -#else /* POSITIONAL_PARAMETERS */ -#ifdef _SAFECRT_IMPL int __cdecl _woutput_s ( -#else /* _SAFECRT_IMPL */ -int __cdecl _woutput_s_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #else /* _UNICODE */ #ifndef FORMAT_VALIDATIONS -#ifdef _SAFECRT_IMPL int __cdecl _output ( -#else /* _SAFECRT_IMPL */ -int __cdecl _output_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, #else /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS -#ifdef _SAFECRT_IMPL - int __cdecl _output_p ( -#else /* _SAFECRT_IMPL */ - int __cdecl _output_p_l ( -#endif /* _SAFECRT_IMPL */ - miniFILE *stream, -#else /* POSITIONAL_PARAMETERS */ -#ifdef _SAFECRT_IMPL int __cdecl _output_s ( -#else /* _SAFECRT_IMPL */ - int __cdecl _output_s_l ( -#endif /* _SAFECRT_IMPL */ miniFILE *stream, -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ #endif /* _UNICODE */ #endif /* CPRFLAG */ const _TCHAR *format, -#ifndef _SAFECRT_IMPL - _locale_t plocinfo, -#endif /* _SAFECRT_IMPL */ va_list argptr ) { @@ -888,65 +638,15 @@ int __cdecl _output_l ( int buffersize; /* size of text.sz (used only for the call to _cfltcvt) */ int bufferiswide=0; /* non-zero = buffer contains wide chars already */ -#ifndef _SAFECRT_IMPL - _LocaleUpdate _loc_update(plocinfo); -#endif /* _SAFECRT_IMPL */ - -#ifdef POSITIONAL_PARAMETERS - /* Used for parsing the format */ - const _TCHAR * saved_format = NULL; - _TCHAR * end_pos = NULL; - - /* This is the structure which stores the values corresponding to - each positional param */ - struct positional_param pos_value[_ARGMAX]; - - int pass = 0; /* Ctr for scanning the format string in diff passes */ - int noofpasses = 0; /* Set to 2 for positional formats, otherwise 1 */ - int max_pos = -1; /* Keeping track of the current max positional arg */ - int type_pos = -1; /* position of an arg denoting a type */ - int width_pos = -1; /* position of an arg denoting width */ - int precis_pos = -1; /* position of an arg denoting precision */ - int format_type = FMT_TYPE_NOTSET; /* type of format string */ -#endif /* POSITIONAL_PARAMETERS */ - #ifndef CPRFLAG _VALIDATE_RETURN( (stream != NULL), EINVAL, -1); #endif /* CPRFLAG */ _VALIDATE_RETURN( (format != NULL), EINVAL, -1); charsout = 0; /* no characters written yet */ -#ifdef POSITIONAL_PARAMETERS - - saved_format = format; - - for(pass = 0 ; pass < 2; ++pass) - { - - if((pass == FORMAT_OUTPUT_PASS) && (format_type == FMT_TYPE_NONPOSITIONAL)) - { - /* If in pass2, we still have format_type isn't positional, it means - that we do not need a 2nd pass */ - break; - } -#endif /* POSITIONAL_PARAMETERS */ textlen = 0; /* no text yet */ state = ST_NORMAL; /* starting state */ buffersize = 0; -#ifdef POSITIONAL_PARAMETERS - max_pos = -1; - fldwidth = 0; - precision = 0; - format = saved_format; - type_pos = -1; - width_pos = -1; - precis_pos = -1; - - /* All chars before the first format specifier get output in the first - pass itself. Hence we have to reset format_type to FMT_TYPE_NOTSET to ensure - that they do not get output again in the 2nd pass */ - format_type = FMT_TYPE_NOTSET; -#endif /* POSITIONAL_PARAMETERS */ /* main loop -- loop while format character exist and no I/O errors */ while ((ch = *format++) != _T('\0') && charsout >= 0) { @@ -957,50 +657,7 @@ int __cdecl _output_l ( chclass = FIND_CHAR_CLASS(__lookuptable_s, ch); /* find character class */ state = FIND_NEXT_STATE(__lookuptable_s, chclass, state); /* find next state */ -#ifdef POSITIONAL_PARAMETERS - if((state == ST_PERCENT) && (*format != _T('%'))) - { - if(format_type == FMT_TYPE_NOTSET) - { - /* We set the value of format_type when we hit the first type specifier */ - if(_tcstol(format, &end_pos, 10) > 0 && (*end_pos == POSITION_CHAR)) - { - if(pass == FORMAT_POSSCAN_PASS) - { - memset(pos_value,0,sizeof(pos_value)); - } - format_type = FMT_TYPE_POSITIONAL; - } - else - { - format_type = FMT_TYPE_NONPOSITIONAL; - } - } - - if(format_type == FMT_TYPE_POSITIONAL) - { - type_pos = _tcstol(format, &end_pos, 10) - 1; - format = end_pos + 1; - - if(pass == FORMAT_POSSCAN_PASS) - { - /* We don't redo the validations in the 2nd pass */ - _VALIDATE_RETURN(((type_pos >= 0) && (*end_pos == POSITION_CHAR) && (type_pos < _ARGMAX)), EINVAL, -1); - - /* Update max_pos with the current maximum pos argument */ - max_pos = type_pos > max_pos ? type_pos : max_pos; - } - } - - } - else - { - /* If state is ST_INVALID, that means an invalid format specifier */ - _VALIDATE_RETURN((state != ST_INVALID), EINVAL, -1); - } -#else /* POSITIONAL_PARAMETERS */ _VALIDATE_RETURN((state != ST_INVALID), EINVAL, -1); -#endif /* POSITIONAL_PARAMETERS */ #endif /* FORMAT_VALIDATIONS */ @@ -1009,19 +666,6 @@ int __cdecl _output_l ( case ST_NORMAL: -#ifdef POSITIONAL_PARAMETERS - if(((pass == FORMAT_POSSCAN_PASS) && (format_type == FMT_TYPE_POSITIONAL)) - || ((pass == FORMAT_OUTPUT_PASS) && (format_type == FMT_TYPE_NOTSET))) - { - - /* Do not output in the 1st pass, if we have already come across - a positional format specifier. All chars before the first format - specifier get output in the first pass itself. Hence we need to - check the format_type to make sure that they don't get output - again in the 2nd pass */ - break; - } -#endif /* POSITIONAL_PARAMETERS */ NORMAL_STATE: /* normal state -- just write character */ @@ -1066,37 +710,7 @@ int __cdecl _output_l ( /* update width value */ if (ch == _T('*')) { /* get width from arg list */ -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ fldwidth = get_int_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - width_pos = _tcstol(format, &end_pos, 10) - 1; - format = end_pos + 1; - - if(pass == FORMAT_POSSCAN_PASS) - { - _VALIDATE_RETURN(((width_pos >= 0) && (*end_pos == POSITION_CHAR) && (type_pos < _ARGMAX)), EINVAL, -1); - - /* Update max_pos with the current maximum pos argument */ - max_pos = width_pos > max_pos ? width_pos : max_pos; - - STORE_ARGPTR(pos_value, e_int_arg, width_pos, ch, flags) - break; - - } - else - { - /* get width from arg list */ - GET_ARG(get_int_arg,pos_value[width_pos].arg_ptr, fldwidth, ) - } - - } -#endif /* POSITIONAL_PARAMETERS */ if (fldwidth < 0) { /* ANSI says neg fld width means '-' flag and pos width */ flags |= FL_LEFT; @@ -1119,35 +733,7 @@ int __cdecl _output_l ( /* update precison value */ if (ch == _T('*')) { /* get precision from arg list */ -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ precision = get_int_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - precis_pos = _tcstol(format, &end_pos, 10) - 1; - format = end_pos + 1; - - if(pass == FORMAT_POSSCAN_PASS) - { - _VALIDATE_RETURN(((precis_pos >= 0) && (*end_pos == POSITION_CHAR) && (type_pos < _ARGMAX)), EINVAL, -1); - - /* Update max_pos with the current maximum pos argument */ - max_pos = precis_pos > max_pos ? precis_pos : max_pos; - - STORE_ARGPTR(pos_value, e_int_arg, precis_pos, ch, flags) - break; - } - else - { - /* get width from arg list */ - GET_ARG(get_int_arg,pos_value[precis_pos].arg_ptr, precision, ) - } - } -#endif /* POSITIONAL_PARAMETERS */ if (precision < 0) precision = -1; /* neg precision means default */ } @@ -1203,17 +789,11 @@ int __cdecl _output_l ( (*format == _T('x')) || (*format == _T('X')) ) { -#ifdef POSITIONAL_PARAMETERS - /* %I without 32/64 is platform dependent. We set FL_PTRSIZE to indicate - this - this is used in the positional parameter reuse validation */ - flags |= FL_PTRSIZE; -#else /* POSITIONAL_PARAMETERS */ /* * Nothing further needed. %Id (et al) is * handled just like %d, except that it defaults to 64 bits * on WIN64. Fall through to the next iteration. */ -#endif /* POSITIONAL_PARAMETERS */ } else { state = ST_NORMAL; @@ -1257,28 +837,7 @@ int __cdecl _output_l ( /* print a single character specified by int argument */ #ifdef _UNICODE bufferiswide = 1; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ wchar = (wchar_t) get_int_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, wchar, (wchar_t)) - } - } -#endif /* POSITIONAL_PARAMETERS */ if (flags & FL_SHORT) { /* format multibyte character */ /* this is an extension of ANSI */ @@ -1288,14 +847,7 @@ int __cdecl _output_l ( tempchar[1] = '\0'; } -#ifdef _SAFECRT_IMPL if (_MBTOWC(buffer.wz,tempchar, MB_CUR_MAX) < 0) -#else /* _SAFECRT_IMPL */ - if (_mbtowc_l(buffer.wz, - tempchar, - _loc_update.GetLocaleT()->locinfo->mb_cur_max, - _loc_update.GetLocaleT()) < 0) -#endif /* _SAFECRT_IMPL */ { /* ignore if conversion was unsuccessful */ no_output = 1; @@ -1307,56 +859,14 @@ int __cdecl _output_l ( textlen = 1; /* print just a single character */ #else /* _UNICODE */ if (flags & (FL_LONG|FL_WIDECHAR)) { -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ wchar = (wchar_t) get_short_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_short_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_short_arg,pos_value[type_pos].arg_ptr, wchar, (wchar_t)) - } - } -#endif /* POSITIONAL_PARAMETERS */ no_output = 1; } else { /* format multibyte character */ /* this is an extension of ANSI */ unsigned short temp; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ wchar = (wchar_t)get_int_arg(&argptr); temp = (unsigned short)wchar; -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, temp, (unsigned short)) - } - } -#endif /* POSITIONAL_PARAMETERS */ { buffer.sz[0] = (char) temp; textlen = 1; @@ -1375,28 +885,7 @@ int __cdecl _output_l ( char *Buffer; } *pstr; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ pstr = (struct _count_string *)get_ptr_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_ptr_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_ptr_arg,pos_value[type_pos].arg_ptr, pstr, (struct _count_string *) ) - } - } -#endif /* POSITIONAL_PARAMETERS */ if (pstr == NULL || pstr->Buffer == NULL) { /* null ptr passed, use special string */ text.sz = __nullstring; @@ -1441,28 +930,7 @@ int __cdecl _output_l ( /* at all. Thus, we must do our own scan. */ i = (precision == -1) ? INT_MAX : precision; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ text.sz = (char *)get_ptr_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_ptr_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_ptr_arg,pos_value[type_pos].arg_ptr, text.sz,(char *)) - } - } -#endif /* POSITIONAL_PARAMETERS */ /* scan for null upto i characters */ #ifdef _UNICODE @@ -1514,28 +982,7 @@ int __cdecl _output_l ( void *p; /* temp */ -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ p = get_ptr_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_ptr_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_ptr_arg,pos_value[type_pos].arg_ptr,p,) - } - } -#endif /* POSITIONAL_PARAMETERS */ /* %n is disabled */ _VALIDATE_RETURN(("'n' format specifier disabled" && 0), EINVAL, -1); @@ -1572,15 +1019,6 @@ int __cdecl _output_l ( /* floating point conversion -- we call cfltcvt routines */ /* to do the work for us. */ flags |= FL_SIGNED; /* floating point is signed conversion */ -#ifdef POSITIONAL_PARAMETERS - if((format_type == FMT_TYPE_POSITIONAL) && (pass == FORMAT_POSSCAN_PASS)) - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - STORE_ARGPTR(pos_value, e_double_arg, type_pos, ch, flags) - - break; - } -#endif /* POSITIONAL_PARAMETERS */ text.sz = buffer.sz; /* put result in buffer */ buffersize = BUFFERSIZE; @@ -1596,58 +1034,17 @@ int __cdecl _output_l ( precision = BUFFERSIZE - _CVTBUFSIZE; } -#ifdef _SAFECRT_IMPL /* for safecrt, we pass along the FL_ALTERNATE flag to _safecrt_cfltcvt */ if (flags & FL_ALTERNATE) { capexp |= FL_ALTERNATE; } -#endif /* _SAFECRT_IMPL */ _CRT_DOUBLE tmp; -#ifdef POSITIONAL_PARAMETERS - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ tmp=va_arg(argptr, _CRT_DOUBLE); -#ifdef POSITIONAL_PARAMETERS - } - else - { - /* Will get here only for pass == FORMAT_OUTPUT_PASS because - pass == FORMAT_POSSCAN_PASS has a break Above */ - va_list tmp_arg; - - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - _ASSERTE(pass == FORMAT_OUTPUT_PASS); - tmp_arg = pos_value[type_pos].arg_ptr; - tmp=va_arg(tmp_arg, _CRT_DOUBLE); - } -#endif /* POSITIONAL_PARAMETERS */ /* Note: assumes ch is in ASCII range */ /* In safecrt, we provide a special version of _cfltcvt which internally calls printf (see safecrt_output_s.c) */ -#ifndef _SAFECRT_IMPL - _cfltcvt_l(&tmp.x, buffer.sz, buffersize, (char)ch, precision, capexp, _loc_update.GetLocaleT()); -#else /* _SAFECRT_IMPL */ _CFLTCVT(&tmp, buffer.sz, buffersize, (char)ch, precision, capexp); -#endif /* _SAFECRT_IMPL */ - -#ifndef _SAFECRT_IMPL - /* For safecrt, this is done already in _safecrt_cfltcvt */ - - /* '#' and precision == 0 means force a decimal point */ - if ((flags & FL_ALTERNATE) && precision == 0) - { - _forcdecpt_l(text.sz, _loc_update.GetLocaleT()); - } - - /* 'g' format means crop zero unless '#' given */ - if (ch == _T('g') && !(flags & FL_ALTERNATE)) - { - _cropzeros_l(text.sz, _loc_update.GetLocaleT()); - } -#endif /* _SAFECRT_IMPL */ /* check if result was negative, save '-' for later */ /* and point to positive part (this is for '0' padding) */ @@ -1734,196 +1131,34 @@ int __cdecl _output_l ( /* 1. read argument into l, sign extend as needed */ #if _INTEGRAL_MAX_BITS >= 64 if (flags & FL_I64) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_int64_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int64_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int64_arg,pos_value[type_pos].arg_ptr,l,) - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else #endif /* _INTEGRAL_MAX_BITS >= 64 */ if (flags & FL_LONGLONG) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_long_long_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_long_long_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_long_long_arg,pos_value[type_pos].arg_ptr,l,) - } - } - } -#endif /* POSITIONAL_PARAMETERS */ - else #if !LONG_IS_INT if (flags & FL_LONG) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_long_arg(&argptr); -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_long_arg, type_pos, ch, flags) - break; - } - else - { - l = GETARG(get_long_arg,pos_value[type_pos].arg_ptr); - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else #endif /* !LONG_IS_INT */ #if !SHORT_IS_INT if (flags & FL_SHORT) { if (flags & FL_SIGNED) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = (short) get_int_arg(&argptr); /* sign extend */ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr,l, (short)) /* sign extend */ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = (unsigned short) get_int_arg(&argptr); /* zero-extend*/ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr,l, (unsigned short)) /* zero-extend*/ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ } else #endif /* !SHORT_IS_INT */ { if (flags & FL_SIGNED) -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = get_int_arg(&argptr); /* sign extend */ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, l, ) /* sign extend */ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ else -#ifdef POSITIONAL_PARAMETERS - { - if(format_type == FMT_TYPE_NONPOSITIONAL) - { -#endif /* POSITIONAL_PARAMETERS */ l = (unsigned int) get_int_arg(&argptr); /* zero-extend*/ -#ifdef POSITIONAL_PARAMETERS - } - else - { - _VALIDATE_RETURN(((type_pos>=0) && (type_pos<_ARGMAX)), EINVAL, -1); - - if (pass == FORMAT_POSSCAN_PASS) - { - STORE_ARGPTR(pos_value, e_int_arg, type_pos, ch, flags) - break; - } - else - { - GET_ARG(get_int_arg,pos_value[type_pos].arg_ptr, l, (unsigned int)) /* zero-extend*/ - } - } - } -#endif /* POSITIONAL_PARAMETERS */ } @@ -1991,13 +1226,6 @@ int __cdecl _output_l ( break; } -#ifdef POSITIONAL_PARAMETERS - if((format_type == FMT_TYPE_POSITIONAL) && (pass == FORMAT_POSSCAN_PASS)) - { - break; - } -#endif /* POSITIONAL_PARAMETERS */ - /* At this point, we have done the specific conversion, and */ /* 'text' points to text to print; 'textlen' is length. Now we */ @@ -2060,14 +1288,7 @@ int __cdecl _output_l ( p = text.sz; count = textlen; while (count-- > 0) { -#ifdef _SAFECRT_IMPL retval = _MBTOWC(&wchar, p, MB_CUR_MAX); -#else /* _SAFECRT_IMPL */ - retval = _mbtowc_l(&wchar, - p, - _loc_update.GetLocaleT()->locinfo->mb_cur_max, - _loc_update.GetLocaleT()); -#endif /* _SAFECRT_IMPL */ if (retval <= 0) { charsout = -1; break; @@ -2099,62 +1320,6 @@ int __cdecl _output_l ( _VALIDATE_RETURN(((state == ST_NORMAL) || (state == ST_TYPE)), EINVAL, -1); #endif /* FORMAT_VALIDATIONS */ -#ifdef POSITIONAL_PARAMETERS - if((format_type == FMT_TYPE_POSITIONAL) && (pass == FORMAT_POSSCAN_PASS)) - { - /* At the end of the 1st pass, we have the types filled into the - arg_type member of the struct. We now need to get argument pointer on - the stack & store it into the arg_ptr member */ - for(type_pos = 0; type_pos <= max_pos; ++type_pos) - { - switch(pos_value[type_pos].arg_type) - { - case e_int_arg : - pos_value[type_pos].arg_ptr = argptr; - get_int_arg(&argptr); - break; -#ifndef _UNICODE - case e_short_arg: - pos_value[type_pos].arg_ptr = argptr; - get_short_arg(&argptr); - break; -#endif /* _UNICODE */ - case e_ptr_arg: - pos_value[type_pos].arg_ptr = argptr; - get_ptr_arg(&argptr); - break; - - case e_int64_arg: - pos_value[type_pos].arg_ptr = argptr; - get_int64_arg(&argptr); - break; - - case e_long_long_arg: - pos_value[type_pos].arg_ptr = argptr; - get_long_long_arg(&argptr); - break; - - case e_long_arg: - pos_value[type_pos].arg_ptr = argptr; - get_long_arg(&argptr); - break; - - case e_double_arg : - pos_value[type_pos].arg_ptr = argptr; - get_crtdouble_arg(&argptr); - break; - default: - /* Should never get here */ - _VALIDATE_RETURN(("Missing position in the format string", 0), EINVAL, -1); - break; - } - } - } - - - } -#endif /* POSITIONAL_PARAMETERS */ - return charsout; /* return value = number of characters written */ } @@ -2458,17 +1623,7 @@ __inline short __cdecl get_short_arg ( } #endif /* !SHORT_IS_INT */ -#ifdef POSITIONAL_PARAMETERS -__inline _CRT_DOUBLE __cdecl get_crtdouble_arg(va_list *pargptr) -{ - return va_arg(*pargptr, _CRT_DOUBLE); -} -#endif /* POSITIONAL_PARAMETERS */ #endif /* _UNICODE */ #endif // __GNUC_VA_LIST -#ifndef _SAFECRT_IMPL -} -#endif /* _SAFECRT_IMPL */ - diff --git a/src/pal/src/safecrt/safecrt_woutput_s.c b/src/pal/src/safecrt/safecrt_woutput_s.c index df90f9401c..e74fbef447 100644 --- a/src/pal/src/safecrt/safecrt_woutput_s.c +++ b/src/pal/src/safecrt/safecrt_woutput_s.c @@ -19,7 +19,10 @@ * ****/ +#define _SAFECRT_IMPL + #define __STDC_LIMIT_MACROS + #include "pal/palinternal.h" #include <string.h> #include <errno.h> @@ -37,8 +40,6 @@ #define UNICODE 1 #endif -#define _SAFECRT_IMPL - #define FORMAT_VALIDATIONS #if defined(_NTSUBSET_) #define _MBTOWC _safecrt_mbtowc |