Skip to content

Commit e188c62

Browse files
committed
fixes
1 parent 237a3d9 commit e188c62

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

lib/suppressions.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,27 +159,26 @@ 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 (delimPos)
163+
*delimPos = std::min(semiPos, slashPos);
164+
165+
if (semiPos < slashPos) {
163166
pos = semiPos + 1;
164-
if (delimPos)
165-
*delimPos = semiPos;
166-
} else if (slashPos != std::string::npos) {
167+
} else if (slashPos < semiPos) {
167168
pos = slashPos + 2;
168-
if (delimPos)
169-
*delimPos = slashPos;
170169
} else {
171170
return "";
172171
}
173172

174173
std::string extra = comment.substr(pos);
175174

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

179178
extra = trim(extra);
180179

181180
for (auto it = extra.begin(); it != extra.end();)
182-
it = *it & 0x80 ? extra.erase(it) : it + 1;
181+
it = (*it & 0x80) ? extra.erase(it) : it + 1;
183182

184183
return extra;
185184
}

0 commit comments

Comments
 (0)