浏览代码

cmcmd: let operator<< for NumberFormatter reset the stream's format flags

Matthias Maennich 8 年之前
父节点
当前提交
3345e2a2cc
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      Source/cmcmd.cxx

+ 3 - 1
Source/cmcmd.cxx

@@ -1556,11 +1556,13 @@ struct NumberFormatter
 std::ostream& operator<<(std::ostream& stream,
                          NumberFormatter const& formatter)
 {
+  auto const& flags = stream.flags();
   if (formatter.Format == FORMAT_DECIMAL) {
-    stream << formatter.Value;
+    stream << std::dec << formatter.Value;
   } else {
     stream << "0x" << std::hex << formatter.Value;
   }
+  stream.flags(flags);
   return stream;
 }
 static bool RunCommand(const char* comment, std::vector<std::string>& command,