diff options
author | Simon Warta <[email protected]> | 2015-09-22 23:13:08 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-09-22 23:13:08 +0200 |
commit | 1f62dbcd0108a2cd99ad473299e041163a638b1c (patch) | |
tree | fb74d95411c5f8c41ca7f409cfc8d36513023363 | |
parent | ac9689990da914cd58788dab9d5e0d7bebb72e30 (diff) |
Avoid concatination of chars
Ever tried?
auto str = "some long string";
auto str2 = str + '\n';
It's not with the brainfuck finding the bug.
-rw-r--r-- | src/lib/asn1/asn1_oid.cpp | 2 | ||||
-rw-r--r-- | src/lib/base/scan_name.cpp | 10 | ||||
-rw-r--r-- | src/lib/cert/x509/x509_ca.cpp | 2 | ||||
-rw-r--r-- | src/lib/entropy/proc_walk/proc_walk.cpp | 2 | ||||
-rw-r--r-- | src/lib/misc/openpgp/openpgp.cpp | 8 | ||||
-rw-r--r-- | src/lib/utils/filesystem.cpp | 2 | ||||
-rw-r--r-- | src/tests/test_ecdsa.cpp | 2 |
7 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/asn1/asn1_oid.cpp b/src/lib/asn1/asn1_oid.cpp index 21c2daafb..2fbc4b27c 100644 --- a/src/lib/asn1/asn1_oid.cpp +++ b/src/lib/asn1/asn1_oid.cpp @@ -54,7 +54,7 @@ std::string OID::as_string() const { oid_str += std::to_string(id[i]); if(i != id.size() - 1) - oid_str += '.'; + oid_str += "."; } return oid_str; } diff --git a/src/lib/base/scan_name.cpp b/src/lib/base/scan_name.cpp index 4b0c95004..5c8c55b27 100644 --- a/src/lib/base/scan_name.cpp +++ b/src/lib/base/scan_name.cpp @@ -29,7 +29,7 @@ std::string make_arg( if(name[i].first > level) { - output += '(' + name[i].second; + output += "(" + name[i].second; ++paren_depth; } else if(name[i].first < level) @@ -48,7 +48,7 @@ std::string make_arg( } for(size_t i = 0; i != paren_depth; ++i) - output += ')'; + output += ")"; return output; } @@ -141,14 +141,14 @@ std::string SCAN_Name::all_arguments() const std::string out; if(arg_count()) { - out += '('; + out += "("; for(size_t i = 0; i != arg_count(); ++i) { out += arg(i); if(i != arg_count() - 1) - out += ','; + out += ","; } - out += ')'; + out += ")"; } return out; } diff --git a/src/lib/cert/x509/x509_ca.cpp b/src/lib/cert/x509/x509_ca.cpp index b6bb5d8ce..d329bfdd8 100644 --- a/src/lib/cert/x509/x509_ca.cpp +++ b/src/lib/cert/x509/x509_ca.cpp @@ -243,7 +243,7 @@ PK_Signer* choose_sig_format(const Private_Key& key, const Signature_Format format = (key.message_parts() > 1) ? DER_SEQUENCE : IEEE_1363; - padding = padding + '(' + hash->name() + ')'; + padding = padding + "(" + hash->name() + ")"; sig_algo.oid = OIDS::lookup(algo_name + "/" + padding); sig_algo.parameters = key.algorithm_identifier().parameters; diff --git a/src/lib/entropy/proc_walk/proc_walk.cpp b/src/lib/entropy/proc_walk/proc_walk.cpp index 7fbea678e..3d63e5d5a 100644 --- a/src/lib/entropy/proc_walk/proc_walk.cpp +++ b/src/lib/entropy/proc_walk/proc_walk.cpp @@ -86,7 +86,7 @@ int Directory_Walker::next_fd() if(filename == "." || filename == "..") continue; - const std::string full_path = entry.second + '/' + filename; + const std::string full_path = entry.second + "/" + filename; struct stat stat_buf; if(::lstat(full_path.c_str(), &stat_buf) == -1) diff --git a/src/lib/misc/openpgp/openpgp.cpp b/src/lib/misc/openpgp/openpgp.cpp index 3a464d906..f42ce875e 100644 --- a/src/lib/misc/openpgp/openpgp.cpp +++ b/src/lib/misc/openpgp/openpgp.cpp @@ -28,16 +28,16 @@ std::string PGP_encode( std::string pgp_encoded = PGP_HEADER; if(headers.find("Version") != headers.end()) - pgp_encoded += "Version: " + headers.find("Version")->second + '\n'; + pgp_encoded += "Version: " + headers.find("Version")->second + "\n"; std::map<std::string, std::string>::const_iterator i = headers.begin(); while(i != headers.end()) { if(i->first != "Version") - pgp_encoded += i->first + ": " + i->second + '\n'; + pgp_encoded += i->first + ": " + i->second + "\n"; ++i; } - pgp_encoded += '\n'; + pgp_encoded += "\n"; Pipe pipe(new Fork( new Base64_Encoder(true, PGP_WIDTH), @@ -48,7 +48,7 @@ std::string PGP_encode( pipe.process_msg(input, length); pgp_encoded += pipe.read_all_as_string(0); - pgp_encoded += '=' + pipe.read_all_as_string(1) + '\n'; + pgp_encoded += "=" + pipe.read_all_as_string(1) + "\n"; pgp_encoded += PGP_TRAILER; return pgp_encoded; diff --git a/src/lib/utils/filesystem.cpp b/src/lib/utils/filesystem.cpp index 950d4d4e2..8d51e64bd 100644 --- a/src/lib/utils/filesystem.cpp +++ b/src/lib/utils/filesystem.cpp @@ -86,7 +86,7 @@ std::vector<std::string> impl_readdir(const std::string& dir_path) const std::string filename = dirent->d_name; if(filename == "." || filename == "..") continue; - const std::string full_path = cur_path + '/' + filename; + const std::string full_path = cur_path + "/" + filename; struct stat stat_buf; diff --git a/src/tests/test_ecdsa.cpp b/src/tests/test_ecdsa.cpp index 8d385b4bf..3fe9bff5e 100644 --- a/src/tests/test_ecdsa.cpp +++ b/src/tests/test_ecdsa.cpp @@ -37,7 +37,7 @@ size_t ecdsa_sig_kat(const std::string& group_id, PK_Verifier verify(ecdsa, padding); PK_Signer sign(ecdsa, padding); - return validate_signature(verify, sign, "ECDSA/" + group_id + '/' + hash, + return validate_signature(verify, sign, "ECDSA/" + group_id + "/" + hash, msg, rng, signature); } |