[D3D9][ARPING] Add missing va_start() and va_end() (#371)

This commit is contained in:
Serge Gautherie 2018-02-16 10:28:25 +01:00 committed by Hermès BÉLUSCA - MAÏTO
parent d1265b932c
commit cd4db318d0
2 changed files with 6 additions and 5 deletions

View file

@ -48,6 +48,7 @@ HRESULT SafeFormatString(OUT LPSTR Buffer, IN DWORD BufferSize, IN LPCSTR Format
va_start(vargs, FormatString);
BytesWritten = _vsnprintf(Buffer, BufferSize-1, FormatString, vargs);
va_end(vargs);
if (BytesWritten < BufferSize)
return DDERR_GENERIC;

View file

@ -59,26 +59,26 @@ void FormatOutput(UINT uID, ...)
}
va_start(valist, uID);
DataLength = FormatMessage(FORMAT_MESSAGE_FROM_STRING, Format, 0, 0, Buf,\
sizeof(Buf) / sizeof(WCHAR), &valist);
sizeof(Buf) / sizeof(WCHAR), &valist);
va_end(valist);
if(!DataLength)
{
if(GetLastError() != ERROR_INSUFFICIENT_BUFFER)
{
va_end(valist);
return;
}
va_start(valist, uID);
DataLength = FormatMessage(FORMAT_MESSAGE_FROM_STRING |\
FORMAT_MESSAGE_ALLOCATE_BUFFER,\
Format, 0, 0, (LPWSTR)&pBuf, 0, &valist);
Format, 0, 0, (LPWSTR)&pBuf, 0, &valist);
va_end(valist);
}
if(!DataLength)
{
va_end(valist);
return;
}