Skip to content

Commit 4a91d79

Browse files
authored
Remove _CRT_SECURE_NO_WARNINGS macro usage in example code, fix any errors arising from disabling this. (#1265)
1 parent 0ff7816 commit 4a91d79

File tree

6 files changed

+3
-13
lines changed

6 files changed

+3
-13
lines changed

examples/c/SampleC-Guest/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define _CRT_SECURE_NO_WARNINGS
2-
31
#include <memory>
42
#include <chrono>
53
#include <thread>

examples/cpp/SampleCpp/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// #define _CRTDBG_MAP_ALLOC
2-
#define _CRT_SECURE_NO_WARNINGS
32
//#include <stdlib.h>
43
//#include <crtdbg.h>
54

examples/cpp/SampleCppMini/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define _CRT_SECURE_NO_WARNINGS
2-
31
#define API_KEY "99999999999999999999999999999999-99999999-9999-9999-9999-999999999999-9999"
42

53
#include <cstdio>

examples/cpp/SampleCppUWP/Main.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#define _CRT_SECURE_NO_WARNINGS
2-
3-
#include <stdlib.h>
1+
#include <stdlib.h>
42
#include <stdio.h>
53

64
#include "LogManager.hpp"
@@ -44,7 +42,7 @@ void DebugPrintf(const char *fmt, ...)
4442
va_start(args, fmt);
4543
int nBuf;
4644
char szBuffer[512];
47-
nBuf = _vsnprintf(szBuffer, 511, fmt, args);
45+
nBuf = _vsnprintf_s(szBuffer, 511, fmt, args);
4846
// ::OutputDebugStringA(szBuffer);
4947
PrintLine(szBuffer);
5048
va_end(args);
@@ -231,7 +229,6 @@ EventProperties CreateSampleEvent(const char *name, EventPriority prio) {
231229

232230
// Prepare current time in UTC (seconds precision)
233231
std::time_t t = std::time(nullptr);
234-
std::gmtime(&t);
235232

236233
/* С++11 constructor for Visual Studio 2015: this is the most JSON-lookalike syntax that makes use of C++11 initializer lists. */
237234
EventProperties props(name,

examples/cpp/SampleCppUWP/TelemetryInstance.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define _CRT_SECURE_NO_WARNINGS
2-
31
#include "pch.h"
42

53
#include "LogManager.hpp"

examples/cpp/SampleCppUWP/Utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static void DebugPrintf(const char *fmt, ...)
1111
va_list args;
1212
va_start(args, fmt);
1313
int nBuf;
14-
nBuf = _vsnprintf(szBuffer, MAX_BUFF_SIZE-1, fmt, args);
14+
nBuf = _vsnprintf_s(szBuffer, MAX_BUFF_SIZE-1, fmt, args);
1515
::OutputDebugStringA(szBuffer);
1616
::OutputDebugStringA("\n"); // eppend endl
1717
va_end(args);

0 commit comments

Comments
 (0)