Skip to content

Commit

Permalink
Use integer 0 instead of character \0 in memset().
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Jan 22, 2025
1 parent 55f90c8 commit 0589943
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scintilla/lexers/LexHTML.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexers/LexPHP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexers/LexVB.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexlib/LexAccessor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Sci_PositionU>(lenDoc));
len = endPos_ - startPos_;
Expand Down
2 changes: 1 addition & 1 deletion src/EditAutoC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char *>(NP2HeapAlloc(size));
}
Expand Down

0 comments on commit 0589943

Please sign in to comment.