Parcourir la source

[5101] Added an intermediate stream (CID 1398339)

Francis Dupont il y a 8 ans
Parent
commit
bb4c68f940
1 fichiers modifiés avec 8 ajouts et 6 suppressions
  1. 8 6
      src/lib/cc/data.cc

+ 8 - 6
src/lib/cc/data.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -798,11 +798,13 @@ StringElement::toJSON(std::ostream& ss) const {
             break;
         default:
             if ((c >= 0) && (c < 0x20)) {
-                ss << "\\u"
-                   << hex
-                   << setw(4)
-                   << setfill('0')
-                   << (static_cast<unsigned>(c) & 0xff);
+                std::ostringstream esc;
+                esc << "\\u"
+                    << hex
+                    << setw(4)
+                    << setfill('0')
+                    << (static_cast<unsigned>(c) & 0xff);
+                ss << esc.str();
             } else {
                 ss << c;
             }