Fossil SCM

fixed how many path parts are generated for the "command" response property.

stephan 2011-10-07 03:51 json-multitag-test
Commit 3d6cc1df782e75369b94c98b779e0dc917daad04
1 file changed +5 -4
+5 -4
--- src/json.c
+++ src/json.c
@@ -1286,22 +1286,23 @@
12861286
cson_value * json_new_timestamp(cson_int_t timeVal){
12871287
return cson_value_new_integer((timeVal<0) ? (cson_int_t)time(0) : timeVal);
12881288
}
12891289
12901290
/*
1291
-** Internal helper for json_create_response(). Appends all elements of
1292
-** g.json.cmd.a, except the first one, to a string and returns that
1293
-** string value (which is owned by the caller).
1291
+** Internal helper for json_create_response(). Appends the first
1292
+** g.json.dispatchDepth elements of g.json.cmd.a, skipping the first
1293
+** one (the "json" part), to a string and returns that string value
1294
+** (which is owned by the caller).
12941295
*/
12951296
static cson_value * json_response_command_path(){
12961297
if(!g.json.cmd.a){
12971298
return NULL;
12981299
}else{
12991300
cson_value * rc = NULL;
13001301
Blob path = empty_blob;
13011302
char const * part;
1302
- unsigned int aLen = cson_array_length_get(g.json.cmd.a);
1303
+ unsigned int aLen = g.json.dispatchDepth+1; /*cson_array_length_get(g.json.cmd.a);*/
13031304
unsigned int i = 1;
13041305
for( ; i < aLen; ++i ){
13051306
char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i)));
13061307
blob_append(&path,part,-1);
13071308
if(i < (aLen-1)){
13081309
--- src/json.c
+++ src/json.c
@@ -1286,22 +1286,23 @@
1286 cson_value * json_new_timestamp(cson_int_t timeVal){
1287 return cson_value_new_integer((timeVal<0) ? (cson_int_t)time(0) : timeVal);
1288 }
1289
1290 /*
1291 ** Internal helper for json_create_response(). Appends all elements of
1292 ** g.json.cmd.a, except the first one, to a string and returns that
1293 ** string value (which is owned by the caller).
 
1294 */
1295 static cson_value * json_response_command_path(){
1296 if(!g.json.cmd.a){
1297 return NULL;
1298 }else{
1299 cson_value * rc = NULL;
1300 Blob path = empty_blob;
1301 char const * part;
1302 unsigned int aLen = cson_array_length_get(g.json.cmd.a);
1303 unsigned int i = 1;
1304 for( ; i < aLen; ++i ){
1305 char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i)));
1306 blob_append(&path,part,-1);
1307 if(i < (aLen-1)){
1308
--- src/json.c
+++ src/json.c
@@ -1286,22 +1286,23 @@
1286 cson_value * json_new_timestamp(cson_int_t timeVal){
1287 return cson_value_new_integer((timeVal<0) ? (cson_int_t)time(0) : timeVal);
1288 }
1289
1290 /*
1291 ** Internal helper for json_create_response(). Appends the first
1292 ** g.json.dispatchDepth elements of g.json.cmd.a, skipping the first
1293 ** one (the "json" part), to a string and returns that string value
1294 ** (which is owned by the caller).
1295 */
1296 static cson_value * json_response_command_path(){
1297 if(!g.json.cmd.a){
1298 return NULL;
1299 }else{
1300 cson_value * rc = NULL;
1301 Blob path = empty_blob;
1302 char const * part;
1303 unsigned int aLen = g.json.dispatchDepth+1; /*cson_array_length_get(g.json.cmd.a);*/
1304 unsigned int i = 1;
1305 for( ; i < aLen; ++i ){
1306 char const * part = cson_string_cstr(cson_value_get_string(cson_array_get(g.json.cmd.a, i)));
1307 blob_append(&path,part,-1);
1308 if(i < (aLen-1)){
1309

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button