Fossil

Check-in [507a4582]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:terribly minor internal cleanups.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | json
Files: files | file ages | folders
SHA1: 507a4582777c6bd69ced50d9499ce112b02d3bac
User & Date: stephan 2011-09-18 19:16:19
Context
2011-09-19
17:11
minor cleanups in prep for the "larger" JSON APIs. check-in: 87e20659 user: stephan tags: json
2011-09-18
19:16
terribly minor internal cleanups. check-in: 507a4582 user: stephan tags: json
19:11
One compile fix and MSVC build fix, from Jeff Slutter. check-in: 5f3a98ae user: stephan tags: json
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/json.c.

36
37
38
39
40
41
42

43
44
45

46
47
48
49
50
51
52
...
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
....
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024

/*
** Holds keys used for various JSON API properties.
*/
static const struct FossilJsonKeys_{
  char const * authToken;
  char const * commandPath;

} FossilJsonKeys = {
  "authToken"  /*authToken*/,
  "COMMAND_PATH" /*commandPath*/

};

/*
** Given a FossilJsonCodes value, it returns a string suitable for use
** as a resultText string. Returns some unspecified string if errCode
** is not one of the FossilJsonCodes values.
*/
................................................................................
  if(0 == strcmp("anonymous",name)){
    /* check captcha/seed values... */
    enum { SeedBufLen = 100 /* in some JSON tests i once actually got an
                           80-digit number.
                        */
    };
    static char seedBuffer[SeedBufLen];
    cson_value const * jseed = json_getenv("anonymousSeed");
    seedBuffer[0] = 0;
    if( !jseed ){
      jseed = json_payload_property("anonymousSeed");
      if( !jseed ){
        jseed = json_getenv("cs") /* name used by HTML interface */;
      }
    }
    if(jseed){
      if( cson_value_is_number(jseed) ){
        sprintf(seedBuffer, "%"CSON_INT_T_PFMT, cson_value_get_integer(jseed));
................................................................................
    if(anonSeed){
      login_set_anon_cookie(NULL, &cookie);
    }else{
      login_set_user_cookie(name, uid, &cookie);
    }
    payload = cookie
      ? cson_value_new_string( cookie, strlen(cookie) )
      : cson_value_null();
    free(cookie);
    return payload;
  }
#endif
}

/*







>


|
>







 







|


|







 







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
...
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
....
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026

/*
** Holds keys used for various JSON API properties.
*/
static const struct FossilJsonKeys_{
  char const * authToken;
  char const * commandPath;
  char const * anonymousSeed;
} FossilJsonKeys = {
  "authToken"  /*authToken*/,
  "COMMAND_PATH" /*commandPath*/,
  "anonymousSeed" /*anonymousSeed*/
};

/*
** Given a FossilJsonCodes value, it returns a string suitable for use
** as a resultText string. Returns some unspecified string if errCode
** is not one of the FossilJsonCodes values.
*/
................................................................................
  if(0 == strcmp("anonymous",name)){
    /* check captcha/seed values... */
    enum { SeedBufLen = 100 /* in some JSON tests i once actually got an
                           80-digit number.
                        */
    };
    static char seedBuffer[SeedBufLen];
    cson_value const * jseed = json_getenv(FossilJsonKeys.anonymousSeed);
    seedBuffer[0] = 0;
    if( !jseed ){
      jseed = json_payload_property(FossilJsonKeys.anonymousSeed);
      if( !jseed ){
        jseed = json_getenv("cs") /* name used by HTML interface */;
      }
    }
    if(jseed){
      if( cson_value_is_number(jseed) ){
        sprintf(seedBuffer, "%"CSON_INT_T_PFMT, cson_value_get_integer(jseed));
................................................................................
    if(anonSeed){
      login_set_anon_cookie(NULL, &cookie);
    }else{
      login_set_user_cookie(name, uid, &cookie);
    }
    payload = cookie
      ? cson_value_new_string( cookie, strlen(cookie) )
      : cson_value_null()/*why null instead of NULL?*/;
    free(cookie);
    return payload;
  }
#endif
}

/*