aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unit
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2023-02-22 13:53:37 +1100
committerNeil <nyamatongwe@gmail.com>2023-02-22 13:53:37 +1100
commit353d1f300549f23b7c8c2914fa5d19f5ec6aa48b (patch)
treef32e1a217ab5696429d3bcedfe95cf19c58b0b14 /test/unit
parent56d6a8af344938367c3d01c3969c212b3d3b9427 (diff)
downloadscintilla-mirror-353d1f300549f23b7c8c2914fa5d19f5ec6aa48b.tar.gz
Remove _CRT_SECURE_NO_DEPRECATE.
Replace [v]sprintf with bounds checked [v]snprintf.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/UnitTester.cxx2
-rw-r--r--test/unit/UnitTester.vcxproj8
-rw-r--r--test/unit/makefile1
-rw-r--r--test/unit/unitTest.cxx2
4 files changed, 6 insertions, 7 deletions
diff --git a/test/unit/UnitTester.cxx b/test/unit/UnitTester.cxx
index e498add10..6382b428b 100644
--- a/test/unit/UnitTester.cxx
+++ b/test/unit/UnitTester.cxx
@@ -33,7 +33,7 @@ void Platform::DebugPrintf(const char *format, ...) noexcept {
char buffer[2000];
va_list pArguments;
va_start(pArguments, format);
- vsprintf(buffer, format, pArguments);
+ vsnprintf(buffer, std::size(buffer), format, pArguments);
va_end(pArguments);
fprintf(stderr, "%s", buffer);
}
diff --git a/test/unit/UnitTester.vcxproj b/test/unit/UnitTester.vcxproj
index 38b0eb7cc..a7df099c0 100644
--- a/test/unit/UnitTester.vcxproj
+++ b/test/unit/UnitTester.vcxproj
@@ -89,7 +89,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS=1;_HAS_AUTO_PTR_ETC=1;_SCL_SECURE_NO_WARNINGS=1;CHECK_CORRECTNESS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>CHECK_CORRECTNESS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\;..\..\src\;..\..\lexlib\</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
@@ -104,7 +104,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS=1;_HAS_AUTO_PTR_ETC=1;_SCL_SECURE_NO_WARNINGS=1;CHECK_CORRECTNESS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>CHECK_CORRECTNESS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\;..\..\src\;..\..\lexlib\</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
@@ -121,7 +121,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS=1;_HAS_AUTO_PTR_ETC=1;_SCL_SECURE_NO_WARNINGS=1;CHECK_CORRECTNESS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>CHECK_CORRECTNESS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\;..\..\src\;..\..\lexlib\</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
@@ -140,7 +140,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS=1;_HAS_AUTO_PTR_ETC=1;_SCL_SECURE_NO_WARNINGS=1;CHECK_CORRECTNESS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>CHECK_CORRECTNESS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include\;..\..\src\;..\..\lexlib\</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
diff --git a/test/unit/makefile b/test/unit/makefile
index 46747931f..9926b6f97 100644
--- a/test/unit/makefile
+++ b/test/unit/makefile
@@ -20,7 +20,6 @@ CXXFLAGS += --std=$(CXXSTD)
ifdef CLANG
CXX = clang++
-CXXFLAGS += -D_CRT_SECURE_NO_DEPRECATE
ifdef USELIBCPP
# macOS, use libc++ but don't have sanitizers
CXXFLAGS += --stdlib=libc++
diff --git a/test/unit/unitTest.cxx b/test/unit/unitTest.cxx
index c629b6b5d..7e85bb441 100644
--- a/test/unit/unitTest.cxx
+++ b/test/unit/unitTest.cxx
@@ -69,7 +69,7 @@ void Platform::DebugPrintf(const char *format, ...) noexcept {
char buffer[2000];
va_list pArguments;
va_start(pArguments, format);
- vsprintf(buffer, format, pArguments);
+ vsnprintf(buffer, std::size(buffer), format, pArguments);
va_end(pArguments);
fprintf(stderr, "%s", buffer);
}