Last active
December 14, 2015 04:49
-
-
Save srijs/5031205 to your computer and use it in GitHub Desktop.
Debugging CouchDB...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var buf = []; | |
for (var i = 0; i < State.funs.length; i++) { | |
map_results = []; | |
try { | |
State.funs[i](doc); | |
buf.push(Couch.toJSON(map_results)); | |
} catch (err) { | |
handleViewError(err, doc); | |
// If the error is not fatal, we treat the doc as if it | |
// did not emit anything, by buffering an empty array. | |
buf.push("[]"); | |
} | |
} | |
print("[" + buf.join(", ") + "]"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void | |
couch_print(JSContext* cx, uintN argc, jsval* argv) | |
{ | |
char *bytes; | |
uintN i; | |
for(i = 0; i < argc; i++) | |
{ | |
bytes = enc_string(cx, argv[i], NULL); | |
if(!bytes) return; | |
fprintf(stdout, "%s%s", i ? " " : "", bytes); | |
JS_free(cx, bytes); | |
} | |
fputc('\n', stdout); | |
fflush(stdout); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69,71c69,73 | |
< if((c >= 0xDC00) && (c <= 0xDFFF)) goto bad_surrogate; | |
< | |
< if(c < 0xD800 || c > 0xDBFF) | |
--- | |
> if((c >= 0xDC00) && (c <= 0xDFFF)) | |
> { // bad surrogate hack -- emit '?' | |
> v = 0x3f; | |
> } | |
> else if(c < 0xD800 || c > 0xDBFF) | |
80a83,88 | |
> { // bad surrogate hack -- emit '?' | |
> v = 0x3f; | |
> src--; | |
> srclen++; | |
> } | |
> else | |
82,83c90 | |
< c = c2; | |
< goto bad_surrogate; | |
--- | |
> v = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000; | |
85d91 | |
< v = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000; | |
111a118 | |
> /* | |
114a122 | |
> */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment