| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657 |
- ///////////////////////////////////////////////////////////////////////////////
- // Copyright (c) Electronic Arts Inc. All rights reserved.
- ///////////////////////////////////////////////////////////////////////////////
- #include <EAStdC/internal/Config.h>
- #include <EAStdC/internal/SprintfCore.h>
- #include <EAStdC/EAString.h>
- #include <EAStdC/EACType.h>
- #include <EAAssert/eaassert.h>
- EA_DISABLE_ALL_VC_WARNINGS()
- #include <math.h>
- #include <float.h>
- #include <stddef.h>
- #include <string.h>
- #include <stdlib.h>
- EA_RESTORE_ALL_VC_WARNINGS()
- EA_DISABLE_VC_WARNING(4127) // conditional expression is constant.
- namespace EA
- {
- namespace StdC
- {
- ///////////////////////////////////////////////////////////////////////////////
- // char8_t
- ///////////////////////////////////////////////////////////////////////////////
- EASTDC_API int Vcprintf(WriteFunction8 pWriteFunction8, void* EA_RESTRICT pContext, const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return SprintfLocal::VprintfCore(pWriteFunction8, pContext, pFormat, arguments);
- }
- EASTDC_API int Vfprintf(FILE* EA_RESTRICT pFile, const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if EASTDC_PRINTF_DEBUG_ENABLED
- if((pFile == stdout) || (pFile == stderr))
- {
- SprintfLocal::PlatformLogWriterContext8 context;
- return SprintfLocal::VprintfCore(SprintfLocal::PlatformLogWriter8, &context, pFormat, arguments);
- }
- #endif
- return SprintfLocal::VprintfCore(SprintfLocal::FILEWriter8, pFile, pFormat, arguments);
- }
- EASTDC_API int Vprintf(const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if EASTDC_PRINTF_DEBUG_ENABLED
- SprintfLocal::PlatformLogWriterContext8 context;
- return SprintfLocal::VprintfCore(SprintfLocal::PlatformLogWriter8, &context, pFormat, arguments);
- #else
- return SprintfLocal::VprintfCore(SprintfLocal::FILEWriter8, stdout, pFormat, arguments);
- #endif
- }
- EASTDC_API int Vsprintf(char8_t* EA_RESTRICT pDestination, const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return Vsnprintf(pDestination, (size_t)-1, pFormat, arguments);
- }
- EASTDC_API int Vsnprintf(char8_t* EA_RESTRICT pDestination, size_t n, const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- SprintfLocal::SnprintfContext8 sc(pDestination, 0, pDestination ? n : 0);
- const int nRequiredLength = SprintfLocal::VprintfCore(SprintfLocal::StringWriter8, &sc, pFormat, arguments);
- #if EASPRINTF_SNPRINTF_C99_RETURN
- if(pDestination && (nRequiredLength >= 0))
- {
- if((size_t)nRequiredLength < n) // If there was enough space...
- pDestination[nRequiredLength] = 0;
- else if(n > 0)
- pDestination[n - 1] = 0;
- } // Else an encoding error has occurred and we can do nothing.
- return nRequiredLength;
- #else
- if((size_t)nRequiredLength < n)
- {
- if(pDestination)
- pDestination[nRequiredLength] = 0;
- return nRequiredLength;
- }
- else if((n > 0) && pDestination)
- pDestination[n - 1] = 0;
- else if(n == 0)
- return nRequiredLength;
- return -1;
- #endif
- }
- EASTDC_API int Vscprintf(const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- // vscprintf returns the number of chars that are needed for a printf operation.
- return Vsnprintf(NULL, 0, pFormat, arguments);
- }
- EASTDC_API int Vdprintf(const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- SprintfLocal::PlatformLogWriterContext8 context;
- return SprintfLocal::VprintfCore(SprintfLocal::PlatformLogWriter8, &context, pFormat, arguments);
- }
- EASTDC_API int Cprintf(WriteFunction8 pWriteFunction, void* EA_RESTRICT pContext, const char8_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = SprintfLocal::VprintfCore(pWriteFunction, pContext, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Fprintf(FILE* EA_RESTRICT pFile, const char8_t* EA_RESTRICT pFormat, ...)
- {
- int result;
- va_list arguments;
- va_start(arguments, pFormat);
- #if EASTDC_PRINTF_DEBUG_ENABLED
- if((pFile == stdout) || (pFile == stderr))
- {
- SprintfLocal::PlatformLogWriterContext8 context;
- result = SprintfLocal::VprintfCore(SprintfLocal::PlatformLogWriter8, &context, pFormat, arguments);
- }
- else
- #endif
- result = SprintfLocal::VprintfCore(SprintfLocal::FILEWriter8, pFile, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Printf(const char8_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- #if EASTDC_PRINTF_DEBUG_ENABLED
- SprintfLocal::PlatformLogWriterContext8 context;
- int result = SprintfLocal::VprintfCore(SprintfLocal::PlatformLogWriter8, &context, pFormat, arguments);
- #else
- int result = SprintfLocal::VprintfCore(SprintfLocal::FILEWriter8, stdout, pFormat, arguments);
- #endif
- va_end(arguments);
- return result;
- }
- EASTDC_API int Sprintf(char8_t* EA_RESTRICT pDestination, const char8_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsnprintf(pDestination, (size_t)SprintfLocal::kNoPrecision, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Snprintf(char8_t* EA_RESTRICT pDestination, size_t n, const char8_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsnprintf(pDestination, n, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Dprintf(const char8_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- SprintfLocal::PlatformLogWriterContext8 context;
- int result = SprintfLocal::VprintfCore(SprintfLocal::PlatformLogWriter8, &context, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- ///////////////////////////////////////////////////////////////////////////////
- // char16_t
- ///////////////////////////////////////////////////////////////////////////////
- EASTDC_API int Vcprintf(WriteFunction16 pWriteFunction16, void* EA_RESTRICT pContext, const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return SprintfLocal::VprintfCore(pWriteFunction16, pContext, pFormat, arguments);
- }
- EASTDC_API int Vfprintf(FILE* EA_RESTRICT pFile, const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return SprintfLocal::VprintfCore(SprintfLocal::FILEWriter16, pFile, pFormat, arguments);
- }
- EASTDC_API int Vprintf(const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return SprintfLocal::VprintfCore(SprintfLocal::FILEWriter16, stdout, pFormat, arguments);
- }
- EASTDC_API int Vsprintf(char16_t* EA_RESTRICT pDestination, const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return Vsnprintf(pDestination, (size_t)-1, pFormat, arguments);
- }
- EASTDC_API int Vsnprintf(char16_t* EA_RESTRICT pDestination, size_t n, const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- SprintfLocal::SnprintfContext16 sc(pDestination, 0, pDestination ? n : 0);
- const int nRequiredLength = SprintfLocal::VprintfCore(SprintfLocal::StringWriter16, &sc, pFormat, arguments);
- #if EASPRINTF_SNPRINTF_C99_RETURN
- if(pDestination && (nRequiredLength >= 0))
- {
- if((size_t)nRequiredLength < n) // If there was enough space...
- pDestination[nRequiredLength] = 0;
- else if(n > 0)
- pDestination[n - 1] = 0;
- } // Else an encoding error has occurred and we can do nothing.
- return nRequiredLength;
- #else
- if((size_t)nRequiredLength < n)
- {
- if(pDestination)
- pDestination[nRequiredLength] = 0;
- return nRequiredLength;
- }
- else if((n > 0) && pDestination)
- pDestination[n - 1] = 0;
- else if(n == 0)
- return nRequiredLength;
- return -1;
- #endif
- }
- EASTDC_API int Vscprintf(const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- // vscprintf returns the number of chars that are needed for a printf operation.
- return Vsnprintf(NULL, 0, pFormat, arguments);
- }
- EASTDC_API int Cprintf(WriteFunction16 pWriteFunction, void* EA_RESTRICT pContext, const char16_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = SprintfLocal::VprintfCore(pWriteFunction, pContext, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Fprintf(FILE* EA_RESTRICT pFile, const char16_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = SprintfLocal::VprintfCore(SprintfLocal::FILEWriter16, pFile, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Printf(const char16_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = SprintfLocal::VprintfCore(SprintfLocal::FILEWriter16, stdout, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Sprintf(char16_t* EA_RESTRICT pDestination, const char16_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsnprintf(pDestination, (size_t)SprintfLocal::kNoPrecision, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Snprintf(char16_t* EA_RESTRICT pDestination, size_t n, const char16_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsnprintf(pDestination, n, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- ///////////////////////////////////////////////////////////////////////////////
- // char32_t
- ///////////////////////////////////////////////////////////////////////////////
- EASTDC_API int Vcprintf(WriteFunction32 pWriteFunction32, void* EA_RESTRICT pContext, const char32_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return SprintfLocal::VprintfCore(pWriteFunction32, pContext, pFormat, arguments);
- }
- EASTDC_API int Vfprintf(FILE* EA_RESTRICT pFile, const char32_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return SprintfLocal::VprintfCore(SprintfLocal::FILEWriter32, pFile, pFormat, arguments);
- }
- EASTDC_API int Vprintf(const char32_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return SprintfLocal::VprintfCore(SprintfLocal::FILEWriter32, stdout, pFormat, arguments);
- }
- EASTDC_API int Vsprintf(char32_t* EA_RESTRICT pDestination, const char32_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return Vsnprintf(pDestination, (size_t)-1, pFormat, arguments);
- }
- EASTDC_API int Vsnprintf(char32_t* EA_RESTRICT pDestination, size_t n, const char32_t* EA_RESTRICT pFormat, va_list arguments)
- {
- SprintfLocal::SnprintfContext32 sc(pDestination, 0, pDestination ? n : 0);
- const int nRequiredLength = SprintfLocal::VprintfCore(SprintfLocal::StringWriter32, &sc, pFormat, arguments);
- #if EASPRINTF_SNPRINTF_C99_RETURN
- if(pDestination && (nRequiredLength >= 0))
- {
- if((size_t)nRequiredLength < n) // If there was enough space...
- pDestination[nRequiredLength] = 0;
- else if(n > 0)
- pDestination[n - 1] = 0;
- } // Else an encoding error has occurred and we can do nothing.
- return nRequiredLength;
- #else
- if((size_t)nRequiredLength < n)
- {
- if(pDestination)
- pDestination[nRequiredLength] = 0;
- return nRequiredLength;
- }
- else if((n > 0) && pDestination)
- pDestination[n - 1] = 0;
- else if(n == 0)
- return nRequiredLength;
- return -1;
- #endif
- }
- EASTDC_API int Vscprintf(const char32_t* EA_RESTRICT pFormat, va_list arguments)
- {
- // vscprintf returns the number of chars that are needed for a printf operation.
- return Vsnprintf(NULL, 0, pFormat, arguments);
- }
- EASTDC_API int Cprintf(WriteFunction32 pWriteFunction, void* EA_RESTRICT pContext, const char32_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = SprintfLocal::VprintfCore(pWriteFunction, pContext, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Fprintf(FILE* EA_RESTRICT pFile, const char32_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = SprintfLocal::VprintfCore(SprintfLocal::FILEWriter32, pFile, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Printf(const char32_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = SprintfLocal::VprintfCore(SprintfLocal::FILEWriter32, stdout, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Sprintf(char32_t* EA_RESTRICT pDestination, const char32_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsnprintf(pDestination, (size_t)SprintfLocal::kNoPrecision, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Snprintf(char32_t* EA_RESTRICT pDestination, size_t n, const char32_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsnprintf(pDestination, n, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- ///////////////////////////////////////////////////////////////////////////
- // Deprecated functionality
- ///////////////////////////////////////////////////////////////////////////
- struct Bridge8
- {
- WriteFunction8Old mpOldWriteFunction;
- void* mpUserContext;
- };
- static int WriteFunctionBridge8(const char8_t* EA_RESTRICT pData, size_t nCount, void* EA_RESTRICT pContext8, WriteFunctionState /*wfs*/)
- {
- Bridge8* pBridge8 = (Bridge8*)pContext8;
- return pBridge8->mpOldWriteFunction(pData, nCount, pBridge8->mpUserContext);
- }
- struct Bridge16
- {
- WriteFunction16Old mpOldWriteFunction;
- void* mpUserContext;
- };
- static int WriteFunctionBridge16(const char16_t* EA_RESTRICT pData, size_t nCount, void* EA_RESTRICT pContext16, WriteFunctionState /*wfs*/)
- {
- Bridge16* pBridge16 = (Bridge16*)pContext16;
- return pBridge16->mpOldWriteFunction(pData, nCount, pBridge16->mpUserContext);
- }
- EASTDC_API int Cprintf(WriteFunction8Old pWriteFunction, void* EA_RESTRICT pContext, const char8_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vcprintf(pWriteFunction, pContext, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Cprintf(WriteFunction16Old pWriteFunction, void* EA_RESTRICT pContext, const char16_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vcprintf(pWriteFunction, pContext, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Vcprintf(WriteFunction8Old pWriteFunction8, void* EA_RESTRICT pContext, const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- Bridge8 bridge8 = { pWriteFunction8, pContext };
- return SprintfLocal::VprintfCore(WriteFunctionBridge8, &bridge8, pFormat, arguments);
- }
- EASTDC_API int Vcprintf(WriteFunction16Old pWriteFunction16, void* EA_RESTRICT pContext, const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- Bridge16 bridge16 = { pWriteFunction16, pContext };
- return SprintfLocal::VprintfCore(WriteFunctionBridge16, &bridge16, pFormat, arguments);
- }
- #if EASTDC_VSNPRINTF8_ENABLED
- EASTDC_API int Vsnprintf8(char8_t* EA_RESTRICT pDestination, size_t n, const char8_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return Vsnprintf(pDestination, n, pFormat, arguments);
- }
- EASTDC_API int Vsnprintf16(char16_t* EA_RESTRICT pDestination, size_t n, const char16_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return Vsnprintf(pDestination, n, pFormat, arguments);
- }
- EASTDC_API int Vsnprintf32(char32_t* EA_RESTRICT pDestination, size_t n, const char32_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return Vsnprintf(pDestination, n, pFormat, arguments);
- }
- #if defined(EA_WCHAR_UNIQUE) && EA_WCHAR_UNIQUE
- EASTDC_API int VsnprintfW(wchar_t* EA_RESTRICT pDestination, size_t n, const wchar_t* EA_RESTRICT pFormat, va_list arguments)
- {
- return Vsnprintf(pDestination, n, pFormat, arguments);
- }
- #endif
- #endif
- #if defined(EA_WCHAR_UNIQUE) && EA_WCHAR_UNIQUE
- EASTDC_API int Vcprintf(WriteFunctionW pWriteFunctionW, void* EA_RESTRICT pContext, const wchar_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if (EA_WCHAR_SIZE == 2)
- return Vcprintf(reinterpret_cast<WriteFunction16>(pWriteFunctionW), pContext, reinterpret_cast<const char16_t *>(pFormat), arguments);
- #else
- return Vcprintf(reinterpret_cast<WriteFunction32>(pWriteFunctionW), pContext, reinterpret_cast<const char32_t *>(pFormat), arguments);
- #endif
- }
- EASTDC_API int Vfprintf(FILE* EA_RESTRICT pFile, const wchar_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if (EA_WCHAR_SIZE == 2)
- return Vfprintf(pFile, reinterpret_cast<const char16_t *>(pFormat), arguments);
- #else
- return Vfprintf(pFile, reinterpret_cast<const char32_t *>(pFormat), arguments);
- #endif
- }
- EASTDC_API int Vprintf(const wchar_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if (EA_WCHAR_SIZE == 2)
- return Vprintf(reinterpret_cast<const char16_t *>(pFormat), arguments);
- #else
- return Vprintf(reinterpret_cast<const char32_t *>(pFormat), arguments);
- #endif
- }
- EASTDC_API int Vsprintf(wchar_t* EA_RESTRICT pDestination, const wchar_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if (EA_WCHAR_SIZE == 2)
- return Vsprintf(reinterpret_cast<char16_t *>(pDestination), reinterpret_cast<const char16_t *>(pFormat), arguments);
- #else
- return Vsprintf(reinterpret_cast<char32_t *>(pDestination), reinterpret_cast<const char32_t *>(pFormat), arguments);
- #endif
- }
- EASTDC_API int Vsnprintf(wchar_t* EA_RESTRICT pDestination, size_t n, const wchar_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if (EA_WCHAR_SIZE == 2)
- return Vsnprintf(reinterpret_cast<char16_t *>(pDestination), n, reinterpret_cast<const char16_t *>(pFormat), arguments);
- #else
- return Vsnprintf(reinterpret_cast<char32_t *>(pDestination), n, reinterpret_cast<const char32_t *>(pFormat), arguments);
- #endif
- }
- EASTDC_API int Vscprintf(const wchar_t* EA_RESTRICT pFormat, va_list arguments)
- {
- #if (EA_WCHAR_SIZE == 2)
- return Vscprintf(reinterpret_cast<const char16_t *>(pFormat), arguments);
- #else
- return Vscprintf(reinterpret_cast<const char32_t *>(pFormat), arguments);
- #endif
- }
- EASTDC_API int Cprintf(WriteFunctionW pWriteFunction, void* EA_RESTRICT pContext, const wchar_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vcprintf(pWriteFunction, pContext, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Fprintf(FILE* EA_RESTRICT pFile, const wchar_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vfprintf(pFile, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Printf(const wchar_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vprintf(pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Sprintf(wchar_t* EA_RESTRICT pDestination, const wchar_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsprintf(pDestination, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- EASTDC_API int Snprintf(wchar_t* EA_RESTRICT pDestination, size_t n, const wchar_t* EA_RESTRICT pFormat, ...)
- {
- va_list arguments;
- va_start(arguments, pFormat);
- int result = Vsnprintf(pDestination, n, pFormat, arguments);
- va_end(arguments);
- return result;
- }
- #endif
- } // namespace StdC
- } // namespace EA
- EA_RESTORE_VC_WARNING()
|