Merge pull request #5016 from RaiKoHoff/Dev_Master

Some refactoring regarding string comparison
This commit is contained in:
Pairi Daiza 2023-09-26 14:08:36 +02:00 committed by GitHub
commit 61a427d6cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 100 additions and 94 deletions

View File

@ -1,6 +1,6 @@
// File to suppress cppcheck warnings for files that will not be fixed.
// Does not suppress warnings where an additional occurrence of the warning may be of interest.
// Configured for cppcheck 2.11
// Configured for cppcheck 2.12
// Coding style is to use assignments in constructor when there are many
// members to initialize or the initialization is complex or has comments.
@ -35,8 +35,8 @@ checkLevelNormal:lexilla/lexers/LexHTML.cxx
checkLevelNormal:lexilla/lexers/LexPerl.cxx
checkLevelNormal:lexilla/lexers/LexRuby.cxx
// Cppcheck wrongly assumes string_view::remove_prefix can not empty the view
knownConditionTrueFalse:lexilla/test/TestLexers.cxx
// Physically but not logically const.
constVariablePointer:lexilla/examples/CheckLexilla/CheckLexilla.c
// Suppress most lexer warnings since the lexers are maintained by others
redundantCondition:lexilla/lexers/LexA68k.cxx
@ -62,13 +62,14 @@ constParameterPointer:lexilla/lexers/LexCoffeeScript.cxx
knownConditionTrueFalse:lexilla/lexers/LexCoffeeScript.cxx
constParameterReference:lexilla/lexers/LexCPP.cxx
variableScope:lexilla/lexers/LexCSS.cxx
knownConditionTrueFalse:lexilla/lexers/LexDataflex.cxx
variableScope:lexilla/lexers/LexDataflex.cxx
knownConditionTrueFalse:lexilla/lexers/LexECL.cxx
variableScope:lexilla/lexers/LexECL.cxx
constParameter:lexilla/lexers/LexEDIFACT.cxx
constParameterPointer:lexilla/lexers/LexEDIFACT.cxx
knownConditionTrueFalse:lexilla/lexers/LexEiffel.cxx
variableScope:lexilla/lexers/LexErlang.cxx
knownConditionTrueFalse:lexilla/lexers/LexErrorList.cxx
knownConditionTrueFalse:lexilla/lexers/LexEScript.cxx
constParameter:lexilla/lexers/LexFortran.cxx
constParameterReference:lexilla/lexers/LexFortran.cxx
@ -82,14 +83,17 @@ knownConditionTrueFalse:lexilla/lexers/LexHex.cxx
constParameterReference:lexilla/lexers/LexHTML.cxx
constVariable:lexilla/lexers/LexHollywood.cxx
variableScope:lexilla/lexers/LexInno.cxx
constParameterPointer:lexilla/lexers/LexJulia.cxx
constParameterReference:lexilla/lexers/LexJulia.cxx
knownConditionTrueFalse:lexilla/lexers/LexJulia.cxx
unreadVariable:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexJulia.cxx
variableScope:lexilla/lexers/LexLaTeX.cxx
constParameterReference:lexilla/lexers/LexLaTeX.cxx
constParameterPointer:lexilla/lexers/LexMagik.cxx
constParameterReference:lexilla/lexers/LexMagik.cxx
constParameterReference:lexilla/lexers/LexMarkdown.cxx
constParameterPointer:lexilla/lexers/LexMatlab.cxx
constParameterReference:lexilla/lexers/LexMatlab.cxx
unreadVariable:lexilla/lexers/LexMatlab.cxx
variableScope:lexilla/lexers/LexMatlab.cxx
@ -128,9 +132,7 @@ constParameterReference:lexilla/lexers/LexSTTXT.cxx
knownConditionTrueFalse:lexilla/lexers/LexTACL.cxx
clarifyCalculation:lexilla/lexers/LexTADS3.cxx
constParameterReference:lexilla/lexers/LexTADS3.cxx
unreadVariable:lexilla/lexers/LexTCL.cxx
invalidscanf:lexilla/lexers/LexTCMD.cxx
constParameterPointer:lexilla/lexers/LexTCMD.cxx
constParameterReference:lexilla/lexers/LexTeX.cxx
variableScope:lexilla/lexers/LexTeX.cxx
knownConditionTrueFalse:lexilla/lexers/LexTxt2tags.cxx
@ -166,7 +168,6 @@ constParameterCallback:lexilla/lexers/LexVB.cxx
constVariableReference:lexilla/lexers/LexCSS.cxx
constVariableReference:lexilla/lexers/LexCrontab.cxx
constVariableReference:lexilla/lexers/LexGui4Cli.cxx
constVariableReference:lexilla/lexers/LexKix.cxx
constVariableReference:lexilla/lexers/LexMetapost.cxx
constVariableReference:lexilla/lexers/LexOpal.cxx
@ -179,5 +180,8 @@ constVariableReference:lexilla/lexers/LexOpal.cxx
*:lexilla/test/unit/UnitTester.cxx
*:lexilla/test/unit/unitTest.cxx
// Tests often test things that are always true
knownConditionTrueFalse:lexilla/test/unit/testCharacterSet.cxx
// cppcheck fails REQUIRE from Catch
comparisonOfFuncReturningBoolError:lexilla/test/unit/*.cxx

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20230726" />
<meta name="Date.Modified" content="20230922" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -61,8 +61,8 @@
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.2.6<br />
Site last modified July 26 2023</font>
<font color="#FFCC99" size="3">Release version 5.2.7<br />
Site last modified September 22 2023</font>
</td>
<td width="20%">
&nbsp;
@ -77,11 +77,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.2.7 improves Bash, F#, and HTML.</li>
<li>Version 5.2.6 improves Bash, Errorlist, HTML, Matlab, and Visual Prolog.</li>
<li>Version 5.2.5 improves Bash, Batch, F#, and VB.</li>
<li>Version 5.2.4 improves C++ and GDScript.</li>
<li>Version 5.2.3 improves Makefile, Ruby, and YAML.</li>
<li>Version 5.2.2 improves C++, Matlab, Modula-3, Python, and X12.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/lexilla526.zip">
<font size="4"> <a href="https://www.scintilla.org/lexilla527.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla526.tgz">
<a href="https://www.scintilla.org/lexilla527.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.2.6
Release 5.2.7
</h3>
<h4>
Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Lexilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/lexilla526.zip">zip format</a> (1.2M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla526.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/lexilla527.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla527.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>

View File

@ -586,12 +586,25 @@
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla528.zip">Release 5.2.8</a>
</h3>
<ul>
<li>
Released 22 September 2023.
</li>
<li>
R: Fix escape sequence highlighting with change of for loop to while loop.
<a href="https://github.com/ScintillaOrg/lexilla/issues/206">Issue #206</a>,
<a href="https://github.com/ScintillaOrg/lexilla/pull/207">Pull request #207</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla527.zip">Release 5.2.7</a>
</h3>
<ul>
<li>
Released 26 July 2023.
Released 22 September 2023.
</li>
<li>
Fix building on Windows with non-English environment.

View File

@ -124,7 +124,7 @@ void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, W
dashCount = lineState >> 8;
}
for (; sc.More(); sc.Forward()) {
while (sc.More()) {
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_R_OPERATOR:
@ -272,6 +272,7 @@ void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, W
const int lineState = matchingDelimiter | (dashCount << 8);
styler.SetLineState(sc.currentLine, lineState);
}
sc.Forward();
}
sc.Complete();
}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>5.2.6</string>
<string>5.2.7</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>

View File

@ -877,7 +877,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.2.6;
CURRENT_PROJECT_VERSION = 5.2.7;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -904,7 +904,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.2.6;
CURRENT_PROJECT_VERSION = 5.2.7;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;

View File

@ -4,8 +4,8 @@
#include <windows.h>
#define VERSION_LEXILLA "5.2.6"
#define VERSION_WORDS 5, 2, 6, 0
#define VERSION_LEXILLA "5.2.7"
#define VERSION_WORDS 5, 2, 7, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -1 +1 @@
526
527

View File

@ -24,11 +24,15 @@ checkLevelNormal:scintilla/src/Editor.cxx
// Redundant code: Found unused cast of expression 'leadByte'
constStatement:scintilla/src/Document.cxx
// ILexer5* is not pointing at logically const
constParameterPointer:scintilla/src/Document.cxx
// Some non-explicit constructors are used for conversions or are private to lexers
noExplicitConstructor
// MarginView access to all bits is safe and is better defined in later versions of C++
shiftTooManyBitsSigned:scintilla/src/MarginView.cxx
integerOverflow:scintilla/src/MarginView.cxx
// DLL entry points are unused inside Scintilla
unusedFunction:scintilla/win32/ScintillaDLL.cxx
@ -50,9 +54,6 @@ knownConditionTrueFalse:scintilla/src/EditView.cxx
arithOperationsOnVoidPointer:scintilla/src/PerLine.cxx
arithOperationsOnVoidPointer:scintilla/src/PositionCache.cxx
// Cppcheck wrongly assumes string_view::remove_prefix can not empty the view
knownConditionTrueFalse:scintilla/src/CallTip.cxx
// G_DEFINE_TYPE is too complex to pass to cppcheck
unknownMacro:scintilla/gtk/PlatGTK.cxx

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/scintilla536.zip">
<font size="4"> <a href="https://www.scintilla.org/scintilla537.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/scintilla536.tgz">
<a href="https://www.scintilla.org/scintilla537.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.3.6
Release 5.3.7
</h3>
<h4>
Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/scintilla536.zip">zip format</a> (1.4M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla536.tgz">tgz format</a> (1.3M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/scintilla537.zip">zip format</a> (1.7M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla537.tgz">tgz format</a> (1.6M) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>

View File

@ -588,7 +588,7 @@
</h3>
<ul>
<li>
Released 26 July 2023.
Released 22 September 2023.
</li>
<li>
For GTK on macOS, fix popup window behaviour by setting type hints.

View File

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20230726" />
<meta name="Date.Modified" content="20230922" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -60,8 +60,8 @@
GTK, and macOS</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 5.3.6<br />
Site last modified July 26 2023</font>
<font color="#FFCC99" size="3"> Release version 5.3.7<br />
Site last modified September 22 2023</font>
</td>
<td width="20%">
&nbsp;
@ -76,11 +76,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.3.7 fixes platform-specific issues on GTK, Qt, and Win32.</li>
<li>Version 5.3.6 improves cursor behaviour on Win32 and IME support on Win32 and Qt.</li>
<li>Version 5.3.5 improves IME support on Win32 and Qt.</li>
<li>Version 5.3.4 adds multithreaded wrapping.</li>
<li>Version 5.3.3 fixes minor bugs in APIs and platform layers.</li>
<li>Version 5.3.2 adds SCI_REPLACETARGETMINIMAL to modify text without marking unchanged start and end text in change history.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -10,8 +10,8 @@ pushd %_THISDIR_%
rem set _PYTHON_EXE=c:\PortablePrograms\Python396_x64_emb\python.exe
call :RESOLVE_PATH _PYTHON_EXE "%_THISDIR_%..\..\..\..\_python_emb\python.exe"
rem call :RESOLVE_PATH _PYTHON_EXE "%_THISDIR_%..\..\..\..\_python_emb\python.exe"
set _PYTHON_EXE=python.exe
::set _CMD_="%_PYTHON_EXE%" -I -S -m "%~dpn0"
set _CMD_="%_PYTHON_EXE%" -I -S "%~dpn0.py"

View File

@ -10,8 +10,8 @@ pushd %_THISDIR_%
rem set _PYTHON_EXE=c:\PortablePrograms\Python396_x64_emb\python.exe
call :RESOLVE_PATH _PYTHON_EXE "%_THISDIR_%..\..\..\..\_python_emb\python.exe"
rem call :RESOLVE_PATH _PYTHON_EXE "%_THISDIR_%..\..\..\..\_python_emb\python.exe"
set _PYTHON_EXE=python.exe
::set _CMD_="%_PYTHON_EXE%" -I -S -m "%~dpn0"
set _CMD_="%_PYTHON_EXE%" -I -S "%~dpn0.py"

View File

@ -439,7 +439,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void Cut();
void PasteRectangular(SelectionPosition pos, const char *ptr, Sci::Position len);
virtual void Copy() = 0;
virtual void CopyAllowLine();
void CopyAllowLine();
virtual bool CanPaste();
virtual void Paste() = 0;
void Clear();
@ -452,7 +452,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void NotifyChange() = 0;
virtual void NotifyFocus(bool focus);
virtual void SetCtrlID(int identifier);
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
virtual int GetCtrlID() const noexcept { return ctrlID; }
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
virtual void NotifyParent(Scintilla::NotificationData scn) = 0;
virtual void NotifyStyleToNeeded(Sci::Position endStyleNeeded);
void NotifyChar(int ch, Scintilla::CharacterSource charSource);
@ -521,7 +523,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
void CopyText(size_t length, const char *text);
void SetDragPosition(SelectionPosition newPos);
virtual void DisplayCursor(Window::Cursor c);
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
virtual bool DragThreshold(Point ptStart, Point ptNow) noexcept;
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
virtual void StartDrag();
void DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular);
void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular);
@ -564,9 +568,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void IdleWork();
virtual void QueueIdleWork(WorkItems items, Sci::Position upTo=0);
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
virtual int SupportsFeature(Scintilla::Supports feature) const noexcept;
virtual bool PaintContains(PRectangle rc) const noexcept;
bool PaintContainsMargin() const noexcept;
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
void CheckForChangeOutsidePaint(Range r);
void SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int matchStyle);
@ -706,7 +712,7 @@ public:
surf(ed->CreateMeasurementSurface()) {
}
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
AutoSurface(SurfaceID sid, Editor *ed, std::optional<Scintilla::Technology> technology = {}, bool printing = false) :
AutoSurface(SurfaceID sid, const Editor *ed, std::optional<Scintilla::Technology> technology = {}, bool printing = false) :
surf(ed->CreateDrawingSurface(sid, technology, printing)) {
}
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

View File

@ -1 +1 @@
536
537

View File

@ -6,8 +6,8 @@
#include <windows.h>
#define VERSION_SCINTILLA "5.3.6"
#define VERSION_WORDS 5, 3, 6, 0
#define VERSION_SCINTILLA "5.3.7"
#define VERSION_WORDS 5, 3, 7, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -401,7 +401,7 @@ static inline void popCheckStackHead(LPCSTR fctname)
UNREFERENCED_PARAMETER(fctname); // NDEBUG mode
iniOpen_t* pOpenBy = NULL;
STACK_POP(s_pOpenStackHead, pOpenBy);
assert(StringCchCompareXA(fctname, pOpenBy->fctname) == 0);
assert(StrCmpA(fctname, pOpenBy->fctname) == 0);
FreeMem(pOpenBy);
}
@ -589,12 +589,10 @@ extern "C" bool IniSectionClear(LPCWSTR lpSectionName, bool bRemoveEmpty)
extern "C" bool IniClearAllSections(LPCWSTR lpPrefix, bool bRemoveEmpty)
{
size_t const len = StringCchLen(lpPrefix, 0);
CSimpleIni::TNamesDepend Sections;
s_INI.GetAllSections(Sections);
for (const auto& section : Sections) {
if (StringCchCompareNI(section.pItem, len, lpPrefix, len) == 0) {
if (StrCmpIW(section.pItem, lpPrefix) == 0) {
IniSectionClear(section.pItem, bRemoveEmpty);
}
}

View File

@ -3797,8 +3797,8 @@ void EditToggleLineCommentsSimple(LPCWSTR pwszComment, bool bInsertAtStart, LnCm
}
const char* tchBuf = SciCall_GetRangePointer(iIndentPos, cchComment + 1);
bool const bHasLnCmnt = (StrCmpNA(tchBuf, mszComment, (int)cchComment) == 0);
bool const bHasPrefix = (StrCmpNA(tchBuf, mszPrefix, (int)cchPrefix) == 0);
bool const bHasLnCmnt = IsSameCharSequence(tchBuf, mszComment, cchComment);
bool const bHasPrefix = IsSameCharSequence(tchBuf, mszPrefix, (int)cchPrefix);
int iAction = (mode == LNC_TOGGLE) ? ((bHasLnCmnt || bHasPrefix) ? LNC_REMOVE : LNC_ADD) : mode;
switch (iAction) {
@ -3918,7 +3918,7 @@ void EditToggleLineCommentsExtended(LPCWSTR pwszComment, bool bInsertAtStart)
}
const char* tchBuf = SciCall_GetRangePointer(iIndentPos, cchComment + 1);
if (StrCmpNIA(tchBuf, mszComment, (int)cchComment) == 0) {
if (IsSameCharSequence(tchBuf, mszComment, cchComment)) {
// remove comment chars
DocPos const iSelPos = iIndentPos + cchComment;
switch (iAction) {
@ -4615,9 +4615,8 @@ void EditRemoveDuplicateLines(HWND hwnd, bool bRemoveEmptyLines)
if (bRemoveEmptyLines || (iCmpLnLen > 0)) {
DocPos const iBegCmpLine = SciCall_PositionFromLine(iCompareLine);
const char* const pCompareLine = SciCall_GetRangePointer(iBegCmpLine, iCmpLnLen + 1);
if (iCurLnLen == iCmpLnLen) {
if (StringCchCompareNA(pCurrentLine, iCurLnLen, pCompareLine, iCmpLnLen) == 0) {
if (IsSameCharSequence(pCurrentLine, pCompareLine, iCmpLnLen)) {
SciCall_SetTargetRange(SciCall_GetLineEndPosition(iPrevLine), SciCall_GetLineEndPosition(iCompareLine));
SciCall_ReplaceTarget(0, "");
--iCompareLine; // proactive preventing progress to avoid comparison line skip
@ -5879,7 +5878,7 @@ static LPCWSTR _EditGetFindStrg(HWND hwnd, const LPEDITFINDREPLACE lpefr, bool b
static char* _GetReplaceString(HWND hwnd, CLPCEDITFINDREPLACE lpefr, int* iReplaceMsg)
{
char* pszReplace = NULL; // replace text of arbitrary size
if (Settings.ReplaceByClipboardTag && (StringCchCompareXW(StrgGet(lpefr->chReplaceTemplate), L"^c")) == 0)
if (Settings.ReplaceByClipboardTag && (StrCmpW(StrgGet(lpefr->chReplaceTemplate), L"^c")) == 0)
{
*iReplaceMsg = SciCall_GetChangeHistory() ? SCI_REPLACETARGETMINIMAL : SCI_REPLACETARGET;
pszReplace = EditGetClipboardText(hwnd, true, NULL, NULL);
@ -7878,11 +7877,11 @@ typedef struct WLIST {
static int wordcmp(PWLIST a, PWLIST b) {
return StringCchCompareXA(a->word, b->word);
return StrCmpA(a->word, b->word);
}
static int wordcmpi(PWLIST a, PWLIST b) {
return StringCchCompareXIA(a->word, b->word);
return StrCmpIA(a->word, b->word);
}
// ----------------------------------------------
@ -8069,7 +8068,7 @@ bool EditAutoCompleteWord(HWND hwnd, bool autoInsert)
if (iNumWords) {
//if ((iNumWords == 1) && (StringCchCompareXIA(pRoot, pListHead->word) == 0)) {
//if ((iNumWords == 1) && (StrCmpIA(pRoot, pListHead->word) == 0)) {
// return true;
//}

View File

@ -1212,8 +1212,7 @@ extern "C" bool FileVars_ParseStr(const char* pszData, const char* pszName, char
extern "C" bool FileVars_IsUTF8(LPFILEVARS lpfv)
{
if (lpfv->mask & FV_ENCODING) {
if (StringCchCompareNIA(lpfv->chEncoding, COUNTOF(lpfv->chEncoding), "utf-8", CONSTSTRGLEN("utf-8")) == 0 ||
StringCchCompareNIA(lpfv->chEncoding, COUNTOF(lpfv->chEncoding), "utf8", CONSTSTRGLEN("utf8")) == 0) {
if (StrCmpIA(lpfv->chEncoding, "utf-8") == 0 || StrCmpIA(lpfv->chEncoding, "utf8") == 0) {
return true;
}
}

View File

@ -731,33 +731,19 @@ static inline void StrReplChrA(CHAR* pStrg, const CHAR chSearch, const CHAR chRe
//==== StrSafe lstrcmp(),lstrcmpi() =============================================
// NOTE: !!! differences in AutoCompleteList depending compare functions (CRT vs. Shlwapi)) !!!
#define StringCchCompareNW(s1, l1, s2, l2) StrCmpNW((s1), (s2), min_i((int)(l1), (int)(l2)))
#define StringCchCompareXW(s1, s2) StrCmpW((s1), (s2))
#define StringCchCompareNIW(s1, l1, s2, l2) StrCmpNIW((s1), (s2), min_i((int)(l1), (int)(l2)))
#define StringCchCompareXIW(s1, s2) StrCmpIW((s1), (s2))
#define StringCchCompareNA(s1, l1, s2, l2) StrCmpNA((s1), (s2), min_i((int)(l1), (int)(l2)))
// #define StringCchCompareNA(s1,l1,s2,l2) strncmp((s1),(s2),min_s((l1),(l2)))
#define StringCchCompareXA(s1, s2) StrCmpA((s1), (s2))
// #define StringCchCompareXA(s1,s2) strcmp((s1),(s2))
#define StringCchCompareNIA(s1, l1, s2, l2) StrCmpNIA((s1), (s2), min_i((int)(l1), (int)(l2)))
// #define StringCchCompareNIA(s1,l1,s2,l2) _strnicmp((s1),(s2),min_s((l1),(l2)))
#define StringCchCompareXIA(s1, s2) StrCmpIA((s1), (s2))
// #define StringCchCompareXIA(s1,s2) _stricmp((s1),(s2))
__forceinline bool IsSameCharSequence(const char* pSrc, const char* pCmp, CONST DocPos len) {
DocPos i = 0;
for (i = 0; (i < len) && (pSrc[i] == pCmp[i]); ++i) {}
return (i == len);
}
// NOTE: !!! differences in AutoCompleteList depending compare functions (CRT (lstrcmp(),lstrcmpi()) vs. Shlwapi)) !!!
#if defined(UNICODE) || defined(_UNICODE)
#define StringCchCompareN(s1,l1,s2,l2) StringCchCompareNW((s1),(l1),(s2),(l2))
#define StringCchCompareX(s1,s2) StringCchCompareXW((s1),(s2))
#define StringCchCompareNI(s1,l1,s2,l2) StringCchCompareNIW((s1),(l1),(s2),(l2))
#define StringCchCompareXI(s1,s2) StringCchCompareXIW((s1),(s2))
#define StringCchCompareX(s1, s2) StrCmpW((s1), (s2))
#define StringCchCompareXI(s1, s2) StrCmpIW((s1), (s2))
#else
#define StringCchCompareN(s1,l1,s2,l2) StringCchCompareNA((s1),(l1),(s2),(l2))
#define StringCchCompareX(s1,s2) StringCchCompareXA((s1),(s2))
#define StringCchCompareNI(s1,l1,s2,l2) StringCchCompareNIA((s1),(l1),(s2),(l2))
#define StringCchCompareXI(s1,s2) StringCchCompareXIA((s1),(s2))
#define StringCchCompareX(s1, s2) StrCmpA((s1), (s2))
#define StringCchCompareXI(s1, s2) StrCmpIA((s1), (s2))
#endif

View File

@ -187,7 +187,7 @@ void SetMuiLanguage(const unsigned muiLngIndex) {
StringCchCopyW(Settings2.PreferredLanguageLocaleName, COUNTOF(Settings2.PreferredLanguageLocaleName), pLocaleName);
if (Globals.bCanSaveIniFile) {
if (StringCchCompareXIW(Settings2.PreferredLanguageLocaleName, Default_PreferredLanguageLocaleName) != 0) {
if (StrCmpIW(Settings2.PreferredLanguageLocaleName, Default_PreferredLanguageLocaleName) != 0) {
IniFileSetString(Paths.IniFile, Constants.Settings2_Section, SettingName, Settings2.PreferredLanguageLocaleName);
} else {
IniFileDelete(Paths.IniFile, Constants.Settings2_Section, SettingName, false);
@ -349,7 +349,7 @@ unsigned LoadLanguageResources(LPCWSTR pLocaleName) {
unsigned iLngIndex = MuiLanguages_CountOf();
WCHAR tchAvailLngs[2 * (LOCALE_NAME_MAX_LENGTH + 1)] = { L'\0' };
for (unsigned lng = 0; lng < MuiLanguages_CountOf(); ++lng) {
if (StringCchCompareXIW(MUI_LanguageDLLs[lng].LocaleName, pLocaleName) == 0) {
if (StrCmpIW(MUI_LanguageDLLs[lng].LocaleName, pLocaleName) == 0) {
if (MUI_LanguageDLLs[lng].bHasDLL && (lng > 0)) {
StringCchCatW(tchAvailLngs, COUNTOF(tchAvailLngs), MUI_LanguageDLLs[lng].LocaleName);
StringCchCatW(tchAvailLngs, COUNTOF(tchAvailLngs), L";");

View File

@ -1593,7 +1593,7 @@ static BOOL CALLBACK _EnumWndProc(HWND hwnd, LPARAM lParam)
if (GetClassName(hwnd, szClassName, COUNTOF(szClassName))) {
if (StringCchCompareNIW(szClassName, COUNTOF(szClassName), s_wchWndClass, COUNTOF(s_wchWndClass)) == 0) {
if (StrCmpW(szClassName, s_wchWndClass) == 0) {
UINT const iReuseLock = GetDlgItemInt(hwnd, IDC_REUSELOCK, NULL, FALSE);
if ((GetTicks_ms() - iReuseLock) >= REUSEWINDOWLOCKTIMEOUT) {
@ -1621,7 +1621,7 @@ static BOOL CALLBACK _EnumWndProc2(HWND hwnd, LPARAM lParam)
if (GetClassName(hwnd, szClassName, COUNTOF(szClassName))) {
if (StringCchCompareNIW(szClassName, COUNTOF(szClassName), s_wchWndClass, COUNTOF(s_wchWndClass)) == 0) {
if (StrCmpW(szClassName, s_wchWndClass) == 0) {
UINT const iReuseLock = GetDlgItemInt(hwnd, IDC_REUSELOCK, NULL, FALSE);
if ((GetTicks_ms() - iReuseLock) >= REUSEWINDOWLOCKTIMEOUT) {
@ -8456,7 +8456,7 @@ static void _HandleAutoCloseTags()
bool isNonClosingTag = false;
for (int i = 0; ((i < cntCount) && !isNonClosingTag); ++i) {
isNonClosingTag = (StringCchCompareXIA(replaceBuf, nonClosingTags[i]) == 0);
isNonClosingTag = (StrCmpIA(replaceBuf, nonClosingTags[i]) == 0);
}
if ((cchIns > 3) && !isNonClosingTag) {
EditReplaceSelection(replaceBuf, false);
@ -11389,7 +11389,7 @@ static inline bool IsFileVarLogFile()
if (SciCall_GetTextLength() >= 4) {
char tch[5] = { '\0', '\0', '\0', '\0', '\0' };
SciCall_GetText(COUNTOF(tch) - 1, tch);
return (StringCchCompareXA(tch, ".LOG") == 0);
return (StrCmpA(tch, ".LOG") == 0);
}
return false;
}
@ -12131,7 +12131,7 @@ static BOOL CALLBACK _EnumWndCountProc(HWND hwnd, LPARAM lParam)
{
WCHAR szClassName[64] = { L'\0' };
if (GetClassName(hwnd, szClassName, COUNTOF(szClassName))) {
if (StringCchCompareNIW(szClassName, COUNTOF(szClassName), s_wchWndClass, COUNTOF(s_wchWndClass)) == 0) {
if (StrCmpW(szClassName, s_wchWndClass) == 0) {
*(int*)lParam += 1;
}
}

View File

@ -2539,8 +2539,7 @@ bool Style_SetLexerFromFile(HWND hwnd, const HPATHL hpath)
WCHAR wchMode[MICRO_BUFFER] = { L'\0' };
MultiByteToWideCharEx(Encoding_SciCP, 0, Globals.fvCurFile.chMode, -1, wchMode, MICRO_BUFFER);
if (!Flags.NoCGIGuess && (StringCchCompareNI(wchMode,COUNTOF(wchMode),L"cgi", CONSTSTRGLEN(L"cgi")) == 0 ||
StringCchCompareNI(wchMode,COUNTOF(wchMode),L"fcgi", CONSTSTRGLEN(L"fcgi")) == 0)) {
if (!Flags.NoCGIGuess && (StrCmpIW(wchMode, L"cgi") == 0 || StrCmpIW(wchMode, L"fcgi") == 0)) {
char tchText[256] = { '\0' };
SciCall_GetText(COUNTOF(tchText) - 1, tchText);
StrTrimA(tchText," \t\n\r");