diff options
author | Neil <nyamatongwe@gmail.com> | 2023-02-22 13:53:37 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2023-02-22 13:53:37 +1100 |
commit | 353d1f300549f23b7c8c2914fa5d19f5ec6aa48b (patch) | |
tree | f32e1a217ab5696429d3bcedfe95cf19c58b0b14 | |
parent | 56d6a8af344938367c3d01c3969c212b3d3b9427 (diff) | |
download | scintilla-mirror-353d1f300549f23b7c8c2914fa5d19f5ec6aa48b.tar.gz |
Remove _CRT_SECURE_NO_DEPRECATE.
Replace [v]sprintf with bounds checked [v]snprintf.
-rwxr-xr-x | gtk/PlatGTK.cxx | 2 | ||||
-rw-r--r-- | gtk/makefile | 1 | ||||
-rw-r--r-- | qt/ScintillaEdit/ScintillaEdit.pro | 2 | ||||
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 4 | ||||
-rw-r--r-- | qt/ScintillaEditBase/ScintillaEditBase.pro | 2 | ||||
-rw-r--r-- | test/unit/UnitTester.cxx | 2 | ||||
-rw-r--r-- | test/unit/UnitTester.vcxproj | 8 | ||||
-rw-r--r-- | test/unit/makefile | 1 | ||||
-rw-r--r-- | test/unit/unitTest.cxx | 2 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 4 | ||||
-rw-r--r-- | win32/Scintilla.vcxproj | 2 | ||||
-rw-r--r-- | win32/makefile | 1 | ||||
-rw-r--r-- | win32/scintilla.mak | 2 |
13 files changed, 15 insertions, 18 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index e73e4678d..e939b87fb 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -2180,7 +2180,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); Platform::DebugDisplay(buffer); } diff --git a/gtk/makefile b/gtk/makefile index 8643ae317..17816f531 100644 --- a/gtk/makefile +++ b/gtk/makefile @@ -29,7 +29,6 @@ WARNINGS += -Wno-language-extension-token # register may be used in glib # This produces a warning since -Wno-register is not valid for C files but it still works WARNINGS += -Wno-register -DEFINES += -D_CRT_SECURE_NO_DEPRECATE endif # Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for # thread also need to create Position Independent Executable -> search online documentation diff --git a/qt/ScintillaEdit/ScintillaEdit.pro b/qt/ScintillaEdit/ScintillaEdit.pro index ab9f15078..a0d35f03e 100644 --- a/qt/ScintillaEdit/ScintillaEdit.pro +++ b/qt/ScintillaEdit/ScintillaEdit.pro @@ -64,7 +64,7 @@ OTHER_FILES += INCLUDEPATH += ../ScintillaEditBase ../../include ../../src -DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 _CRT_SECURE_NO_DEPRECATE=1 +DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 CONFIG(release, debug|release) { DEFINES += NDEBUG=1 } diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 3a4889ca6..652c7c305 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -1332,7 +1332,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); Platform::DebugDisplay(buffer); } @@ -1345,7 +1345,7 @@ bool Platform::ShowAssertionPopUps(bool /*assertionPopUps*/) noexcept void Platform::Assert(const char *c, const char *file, int line) noexcept { char buffer[2000]; - sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); + snprintf(buffer, std::size(buffer), "Assertion [%s] failed at %s %d", c, file, line); if (Platform::ShowAssertionPopUps(false)) { QMessageBox mb("Assertion Failure", buffer, QMessageBox::NoIcon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); diff --git a/qt/ScintillaEditBase/ScintillaEditBase.pro b/qt/ScintillaEditBase/ScintillaEditBase.pro index 2193094e2..fd7cb27f9 100644 --- a/qt/ScintillaEditBase/ScintillaEditBase.pro +++ b/qt/ScintillaEditBase/ScintillaEditBase.pro @@ -92,7 +92,7 @@ OTHER_FILES += INCLUDEPATH += ../../include ../../src -DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 _CRT_SECURE_NO_DEPRECATE=1 +DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 CONFIG(release, debug|release) { DEFINES += NDEBUG=1 } 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); } diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 0b36c42da..c3157416a 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -3860,7 +3860,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); Platform::DebugDisplay(buffer); } @@ -3879,7 +3879,7 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_) noexcept { void Platform::Assert(const char *c, const char *file, int line) noexcept { char buffer[2000] {}; - sprintf(buffer, "Assertion [%s] failed at %s %d%s", c, file, line, assertionPopUps ? "" : "\r\n"); + snprintf(buffer, std::size(buffer), "Assertion [%s] failed at %s %d%s", c, file, line, assertionPopUps ? "" : "\r\n"); if (assertionPopUps) { const int idButton = ::MessageBoxA(0, buffer, "Assertion failure", MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); diff --git a/win32/Scintilla.vcxproj b/win32/Scintilla.vcxproj index b8c6c4152..130a76ea6 100644 --- a/win32/Scintilla.vcxproj +++ b/win32/Scintilla.vcxproj @@ -84,7 +84,7 @@ <ItemDefinitionGroup>
<ClCompile>
<WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>SCI_EMPTYCATALOGUE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\include;..\src;</AdditionalIncludeDirectories>
<BrowseInformation>true</BrowseInformation>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
diff --git a/win32/makefile b/win32/makefile index c1829a45e..4899c7ab0 100644 --- a/win32/makefile +++ b/win32/makefile @@ -19,7 +19,6 @@ WARNINGS = -Wpedantic -Wall -Wextra ifdef CLANG CXX = clang++ -DEFINES += -D_CRT_SECURE_NO_DEPRECATE else # MinGW GCC LIBSMINGW = -lstdc++ diff --git a/win32/scintilla.mak b/win32/scintilla.mak index f4eb67dcc..19c50ac94 100644 --- a/win32/scintilla.mak +++ b/win32/scintilla.mak @@ -35,7 +35,7 @@ SUBSYSTEM=-SUBSYSTEM:WINDOWS,10.00 !ENDIF !ENDIF -CRTFLAGS=-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 -D_CRT_SECURE_NO_DEPRECATE=1 -D_SCL_SECURE_NO_WARNINGS=1 $(ADD_DEFINE) +CRTFLAGS=$(ADD_DEFINE) CXXFLAGS=-Zi -TP -MP -W4 -EHsc -std:c++17 $(CRTFLAGS) CXXDEBUG=-Od -MTd -DDEBUG CXXNDEBUG=-O2 -MT -DNDEBUG -GL |