Reactos
at master 31 lines 716 B view raw
1// 2// OutputDebugStringA.cpp 3// 4// Copyright (c) Microsoft Corporation. All rights reserved. 5// 6// Definition of __acrt_OutputDebugStringA. 7// 8 9#include <corecrt_internal_win32_buffer.h> 10 11void WINAPI __acrt_OutputDebugStringA( 12 LPCSTR const text 13 ) 14{ 15 if (text == nullptr) 16 { 17 return; 18 } 19 size_t const text_size = strlen(text) + 1; 20 if (text_size == 0) 21 { 22 return; 23 } 24 // Use alloca instead of heap, since this code is executed during asserts 25 auto text_wide = (wchar_t*)_alloca(text_size * sizeof(wchar_t)); 26 size_t converted; 27 if (mbstowcs_s(&converted, text_wide, text_size, text, text_size - 1) == 0) 28 { 29 OutputDebugStringW(text_wide); 30 } 31}