diff options
author | Yi Kong <yikong@google.com> | 2023-12-06 17:29:06 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-12-06 17:29:06 +0000 |
commit | 787985b5f5ee12ed659a270d27d993732607dc2b (patch) | |
tree | acff4e7e621f865b9ff57a386360f567a63caf41 | |
parent | bd09615d7b0ff6b0227e53c05db9e190fd7e018f (diff) | |
parent | 16111f1abb224594569a4f08e5cf7182dd9c7bc6 (diff) | |
download | incremental_delivery-787985b5f5ee12ed659a270d27d993732607dc2b.tar.gz |
Fix -Wfortify-source compiler warning am: 16111f1abb
Original change: https://android-review.googlesource.com/c/platform/system/incremental_delivery/+/2860694
Change-Id: Ie52ceb9a9cd316efd4f7bd00e8b4961078865645
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | incfs/incfsdump/dump.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/incfs/incfsdump/dump.cpp b/incfs/incfsdump/dump.cpp index 35d84ac..523992f 100644 --- a/incfs/incfsdump/dump.cpp +++ b/incfs/incfsdump/dump.cpp @@ -37,15 +37,17 @@ #include <sys/xattr.h> #include <unistd.h> -#include "linux/incrementalfs.h" - #include <chrono> #include <fstream> +#include <iomanip> #include <iostream> #include <iterator> #include <optional> +#include <sstream> #include <string_view> +#include "linux/incrementalfs.h" + using namespace std::literals; namespace { @@ -442,13 +444,12 @@ private: } static std::string toString(incfs_uuid_t uuid) { - std::string res; + std::stringstream res; + res << std::hex; for (unsigned char b : uuid.bytes) { - char buf[3] = {}; - snprintf(buf, std::size(buf) - 1, "%02x", (unsigned int)b); - res += buf; + res << std::setfill('0') << std::setw(2) << (unsigned int)b; } - return res; + return res.str(); } OstreamWrapper out() const { |