Handle npos / not found (Coverity 55588); indentation; local vars.

This commit is contained in:
Axel Naumann 2015-06-07 20:21:49 +02:00 committed by sftnight
parent 926f9072ea
commit 9e100c5dc5

View File

@ -234,11 +234,12 @@ namespace cling {
if (content[posNonWS] == '}') {
content[posNonWS] = ' '; // replace '}'
} else {
std::string::size_type posComment = content.find_last_of('}');
if (content[posComment] == '}') {
content[posComment] = ' '; // replace '}'
}
posComment = content.find_first_not_of(whitespace, posComment);
std::string::size_type posBlockClose = content.find_last_of('}');
if (posBlockClose != std::string::npos) {
content[posBlockClose] = ' '; // replace '}'
}
std::string::size_type posComment
= content.find_first_not_of(whitespace, posComment);
if (content[posComment] == '/' && content[posComment+1] == '/') {
// More text (comments) are okay after the last '}', but
// we can not easily find it to remove it (so we need to upgrade