Skip to content

Commit 09aba97

Browse files
committed
fixes
1 parent 237a3d9 commit 09aba97

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/suppressions.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,27 +159,29 @@ static std::string getExtraComment(const std::string &comment, std::string::size
159159
const std::string::size_type slashPos = comment.find("//", startPos);
160160
std::string::size_type pos;
161161

162-
if (semiPos != std::string::npos && semiPos < slashPos) {
162+
if (semiPos < slashPos) {
163163
pos = semiPos + 1;
164164
if (delimPos)
165165
*delimPos = semiPos;
166-
} else if (slashPos != std::string::npos) {
166+
} else if (slashPos < semiPos) {
167167
pos = slashPos + 2;
168168
if (delimPos)
169169
*delimPos = slashPos;
170170
} else {
171+
if (delimPos)
172+
*delimPos = std::string::npos;
171173
return "";
172174
}
173175

174176
std::string extra = comment.substr(pos);
175177

176-
if (extra.size() >= 2 && extra.compare(extra.size() - 2, 2, "*/") == 0)
178+
if (startsWith(comment, "/*") && endsWith(comment, "*/"))
177179
extra.erase(extra.size() - 2, 2);
178180

179181
extra = trim(extra);
180182

181183
for (auto it = extra.begin(); it != extra.end();)
182-
it = *it & 0x80 ? extra.erase(it) : it + 1;
184+
it = (*it & 0x80) ? extra.erase(it) : it + 1;
183185

184186
return extra;
185187
}

0 commit comments

Comments
 (0)