From 0d1c991eb4f4498b4ac8fea465d1caf5002a4af8 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Fri, 7 Aug 2026 09:44:42 +0200 Subject: [PATCH] - coding style --- client/snbk/CmdMetaParse.cc | 20 +++++++------------- client/snbk/CmdMetaParse.h | 4 +++- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/client/snbk/CmdMetaParse.cc b/client/snbk/CmdMetaParse.cc index 527ac4f4..2e785982 100644 --- a/client/snbk/CmdMetaParse.cc +++ b/client/snbk/CmdMetaParse.cc @@ -20,10 +20,6 @@ */ -#include -#include -#include - #include #include @@ -77,17 +73,14 @@ namespace snapper } unsigned char hash[SHA256_DIGEST_LENGTH]; - SHA256(reinterpret_cast(content.c_str()), content.length(), - hash); + SHA256(reinterpret_cast(content.c_str()), content.length(), hash); - std::stringstream ss; - for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) - { - ss << std::hex << std::setw(2) << std::setfill('0') - << static_cast(hash[i]); - } + char buf[2 * SHA256_DIGEST_LENGTH + 1]; - return ss.str(); + for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) + snprintf(&buf[2 * i], 3, "%02x", hash[i]); + + return buf; } @@ -144,6 +137,7 @@ namespace snapper std::ostream& operator<<(std::ostream& s, const CmdMetaParse& cmd_metaparse) { SnapshotMeta meta = cmd_metaparse.get_meta(); + s << "path: " << cmd_metaparse.path << ", checksum: " << cmd_metaparse.get_checksum() << ", state: " << toString(meta.state) << ", date: " << meta.date diff --git a/client/snbk/CmdMetaParse.h b/client/snbk/CmdMetaParse.h index 68a2977c..c8437743 100644 --- a/client/snbk/CmdMetaParse.h +++ b/client/snbk/CmdMetaParse.h @@ -87,7 +87,9 @@ namespace snapper private: const string path; - string content = ""; + + string content; + }; } // namespace snapper -- 2.47.3