on master help sign in
add copyright; fix indentation
997c1dewinterland1989
cbits/unescape_string.c+7−5
@@ -1,3 +1,7 @@
1+// Copyright (c) 2008-2009 Bjoern Hoehrmann
2+// Copyright (c) 2015, Ondrej Palkovsky
3+// Copyright (c) 2016, Winterland
4+
1#include <string.h>
5#include <string.h>
2#include <stdio.h>
6#include <stdio.h>
3#include <stdint.h>
7#include <stdint.h>
@@ -130,7 +134,7 @@ int _js_decode_string(uint16_t *const dest, size_t *destoff,
130 if (surrogate) {
134 if (surrogate) {
131 if (unidata <= 0xDC00 || unidata >= 0xDFFF) // is not low surrogate
135 if (unidata <= 0xDC00 || unidata >= 0xDFFF) // is not low surrogate
132 return -1;
136 return -1;
133− surrogate = 0;
137+ surrogate = 0;
134 } else if (unidata >= 0xD800 && unidata <= 0xDBFF ) { // is high surrogate
138 } else if (unidata >= 0xD800 && unidata <= 0xDBFF ) { // is high surrogate
135 surrogate = 1;
139 surrogate = 1;
136 DISPATCH_ASCII(surrogate1);
140 DISPATCH_ASCII(surrogate1);
@@ -139,12 +143,10 @@ int _js_decode_string(uint16_t *const dest, size_t *destoff,
139 }
143 }
140 goto standard;
144 goto standard;
141 surrogate1:
145 surrogate1:
142− if (codepoint != '\\')
146+ if (codepoint != '\\') { return -1; }
143− return -1;
144 DISPATCH_ASCII(surrogate2)
147 DISPATCH_ASCII(surrogate2)
145 surrogate2:
148 surrogate2:
146− if (codepoint != 'u')
149+ if (codepoint != 'u') { return -1; }
147− return -1;
148 DISPATCH_ASCII(unicode1)
150 DISPATCH_ASCII(unicode1)
149}
151}
150
152