diff --git a/example/cbor-to-json/cbor-to-json.cc b/example/cbor-to-json/cbor-to-json.cc index 1ce64121..467b5cbb 100644 --- a/example/cbor-to-json/cbor-to-json.cc +++ b/example/cbor-to-json/cbor-to-json.cc @@ -786,7 +786,8 @@ compute_exit_code(std::string status_msg) { // (other non-zero exit codes). Specifically, exit code 2 for internal // invariant violation, exit code 139 (which is 128 + SIGSEGV on x86_64 // linux) for a segmentation fault (e.g. null pointer dereference). - if (size_t i = status_msg.find('='); i != std::string::npos) { + size_t i = status_msg.find('='); + if (i != std::string::npos) { status_msg = status_msg.substr(0, i); } return (status_msg.find("internal error:") != std::string::npos) ? 2 : 1; diff --git a/example/json-to-cbor/json-to-cbor.cc b/example/json-to-cbor/json-to-cbor.cc index ab955831..7462f137 100644 --- a/example/json-to-cbor/json-to-cbor.cc +++ b/example/json-to-cbor/json-to-cbor.cc @@ -381,7 +381,8 @@ compute_exit_code(std::string status_msg) { // (other non-zero exit codes). Specifically, exit code 2 for internal // invariant violation, exit code 139 (which is 128 + SIGSEGV on x86_64 // linux) for a segmentation fault (e.g. null pointer dereference). - if (size_t i = status_msg.find('='); i != std::string::npos) { + size_t i = status_msg.find('='); + if (i != std::string::npos) { status_msg = status_msg.substr(0, i); } return (status_msg.find("internal error:") != std::string::npos) ? 2 : 1; diff --git a/example/jsonfindptrs/jsonfindptrs.cc b/example/jsonfindptrs/jsonfindptrs.cc index df717eb8..ca6d1e80 100644 --- a/example/jsonfindptrs/jsonfindptrs.cc +++ b/example/jsonfindptrs/jsonfindptrs.cc @@ -593,7 +593,8 @@ compute_exit_code(std::string status_msg) { // (other non-zero exit codes). Specifically, exit code 2 for internal // invariant violation, exit code 139 (which is 128 + SIGSEGV on x86_64 // linux) for a segmentation fault (e.g. null pointer dereference). - if (size_t i = status_msg.find('='); i != std::string::npos) { + size_t i = status_msg.find('='); + if (i != std::string::npos) { status_msg = status_msg.substr(0, i); } return (status_msg.find("internal error:") != std::string::npos) ? 2 : 1;