Skip to content

Commit

Permalink
unnecessary std::string::substr usage
Browse files Browse the repository at this point in the history
  • Loading branch information
akva2 committed Sep 17, 2024
1 parent f1f84bd commit cd3d700
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion opm/common/utility/parameters/ParameterGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace Opm {
int commentpos = parameter.find(ID_comment);
if (commentpos != 0) {
if (commentpos != int(std::string::npos)) {
parameter = parameter.substr(0, commentpos);
parameter.resize(commentpos);
}
int fpos = parameter.find(ID_delimiter_assignment);
if (fpos == int(std::string::npos)) {
Expand Down
3 changes: 2 additions & 1 deletion test_util/rewriteEclFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ int main(int argc, char **argv) {
int p1 = outputFile.find_last_of(".");
std::string ext = outputFile.substr(p1+1);

outputFile = outputFile.substr(0,p1) + "_REWRITE." + ext;
outputFile.resize(p1);
outputFile += "_REWRITE." + ext;
Opm::EclIO::EclOutput outFile(outputFile, reffile.formattedInput());

if (reffile.is_ix())
Expand Down

0 comments on commit cd3d700

Please sign in to comment.