Fossil

Check-in [a67c6744]
Login

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

Overview
Comment:added a missing assert() (Thanks, Joe M.)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | json
Files: files | file ages | folders
SHA1: a67c6744e5c786c6550ad754057d92497b208a17
User & Date: stephan 2011-09-17 20:25:49
Context
2011-09-17
23:14
Doc changes only check-in: 5a9e5679 user: stephan tags: json
20:25
added a missing assert() (Thanks, Joe M.) check-in: a67c6744 user: stephan tags: json
16:01
More cleaning up of error lower-level handling to output JSON instead of HTML in a few more cases. check-in: 9b842564 user: stephan tags: json
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/json.c.

143
144
145
146
147
148
149

150
151
152
153
154
155
156
** when constructing the JSON response envelope, so the static buffer
** "shouldn't" be a problem.
**
*/
char const * json_rc_cstr( int code ){
  enum { BufSize = 12 };
  static char buf[BufSize] = {'F','O','S','S','I','L','-',0};

  sprintf(buf+7,"%04d", code);
  return buf;
}

/*
** Returns the value of json_rc_cstr(code) as a new JSON
** string, which is owned by the caller and must eventually







>







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
** when constructing the JSON response envelope, so the static buffer
** "shouldn't" be a problem.
**
*/
char const * json_rc_cstr( int code ){
  enum { BufSize = 12 };
  static char buf[BufSize] = {'F','O','S','S','I','L','-',0};
  assert((code >= 1000) && (code <= 9999) && "Invalid Fossil/JSON code.");
  sprintf(buf+7,"%04d", code);
  return buf;
}

/*
** Returns the value of json_rc_cstr(code) as a new JSON
** string, which is owned by the caller and must eventually