Skip to content

Commit 72718dd

Browse files
committed
add function under test/cfg
1 parent 4ff8304 commit 72718dd

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test/cfg/windows.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <wchar.h>
2424
#include <atlstr.h>
2525
#include <string>
26+
#include <locale.h>
2627

2728
bool UpdateTraceACalled(TRACEHANDLE traceHandle, LPCSTR loggerName, EVENT_TRACE_PROPERTIES* pProperties)
2829
{
@@ -1238,3 +1239,17 @@ void constParameterPointer_SetupDiGetDeviceInstanceId(HDEVINFO info, SP_DEVINFO_
12381239
TCHAR buffer[buffer_size];
12391240
SetupDiGetDeviceInstanceId(info, data, buffer, buffer_size, NULL);
12401241
}
1242+
1243+
int invalidPrintfArgType_sprintf_s_l()
1244+
{
1245+
double value = 3.14;
1246+
const size_t buffer_size = 64;
1247+
char buffer[buffer_size];
1248+
int precision = 2;
1249+
// cppcheck-suppress [checkLibraryFunction,valueFlowBailoutIncompleteVar]
1250+
_locale_t locale = _create_locale(LC_ALL, "C");
1251+
_sprintf_s_l(buffer, buffer_size, "%.*f", locale, precision, value);
1252+
// cppcheck-suppress checkLibraryFunction
1253+
_free_locale(locale);
1254+
return 0;
1255+
}

0 commit comments

Comments
 (0)