]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- coding style 1177/head
authorArvin Schnell <aschnell@suse.de>
Fri, 7 Aug 2026 07:44:42 +0000 (09:44 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 7 Aug 2026 07:44:42 +0000 (09:44 +0200)
client/snbk/CmdMetaParse.cc
client/snbk/CmdMetaParse.h

index 527ac4f4f5a53187f97fd2da896aa2fd9749e190..2e7859821cc074b4cb3160d3ce7e5ed32dfa147f 100644 (file)
  */
 
 
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-
 #include <boost/algorithm/string.hpp>
 #include <openssl/sha.h>
 
@@ -77,17 +73,14 @@ namespace snapper
        }
 
        unsigned char hash[SHA256_DIGEST_LENGTH];
-       SHA256(reinterpret_cast<const unsigned char*>(content.c_str()), content.length(),
-              hash);
+       SHA256(reinterpret_cast<const unsigned char*>(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<int>(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
index 68a2977ce46fa516cb03d09d736173808f0975cd..c8437743783398b52c5116171dee88ae0582aada 100644 (file)
@@ -87,7 +87,9 @@ namespace snapper
     private:
 
        const string path;
-       string content = "";
+
+       string content;
+
     };
 
 } // namespace snapper