Fossil SCM

Fixed JSON-side warnings reported by Baptiste Daroussin.

stephan 2013-01-02 10:47 trunk
Commit 8fec4c959c430c359a31ce835abfedf464660b12
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -1422,11 +1422,10 @@
14221422
extern "C" {
14231423
#endif
14241424
14251425
14261426
1427
-
14281427
/**
14291428
This type holds the "vtbl" for type-specific operations when
14301429
working with cson_value objects.
14311430
14321431
All cson_values of a given logical type share a pointer to a single
@@ -1524,13 +1523,11 @@
15241523
*/
15251524
#define cson_value_empty_m { &cson_value_api_empty/*api*/, NULL/*value*/, 0/*refcount*/ }
15261525
/**
15271526
Empty-initialized cson_value object.
15281527
*/
1529
-extern const cson_value cson_value_empty;
1530
-
1531
-const cson_value cson_value_empty = cson_value_empty_m;
1528
+static const cson_value cson_value_empty = cson_value_empty_m;
15321529
const cson_parse_opt cson_parse_opt_empty = cson_parse_opt_empty_m;
15331530
const cson_output_opt cson_output_opt_empty = cson_output_opt_empty_m;
15341531
const cson_object_iterator cson_object_iterator_empty = cson_object_iterator_empty_m;
15351532
const cson_buffer cson_buffer_empty = cson_buffer_empty_m;
15361533
const cson_parse_info cson_parse_info_empty = cson_parse_info_empty_m;
@@ -1661,11 +1658,11 @@
16611658
{
16621659
if((m >= (void const *)&CSON_EMPTY_HOLDER)
16631660
&& ( m < (void const *)(&CSON_EMPTY_HOLDER+1)))
16641661
return 1;
16651662
else return
1666
- ((m > (void const *)&CSON_SPECIAL_VALUES[0])
1663
+ ((m >= (void const *)&CSON_SPECIAL_VALUES[0])
16671664
&& ( m < (void const *)&CSON_SPECIAL_VALUES[CSON_INTERNAL_VALUES_LENGTH]) )
16681665
? 1
16691666
: 0;
16701667
}
16711668
@@ -1711,13 +1708,13 @@
17111708
malloc/free funcs because fossil's lack of header files
17121709
means we would have to #include "main.c" here to
17131710
get the declarations.
17141711
*/
17151712
#if defined(CSON_FOSSIL_MODE)
1716
-void *fossil_malloc(size_t n);
1717
-void fossil_free(void *p);
1718
-void *fossil_realloc(void *p, size_t n);
1713
+extern void *fossil_malloc(size_t n);
1714
+extern void fossil_free(void *p);
1715
+extern void *fossil_realloc(void *p, size_t n);
17191716
# define CSON_MALLOC_IMPL fossil_malloc
17201717
# define CSON_FREE_IMPL fossil_free
17211718
# define CSON_REALLOC_IMPL fossil_realloc
17221719
#endif
17231720
@@ -4380,11 +4377,11 @@
43804377
arg MUST be a (cson_buffer*). This function appends n bytes at
43814378
position arg->used, expanding the buffer as necessary.
43824379
*/
43834380
static int cson_data_dest_cson_buffer( void * arg, void const * data_, unsigned int n )
43844381
{
4385
- if( ! arg || (n<0) ) return cson_rc.ArgError;
4382
+ if( !arg ) return cson_rc.ArgError;
43864383
else if( ! n ) return 0;
43874384
else
43884385
{
43894386
cson_buffer * sb = (cson_buffer*)arg;
43904387
char const * data = (char const *)data_;
@@ -4500,11 +4497,10 @@
45004497
cson_value * cv = NULL;
45014498
cson_object const * curObj = obj;
45024499
enum { BufSize = 128 };
45034500
char buf[BufSize];
45044501
memset( buf, 0, BufSize );
4505
- rc = cson_rc.RangeError;
45064502
45074503
while( cson_next_token( &beg, sep, &end ) )
45084504
{
45094505
if( beg == end ) break;
45104506
else
45114507
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -1422,11 +1422,10 @@
1422 extern "C" {
1423 #endif
1424
1425
1426
1427
1428 /**
1429 This type holds the "vtbl" for type-specific operations when
1430 working with cson_value objects.
1431
1432 All cson_values of a given logical type share a pointer to a single
@@ -1524,13 +1523,11 @@
1524 */
1525 #define cson_value_empty_m { &cson_value_api_empty/*api*/, NULL/*value*/, 0/*refcount*/ }
1526 /**
1527 Empty-initialized cson_value object.
1528 */
1529 extern const cson_value cson_value_empty;
1530
1531 const cson_value cson_value_empty = cson_value_empty_m;
1532 const cson_parse_opt cson_parse_opt_empty = cson_parse_opt_empty_m;
1533 const cson_output_opt cson_output_opt_empty = cson_output_opt_empty_m;
1534 const cson_object_iterator cson_object_iterator_empty = cson_object_iterator_empty_m;
1535 const cson_buffer cson_buffer_empty = cson_buffer_empty_m;
1536 const cson_parse_info cson_parse_info_empty = cson_parse_info_empty_m;
@@ -1661,11 +1658,11 @@
1661 {
1662 if((m >= (void const *)&CSON_EMPTY_HOLDER)
1663 && ( m < (void const *)(&CSON_EMPTY_HOLDER+1)))
1664 return 1;
1665 else return
1666 ((m > (void const *)&CSON_SPECIAL_VALUES[0])
1667 && ( m < (void const *)&CSON_SPECIAL_VALUES[CSON_INTERNAL_VALUES_LENGTH]) )
1668 ? 1
1669 : 0;
1670 }
1671
@@ -1711,13 +1708,13 @@
1711 malloc/free funcs because fossil's lack of header files
1712 means we would have to #include "main.c" here to
1713 get the declarations.
1714 */
1715 #if defined(CSON_FOSSIL_MODE)
1716 void *fossil_malloc(size_t n);
1717 void fossil_free(void *p);
1718 void *fossil_realloc(void *p, size_t n);
1719 # define CSON_MALLOC_IMPL fossil_malloc
1720 # define CSON_FREE_IMPL fossil_free
1721 # define CSON_REALLOC_IMPL fossil_realloc
1722 #endif
1723
@@ -4380,11 +4377,11 @@
4380 arg MUST be a (cson_buffer*). This function appends n bytes at
4381 position arg->used, expanding the buffer as necessary.
4382 */
4383 static int cson_data_dest_cson_buffer( void * arg, void const * data_, unsigned int n )
4384 {
4385 if( ! arg || (n<0) ) return cson_rc.ArgError;
4386 else if( ! n ) return 0;
4387 else
4388 {
4389 cson_buffer * sb = (cson_buffer*)arg;
4390 char const * data = (char const *)data_;
@@ -4500,11 +4497,10 @@
4500 cson_value * cv = NULL;
4501 cson_object const * curObj = obj;
4502 enum { BufSize = 128 };
4503 char buf[BufSize];
4504 memset( buf, 0, BufSize );
4505 rc = cson_rc.RangeError;
4506
4507 while( cson_next_token( &beg, sep, &end ) )
4508 {
4509 if( beg == end ) break;
4510 else
4511
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -1422,11 +1422,10 @@
1422 extern "C" {
1423 #endif
1424
1425
1426
 
1427 /**
1428 This type holds the "vtbl" for type-specific operations when
1429 working with cson_value objects.
1430
1431 All cson_values of a given logical type share a pointer to a single
@@ -1524,13 +1523,11 @@
1523 */
1524 #define cson_value_empty_m { &cson_value_api_empty/*api*/, NULL/*value*/, 0/*refcount*/ }
1525 /**
1526 Empty-initialized cson_value object.
1527 */
1528 static const cson_value cson_value_empty = cson_value_empty_m;
 
 
1529 const cson_parse_opt cson_parse_opt_empty = cson_parse_opt_empty_m;
1530 const cson_output_opt cson_output_opt_empty = cson_output_opt_empty_m;
1531 const cson_object_iterator cson_object_iterator_empty = cson_object_iterator_empty_m;
1532 const cson_buffer cson_buffer_empty = cson_buffer_empty_m;
1533 const cson_parse_info cson_parse_info_empty = cson_parse_info_empty_m;
@@ -1661,11 +1658,11 @@
1658 {
1659 if((m >= (void const *)&CSON_EMPTY_HOLDER)
1660 && ( m < (void const *)(&CSON_EMPTY_HOLDER+1)))
1661 return 1;
1662 else return
1663 ((m >= (void const *)&CSON_SPECIAL_VALUES[0])
1664 && ( m < (void const *)&CSON_SPECIAL_VALUES[CSON_INTERNAL_VALUES_LENGTH]) )
1665 ? 1
1666 : 0;
1667 }
1668
@@ -1711,13 +1708,13 @@
1708 malloc/free funcs because fossil's lack of header files
1709 means we would have to #include "main.c" here to
1710 get the declarations.
1711 */
1712 #if defined(CSON_FOSSIL_MODE)
1713 extern void *fossil_malloc(size_t n);
1714 extern void fossil_free(void *p);
1715 extern void *fossil_realloc(void *p, size_t n);
1716 # define CSON_MALLOC_IMPL fossil_malloc
1717 # define CSON_FREE_IMPL fossil_free
1718 # define CSON_REALLOC_IMPL fossil_realloc
1719 #endif
1720
@@ -4380,11 +4377,11 @@
4377 arg MUST be a (cson_buffer*). This function appends n bytes at
4378 position arg->used, expanding the buffer as necessary.
4379 */
4380 static int cson_data_dest_cson_buffer( void * arg, void const * data_, unsigned int n )
4381 {
4382 if( !arg ) return cson_rc.ArgError;
4383 else if( ! n ) return 0;
4384 else
4385 {
4386 cson_buffer * sb = (cson_buffer*)arg;
4387 char const * data = (char const *)data_;
@@ -4500,11 +4497,10 @@
4497 cson_value * cv = NULL;
4498 cson_object const * curObj = obj;
4499 enum { BufSize = 128 };
4500 char buf[BufSize];
4501 memset( buf, 0, BufSize );
 
4502
4503 while( cson_next_token( &beg, sep, &end ) )
4504 {
4505 if( beg == end ) break;
4506 else
4507
--- src/cson_amalgamation.h
+++ src/cson_amalgamation.h
@@ -1236,11 +1236,14 @@
12361236
eventually either free the value using cson_value_free() or
12371237
inserting it into a container (array or object), which transfers
12381238
ownership to the container. See the cson_value class documentation
12391239
for more details.
12401240
1241
- Returns NULL on allocation error.
1241
+ Semantically speaking this function Returns NULL on allocation
1242
+ error, but the implementation never actually allocates for this
1243
+ case. Nonetheless, it must be treated as if it were an allocated
1244
+ value.
12421245
*/
12431246
cson_value * cson_value_new_bool( char v );
12441247
12451248
12461249
/**
@@ -1927,11 +1930,12 @@
19271930
modified.
19281931
19291932
buf->mem is owned by buf and must eventually be freed by passing an
19301933
n value of 0 to this function.
19311934
1932
- buf->used is never modified by this function.
1935
+ buf->used is never modified by this function unless n is 0, in which case
1936
+ it is reset.
19331937
*/
19341938
int cson_buffer_reserve( cson_buffer * buf, cson_size_t n );
19351939
19361940
/**
19371941
Fills all bytes of the given buffer with the given character.
19381942
--- src/cson_amalgamation.h
+++ src/cson_amalgamation.h
@@ -1236,11 +1236,14 @@
1236 eventually either free the value using cson_value_free() or
1237 inserting it into a container (array or object), which transfers
1238 ownership to the container. See the cson_value class documentation
1239 for more details.
1240
1241 Returns NULL on allocation error.
 
 
 
1242 */
1243 cson_value * cson_value_new_bool( char v );
1244
1245
1246 /**
@@ -1927,11 +1930,12 @@
1927 modified.
1928
1929 buf->mem is owned by buf and must eventually be freed by passing an
1930 n value of 0 to this function.
1931
1932 buf->used is never modified by this function.
 
1933 */
1934 int cson_buffer_reserve( cson_buffer * buf, cson_size_t n );
1935
1936 /**
1937 Fills all bytes of the given buffer with the given character.
1938
--- src/cson_amalgamation.h
+++ src/cson_amalgamation.h
@@ -1236,11 +1236,14 @@
1236 eventually either free the value using cson_value_free() or
1237 inserting it into a container (array or object), which transfers
1238 ownership to the container. See the cson_value class documentation
1239 for more details.
1240
1241 Semantically speaking this function Returns NULL on allocation
1242 error, but the implementation never actually allocates for this
1243 case. Nonetheless, it must be treated as if it were an allocated
1244 value.
1245 */
1246 cson_value * cson_value_new_bool( char v );
1247
1248
1249 /**
@@ -1927,11 +1930,12 @@
1930 modified.
1931
1932 buf->mem is owned by buf and must eventually be freed by passing an
1933 n value of 0 to this function.
1934
1935 buf->used is never modified by this function unless n is 0, in which case
1936 it is reset.
1937 */
1938 int cson_buffer_reserve( cson_buffer * buf, cson_size_t n );
1939
1940 /**
1941 Fills all bytes of the given buffer with the given character.
1942
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -90,11 +90,11 @@
9090
9191
/*
9292
** Return a pointer to a constant string that forms the basis
9393
** for a timeline query for the JSON interface.
9494
*/
95
-const char const * json_timeline_query(void){
95
+char const * json_timeline_query(void){
9696
/* Field order MUST match that from json_timeline_temp_table()!!! */
9797
static const char zBaseSql[] =
9898
@ SELECT
9999
@ NULL,
100100
@ blob.rid,
101101
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -90,11 +90,11 @@
90
91 /*
92 ** Return a pointer to a constant string that forms the basis
93 ** for a timeline query for the JSON interface.
94 */
95 const char const * json_timeline_query(void){
96 /* Field order MUST match that from json_timeline_temp_table()!!! */
97 static const char zBaseSql[] =
98 @ SELECT
99 @ NULL,
100 @ blob.rid,
101
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -90,11 +90,11 @@
90
91 /*
92 ** Return a pointer to a constant string that forms the basis
93 ** for a timeline query for the JSON interface.
94 */
95 char const * json_timeline_query(void){
96 /* Field order MUST match that from json_timeline_temp_table()!!! */
97 static const char zBaseSql[] =
98 @ SELECT
99 @ NULL,
100 @ blob.rid,
101

Keyboard Shortcuts

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