summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-03-26 14:54:48 -0400
committerJonathan Bradley <jcb@pikum.xyz>2025-03-26 21:03:21 -0400
commita73904e4c01766ef29722fd5b9d7ec0d4729792c (patch)
tree734e3f44dad0947687e3fddb4b7c3f098a2447b4
parent5199a0cefb6facbedf406fd3a141dfe09ffab68b (diff)
pkuuid: reset ostream flags after serializing
-rw-r--r--pkuuid.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkuuid.h b/pkuuid.h
index 8639e87..0de7f6b 100644
--- a/pkuuid.h
+++ b/pkuuid.h
@@ -153,6 +153,8 @@ std::ostream&
operator<<(std::ostream &o, const struct pk_uuid& uuid)
{
int i;
+ std::ios_base::fmtflags orig_flags = o.flags();
+ auto fill = o.fill();
o << std::hex;
for (i = 0; i < 4; ++i) {
o << std::setw(2) << std::setfill('0');
@@ -178,6 +180,8 @@ operator<<(std::ostream &o, const struct pk_uuid& uuid)
o << std::setw(2) << std::setfill('0');
o << (uint16_t)uuid.uuid[i];
}
+ o.fill(fill);
+ o.flags(orig_flags);
return o;
}