summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/json.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-03-28 14:53:30 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-03-28 14:53:30 +0200
commit1a3de6bd8ded1d9a2db903b1b4dbd302ae1b0789 (patch)
tree846e1aee806b47c208a180964bd81e34dc59bc0a /crawl-ref/source/json.cc
parent3eeee3f3ccb87f0432c625b6f0a915ba4c2f4d5d (diff)
downloadcrawl-ref-1a3de6bd8ded1d9a2db903b1b4dbd302ae1b0789.tar.gz
crawl-ref-1a3de6bd8ded1d9a2db903b1b4dbd302ae1b0789.zip
Fatal conditions should be fatal.
Not that anyone builds Crawl with assertions off, though.
Diffstat (limited to 'crawl-ref/source/json.cc')
-rw-r--r--crawl-ref/source/json.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/crawl-ref/source/json.cc b/crawl-ref/source/json.cc
index 8a7ee2848b..bcbc2221bb 100644
--- a/crawl-ref/source/json.cc
+++ b/crawl-ref/source/json.cc
@@ -284,7 +284,8 @@ static int utf8_write_char(uchar_t unicode, char *out)
{
unsigned char *o = (unsigned char*) out;
- ASSERT(unicode <= 0x10FFFF && !(unicode >= 0xD800 && unicode <= 0xDFFF));
+ ASSERT(unicode <= 0x10FFFF);
+ ASSERT(!(unicode >= 0xD800 && unicode <= 0xDFFF)); // UTF-16 surrogates
if (unicode <= 0x7F)
{
@@ -1052,7 +1053,7 @@ static void emit_value(SB *out, const JsonNode *node)
emit_object(out, node);
break;
default:
- ASSERT(false);
+ die("invalid JSON tag type");
}
}
@@ -1080,7 +1081,7 @@ void emit_value_indented(SB *out, const JsonNode *node, const char *space, int i
emit_object_indented(out, node, space, indent_level);
break;
default:
- ASSERT(false);
+ die("invalid JSON tag type");
}
}
@@ -1236,7 +1237,7 @@ void emit_string(SB *out, const char *str)
* This should never happen when assertions are enabled
* due to the assertion at the beginning of this function.
*/
- ASSERT(false);
+ die("mangled character");
if (escape_unicode)
{
strcpy(b, "\\uFFFD");