From 05899438a1bebda659b38840f621ea33b0076643 Mon Sep 17 00:00:00 2001 From: zufuliu Date: Wed, 22 Jan 2025 18:29:38 +0800 Subject: [PATCH] Use integer `0` instead of character `\0` in `memset()`. --- scintilla/lexers/LexHTML.cxx | 2 +- scintilla/lexers/LexPHP.cxx | 2 +- scintilla/lexers/LexVB.cxx | 2 +- scintilla/lexlib/LexAccessor.cxx | 2 +- src/EditAutoC.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scintilla/lexers/LexHTML.cxx b/scintilla/lexers/LexHTML.cxx index cb3bdc35e6..3ceff013c8 100644 --- a/scintilla/lexers/LexHTML.cxx +++ b/scintilla/lexers/LexHTML.cxx @@ -187,7 +187,7 @@ bool isHTMLCustomElement(const char *tag, size_t length, bool dashColon) noexcep int classifyTagHTML(Sci_PositionU end, LexerWordList keywordLists, LexAccessor &styler, bool &tagDontFold, bool isXml, bool allowScripts) { char s[63 + 1]; - memset(s, '\0', 4); + memset(s, 0, 4); const Sci_PositionU start = styler.GetStartSegment(); styler.GetRange(start, end, s, sizeof(s)); char *tag = s; diff --git a/scintilla/lexers/LexPHP.cxx b/scintilla/lexers/LexPHP.cxx index ae7d180b14..bbf9955468 100644 --- a/scintilla/lexers/LexPHP.cxx +++ b/scintilla/lexers/LexPHP.cxx @@ -225,7 +225,7 @@ void PHPLexer::ClassifyHtmlTag(LexerWordList keywordLists) { sc.SetState((tagType == HtmlTagType::Question) ? SCE_H_QUESTION : SCE_H_TAG); } else if (tagType == HtmlTagType::None) { char s[16]; - memset(s, '\0', 4); + memset(s, 0, 4); sc.GetCurrentLowered(s, sizeof(s)); const char *p = s + 1; if (StrEqual(p, "script")) { diff --git a/scintilla/lexers/LexVB.cxx b/scintilla/lexers/LexVB.cxx index 4bdf2ef39c..7bc25e9c0a 100644 --- a/scintilla/lexers/LexVB.cxx +++ b/scintilla/lexers/LexVB.cxx @@ -503,7 +503,7 @@ void FoldVBDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Le int ifThenMask = 0; // If ... Then ... End If int wordLen = 0; char s[MaxKeywordSize]; - memset(s, 4, 4); + memset(s, 0, 4); while (startPos < endPos) { const int style = initStyle; diff --git a/scintilla/lexlib/LexAccessor.cxx b/scintilla/lexlib/LexAccessor.cxx index dcc9973a9a..208601f31d 100644 --- a/scintilla/lexlib/LexAccessor.cxx +++ b/scintilla/lexlib/LexAccessor.cxx @@ -39,7 +39,7 @@ bool LexAccessor::MatchLowerCase(Sci_Position pos, const char *s) noexcept { void LexAccessor::GetRange(Sci_PositionU startPos_, Sci_PositionU endPos_, char *s, Sci_PositionU len) const noexcept { assert(s != nullptr); assert(startPos_ <= endPos_ && len != 0); - //memset(s, '\0', len); + //memset(s, 0, len); endPos_ = sci::min(endPos_, startPos_ + len - 1); //endPos_ = sci::min(endPos_, static_cast(lenDoc)); len = endPos_ - startPos_; diff --git a/src/EditAutoC.cpp b/src/EditAutoC.cpp index a5874a4962..96199e78af 100644 --- a/src/EditAutoC.cpp +++ b/src/EditAutoC.cpp @@ -33,7 +33,7 @@ class CharBuffer { explicit CharBuffer(size_t size) noexcept { if (size <= StackSize) { ptr = buffer; - memset(buffer, '\0', StackSize); + memset(buffer, 0, StackSize); } else { ptr = static_cast(NP2HeapAlloc(size)); }