]> git.cworth.org Git - apitrace/blobdiff - common/json.hpp
Ensure negation argument is signed.
[apitrace] / common / json.hpp
index 621610af4451c0720c796ee0c366d8fe2b91deb3..14ff501f5681777a19a56b8321643d2e68239388 100644 (file)
@@ -306,6 +306,25 @@ public:
         space = ' ';
     }
 
+
+    /**
+     * Special case for char to prevent it to be written as a literal
+     * character.
+     */
+    inline void writeNumber(char n) {
+        separator();
+        os << std::dec << static_cast<int>(n);
+        value = true;
+        space = ' ';
+    }
+
+    inline void writeNumber(unsigned char n) {
+        separator();
+        os << std::dec << static_cast<unsigned>(n);
+        value = true;
+        space = ' ';
+    }
+
     template<class T>
     inline void writeNumber(T n) {
         if (n != n) {