Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Minor interal json refactoring made possible by recent cson changes. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
e40e79b7ab7b9f0fa6f85f95f97d5ae5 |
| User & Date: | stephan 2012-07-05 19:24:25.285 |
Context
|
2012-07-06
| ||
| 16:18 | /json/query now fails without executing the query if the provided query has no result _columns_ (to explicitly disallow INSERT/DELETE/DROP, etc.). ... (check-in: 3e1dd97f77 user: stephan tags: trunk) | |
|
2012-07-05
| ||
| 21:25 | Work toward getting Fossil to be able to sync over IPV6. This check-in compiles, but we do not yet have a server to test it on. ... (check-in: 0268e771ef user: drh tags: ipv6) | |
| 19:24 | Minor interal json refactoring made possible by recent cson changes. ... (check-in: e40e79b7ab user: stephan tags: trunk) | |
| 19:03 | Pulled in latest cson amalgamation for the cson_type_id addition and started refactoring some O(N) lookups to O(1) based on that addition. ... (check-in: cde55bd7a3 user: stephan tags: trunk) | |
Changes
Changes to src/json.c.
| ︙ | ︙ | |||
870 871 872 873 874 875 876 |
** for consistency with how json_err() works.
*/
void json_warn( int code, char const * fmt, ... ){
cson_object * obj = NULL;
assert( (code>FSL_JSON_W_START)
&& (code<FSL_JSON_W_END)
&& "Invalid warning code.");
| | | | < | | | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 |
** for consistency with how json_err() works.
*/
void json_warn( int code, char const * fmt, ... ){
cson_object * obj = NULL;
assert( (code>FSL_JSON_W_START)
&& (code<FSL_JSON_W_END)
&& "Invalid warning code.");
if(!g.json.warnings){
g.json.warnings = cson_new_array();
assert((NULL != g.json.warnings) && "Alloc error.");
json_gc_add("$WARNINGS",cson_array_value(g.json.warnings));
}
obj = cson_new_object();
cson_array_append(g.json.warnings, cson_object_value(obj));
cson_object_set(obj,"code",cson_value_new_integer(code));
if(fmt && *fmt){
/* FIXME: treat NULL fmt as standard warning message for
the code, but we don't have those yet.
*/
va_list vargs;
char * msg;
|
| ︙ | ︙ | |||
1443 1444 1445 1446 1447 1448 1449 | INT(g.json, dispatchDepth); VAL(authToken, g.json.authToken); CSTR(g.json, jsonp); VAL(gc, g.json.gc.v); VAL(cmd, g.json.cmd.v); VAL(param, g.json.param.v); VAL(POST, g.json.post.v); | | | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | INT(g.json, dispatchDepth); VAL(authToken, g.json.authToken); CSTR(g.json, jsonp); VAL(gc, g.json.gc.v); VAL(cmd, g.json.cmd.v); VAL(param, g.json.param.v); VAL(POST, g.json.post.v); VAL(warnings, cson_array_value(g.json.warnings)); /*cson_output_opt outOpt;*/ #undef INT #undef CSTR #undef VAL return cson_object_value(pay); |
| ︙ | ︙ | |||
1556 1557 1558 1559 1560 1561 1562 |
double span;
span = END_TIMER;
/* i'm actually seeing sub-ms runtimes in some tests, but a time of
0 is "just wrong", so we'll bump that up to 1ms.
*/
cson_object_set(o,"procTimeMs", cson_value_new_integer((cson_int_t)((span>1.0)?span:1)));
}
| | | | 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 |
double span;
span = END_TIMER;
/* i'm actually seeing sub-ms runtimes in some tests, but a time of
0 is "just wrong", so we'll bump that up to 1ms.
*/
cson_object_set(o,"procTimeMs", cson_value_new_integer((cson_int_t)((span>1.0)?span:1)));
}
if(g.json.warnings){
tmp = cson_array_value(g.json.warnings);
SET("warnings");
}
/* Only add the payload to SUCCESS responses. Else delete it. */
if( NULL != payload ){
if( resultCode ){
cson_value_free(payload);
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
243 244 245 246 247 248 249 |
cson_value * v;
cson_object * o;
} param;
struct {
cson_value * v;
cson_object * o;
} reqPayload; /* request payload object (if any) */
| < < | < | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
cson_value * v;
cson_object * o;
} param;
struct {
cson_value * v;
cson_object * o;
} reqPayload; /* request payload object (if any) */
cson_array * warnings; /* response warnings */
} json;
#endif /* FOSSIL_ENABLE_JSON */
};
/*
** Macro for debugging:
*/
|
| ︙ | ︙ |