diff options
author | Saturneric <[email protected]> | 2021-12-06 15:58:23 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-06 15:58:43 +0000 |
commit | 97d13004e4f1cb33941a9be57c7e7662e223890b (patch) | |
tree | 6bf2466046379fd8ac2a0e9ca3605e15dce4672d /src/gpg/GpgConstants.cpp | |
parent | Merge branch 'develop' of github.com:saturneric/GpgFrontend into develop-ci (diff) | |
download | GpgFrontend-97d13004e4f1cb33941a9be57c7e7662e223890b.tar.gz GpgFrontend-97d13004e4f1cb33941a9be57c7e7662e223890b.zip |
Improve UI & Functions
Diffstat (limited to 'src/gpg/GpgConstants.cpp')
-rw-r--r-- | src/gpg/GpgConstants.cpp | 15 |
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) |