Changeset View
Changeset View
Standalone View
Standalone View
src/univalue/gen/gen.cpp
// Copyright 2014 BitPay Inc. | // Copyright 2014 BitPay Inc. | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
// | // | ||||
// To re-create univalue_escapes.h: | // To re-create univalue_escapes.h: | ||||
// $ g++ -o gen gen.cpp | // $ g++ -o gen gen.cpp | ||||
// $ ./gen > univalue_escapes.h | // $ ./gen > univalue_escapes.h | ||||
// | // | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include "univalue.h" | #include "univalue.h" | ||||
using namespace std; | |||||
static bool initEscapes; | static bool initEscapes; | ||||
static std::string escapes[256]; | static std::string escapes[256]; | ||||
static void initJsonEscape() | static void initJsonEscape() | ||||
{ | { | ||||
// Escape all lower control characters (some get overridden with smaller sequences below) | // Escape all lower control characters (some get overridden with smaller sequences below) | ||||
for (int ch=0x00; ch<0x20; ++ch) { | for (int ch=0x00; ch<0x20; ++ch) { | ||||
char tmpbuf[20]; | char tmpbuf[20]; | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |