From dbef8cea91bc6032674557db388461f8a6a1d198 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 1 Jul 2024 21:02:27 +0200 Subject: [PATCH] Solve compiling error & fix a regression of "new #" The regression is introduced by: https://github.com/notepad-plus-plus/notepad-plus-plus/commit/f7d9e7c095e7da50633414b148703afd785c27f8#diff-2d5c277be2799a7e43a90232d8ef9add2e788e252c8692bf9416abc69836957d --- PowerEditor/src/MISC/sha1/sha1.h | 14 ++++++++++++++ PowerEditor/src/ScintillaComponent/Buffer.cpp | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/MISC/sha1/sha1.h b/PowerEditor/src/MISC/sha1/sha1.h index ee9f7d75c..718bbc2a5 100644 --- a/PowerEditor/src/MISC/sha1/sha1.h +++ b/PowerEditor/src/MISC/sha1/sha1.h @@ -153,6 +153,20 @@ #ifdef _MSC_VER #include #else +#ifndef TCHAR +#define TCHAR char +#endif +#ifndef _T +#define _T(__x) (__x) +#define _tmain main +#define _tprintf printf +#define _getts gets +#define _tcslen strlen +#define _tfopen fopen +#define _tcscpy strcpy +#define _tcscat strcat +#define _sntprintf snprintf +#endif #endif #endif diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index 78c81eed7..c7448cd0b 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -1353,7 +1353,7 @@ BufferID FileManager::newEmptyDocument() wstring newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR); wchar_t nb[10]; - wsprintf(nb, L"%d"), static_cast(nextUntitledNewNumber()); + wsprintf(nb, L"%d", static_cast(nextUntitledNewNumber())); newTitle += nb; Document doc = static_cast(_pscratchTilla->execute(SCI_CREATEDOCUMENT, 0, SC_DOCUMENTOPTION_TEXT_LARGE)); // this already sets a reference for filemanager