aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/GpgConstants.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-12-06 15:58:23 +0000
committerSaturneric <[email protected]>2021-12-06 15:58:43 +0000
commit97d13004e4f1cb33941a9be57c7e7662e223890b (patch)
tree6bf2466046379fd8ac2a0e9ca3605e15dce4672d /src/gpg/GpgConstants.cpp
parentMerge branch 'develop' of github.com:saturneric/GpgFrontend into develop-ci (diff)
downloadGpgFrontend-97d13004e4f1cb33941a9be57c7e7662e223890b.tar.gz
GpgFrontend-97d13004e4f1cb33941a9be57c7e7662e223890b.zip
Improve UI & Functions
Diffstat (limited to '')
-rw-r--r--src/gpg/GpgConstants.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gpg/GpgConstants.cpp b/src/gpg/GpgConstants.cpp
index 5688287e..e3de1d06 100644
--- a/src/gpg/GpgConstants.cpp
+++ b/src/gpg/GpgConstants.cpp
@@ -77,12 +77,15 @@ gpgme_error_t GpgFrontend::check_gpg_error(gpgme_error_t err,
std::string GpgFrontend::beautify_fingerprint(
GpgFrontend::BypeArrayConstRef fingerprint) {
- auto _fingerprint = fingerprint;
- unsigned len = fingerprint.size();
- if ((len > 0) && (len % 4 == 0))
- for (unsigned n = 0; 4 * (n + 1) < len; ++n)
- _fingerprint.insert(static_cast<int>(5u * n + 4u), " ");
- return fingerprint;
+ auto len = fingerprint.size();
+ std::stringstream out;
+ decltype(len) count = 0;
+ while (count < len) {
+ if (count && !(count % 5)) out << " ";
+ out << fingerprint[count];
+ count++;
+ }
+ return out.str();
}
// trim from start (in place)