summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/cfx_bytestring.cpp12
-rw-r--r--core/fxcrt/cfx_widestring.cpp6
-rw-r--r--core/fxcrt/fx_system.h9
3 files changed, 11 insertions, 16 deletions
diff --git a/core/fxcrt/cfx_bytestring.cpp b/core/fxcrt/cfx_bytestring.cpp
index 20497ecc32..073591a5ab 100644
--- a/core/fxcrt/cfx_bytestring.cpp
+++ b/core/fxcrt/cfx_bytestring.cpp
@@ -473,20 +473,22 @@ CFX_ByteString CFX_ByteString::FormatInteger(int i) {
}
void CFX_ByteString::FormatV(const char* pFormat, va_list argList) {
- va_list argListSave;
- FX_VA_COPY(argListSave, argList);
- FX_STRSIZE nMaxLen = vsnprintf(nullptr, 0, pFormat, argList);
+ va_list argListCopy;
+ va_copy(argListCopy, argList);
+ FX_STRSIZE nMaxLen = vsnprintf(nullptr, 0, pFormat, argListCopy);
+ va_end(argListCopy);
if (nMaxLen > 0) {
GetBuffer(nMaxLen);
if (m_pData) {
// In the following two calls, there's always space in the buffer for
// a terminating NUL that's not included in nMaxLen.
memset(m_pData->m_String, 0, nMaxLen + 1);
- vsnprintf(m_pData->m_String, nMaxLen + 1, pFormat, argListSave);
+ va_copy(argListCopy, argList);
+ vsnprintf(m_pData->m_String, nMaxLen + 1, pFormat, argListCopy);
+ va_end(argListCopy);
ReleaseBuffer(GetStringLength());
}
}
- va_end(argListSave);
}
void CFX_ByteString::Format(const char* pFormat, ...) {
diff --git a/core/fxcrt/cfx_widestring.cpp b/core/fxcrt/cfx_widestring.cpp
index 24b7fb59d3..aadd1a29ed 100644
--- a/core/fxcrt/cfx_widestring.cpp
+++ b/core/fxcrt/cfx_widestring.cpp
@@ -665,17 +665,19 @@ bool CFX_WideString::TryVSWPrintf(FX_STRSIZE size,
void CFX_WideString::FormatV(const wchar_t* format, va_list argList) {
va_list argListCopy;
- FX_VA_COPY(argListCopy, argList);
+ va_copy(argListCopy, argList);
int maxLen = vswprintf(nullptr, 0, format, argListCopy);
va_end(argListCopy);
if (maxLen <= 0) {
+ va_copy(argListCopy, argList);
auto guess = GuessSizeForVSWPrintf(format, argListCopy);
+ va_end(argListCopy);
if (!guess.has_value())
return;
maxLen = pdfium::base::checked_cast<int>(guess.value());
}
while (maxLen < 32 * 1024) {
- FX_VA_COPY(argListCopy, argList);
+ va_copy(argListCopy, argList);
bool bSufficientBuffer =
TryVSWPrintf(static_cast<FX_STRSIZE>(maxLen), format, argListCopy);
va_end(argListCopy);
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index 600d71c72b..7a95bf4fd0 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -263,13 +263,4 @@ int FXSYS_round(float f);
#define NEVER_INLINE __attribute__((__noinline__))
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-// Handle differnces between platform's variadic function implementations.
-#if defined(__ARMCC_VERSION) || \
- (!defined(_MSC_VER) && (_FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ || \
- _FX_CPU_ == _FX_ARM64_))
-#define FX_VA_COPY(dst, src) va_copy((dst), (src))
-#else
-#define FX_VA_COPY(dst, src) ((dst) = (src))
-#endif
-
#endif // CORE_FXCRT_FX_SYSTEM_H_