From: Geoff Norton Date: Sat, 14 Feb 2015 19:07:24 +0000 (-0800) Subject: Remove PAL_printf_arg_remover - what its doing is against the standards, and breaks... X-Git-Tag: accepted/tizen/base/20180629.140029~7087^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e0bfb371f58a5ebd08987501e58d6bd135df286;p=platform%2Fupstream%2Fcoreclr.git Remove PAL_printf_arg_remover - what its doing is against the standards, and breaks on some platforms --- diff --git a/src/pal/src/cruntime/printf.cpp b/src/pal/src/cruntime/printf.cpp index aed5904..2c09304 100644 --- a/src/pal/src/cruntime/printf.cpp +++ b/src/pal/src/cruntime/printf.cpp @@ -124,42 +124,6 @@ BOOL Internal_AddPaddingA(LPSTR *Out, INT Count, LPSTR In, } -/******************************************************************************* -Function: - PAL_printf_arg_remover - -Parameters: - ap - - pointer to the va_list from which to remove arguments - Precision - - the precision of the current format option - Type - - the type of the argument for the current format option - Prefix - - the prefix for the current format option -*******************************************************************************/ -void PAL_printf_arg_remover(va_list *ap, INT Precision, INT Type, INT Prefix) -{ - /* remove arg and precision if needed */ - if (PRECISION_STAR == Precision || - PRECISION_INVALID == Precision) - { - (void)va_arg(*ap, LONG); - } - if (Type == PFF_TYPE_FLOAT) - { - (void)va_arg(*ap, double); - } - else if (Type == PFF_TYPE_INT && Prefix == PFF_PREFIX_LONGLONG) - { - (void)va_arg(*ap, INT64); - } - else - { - (void)va_arg(*ap, LONG); - } -} - /*++ Function: PAL_printf diff --git a/src/pal/src/cruntime/printfcpp.cpp b/src/pal/src/cruntime/printfcpp.cpp index d9e3929..cb92f05 100644 --- a/src/pal/src/cruntime/printfcpp.cpp +++ b/src/pal/src/cruntime/printfcpp.cpp @@ -1377,7 +1377,10 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for } else { - TempInt = NativeVsnprintf(pthrCurrent, TempSprintfStr, TEMP_COUNT, TempBuff, ap); + va_list apcopy; + + va_copy(apcopy, ap); + TempInt = NativeVsnprintf(pthrCurrent, TempSprintfStr, TEMP_COUNT, TempBuff, apcopy); if (TempInt < 0 || static_cast(TempInt) >= TEMP_COUNT) { @@ -1391,10 +1394,13 @@ int CoreVfwprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const wchar_16 *for } TempSprintfStr = TempSprintfStrPtr; - NativeVsnprintf(pthrCurrent, TempSprintfStr, TempInt, TempBuff, ap); + va_end(apcopy); + va_copy(apcopy, ap); + NativeVsnprintf(pthrCurrent, TempSprintfStr, TempInt, TempBuff, apcopy); } - PAL_printf_arg_remover((va_list *)&ap, Precision, Type, Prefix); + va_copy(ap, apcopy); + va_end(apcopy); } mbtowcResult = MultiByteToWideChar(CP_ACP, 0, @@ -1706,7 +1712,6 @@ int CoreVsnprintf(CPalThread *pthrCurrent, LPSTR Buffer, size_t Count, LPCSTR Fo else { TempInt = NativeVsnprintf(pthrCurrent, BufferPtr, TempCount, TempBuff, ap); - PAL_printf_arg_remover((va_list *)&ap, Precision, Type, Prefix); } if (TempInt < 0 || static_cast(TempInt) >= TempCount) /* buffer not long enough */ @@ -1969,7 +1974,6 @@ int CoreWvsnprintf(CPalThread *pthrCurrent, LPWSTR Buffer, size_t Count, LPCWSTR else { TempInt = NativeVsnprintf(pthrCurrent, (LPSTR) BufferPtr, TempCount, TempBuff, ap); - PAL_printf_arg_remover((va_list *)&ap, Precision, Type, Prefix); } if (TempInt == 0) @@ -2305,7 +2309,6 @@ int CoreVfprintf(CPalThread *pthrCurrent, PAL_FILE *stream, const char *format, else { TempInt = NativeVfprintf(pthrCurrent, stream->bsdFilePtr, TempBuff, ap); - PAL_printf_arg_remover((va_list *)&ap, Precision, Type, Prefix); } if (-1 == TempInt) diff --git a/src/pal/src/cruntime/silent_printf.cpp b/src/pal/src/cruntime/silent_printf.cpp index 440e50d..f818da1 100644 --- a/src/pal/src/cruntime/silent_printf.cpp +++ b/src/pal/src/cruntime/silent_printf.cpp @@ -209,7 +209,6 @@ INT Silent_PAL_vsnprintf(LPSTR Buffer, INT Count, LPCSTR Format, va_list ap) } TempInt = PAL__vsnprintf(BufferPtr, TempCount, TempBuff, ap); - PAL_printf_arg_remover((va_list *)&ap, Precision, Type, Prefix); } if (TempInt < 0 || static_cast(TempInt) >= TempCount) /* buffer not long enough */ @@ -407,7 +406,6 @@ int Silent_PAL_vfprintf(PAL_FILE *stream, const char *format, va_list ap) else { TempInt = PAL_vfprintf(stream, TempBuff, ap); - PAL_printf_arg_remover((va_list *)&ap, Precision, Type, Prefix); } if (-1 != TempInt) diff --git a/src/pal/src/include/pal/cruntime.h b/src/pal/src/include/pal/cruntime.h index 8b56b12..eb0f9f0 100644 --- a/src/pal/src/include/pal/cruntime.h +++ b/src/pal/src/include/pal/cruntime.h @@ -104,22 +104,6 @@ Parameters: *******************************************************************************/ BOOL Internal_AddPaddingA(LPSTR *Out, INT Count, LPSTR In, INT Padding, INT Flags); -/******************************************************************************* -Function: - PAL_printf_arg_remover - -Parameters: - ap - - pointer to the va_list from which to remove arguments - Precision - - the precision of the current format option - Type - - the type of the argument for the current format option - Prefix - - the prefix for the current format option -*******************************************************************************/ -void PAL_printf_arg_remover(va_list *ap, INT Precision, INT Type, INT Prefix); - /*++ Function: Silent_PAL_vsnprintf