| | @@ -1422,11 +1422,10 @@ |
| 1422 | 1422 | extern "C" { |
| 1423 | 1423 | #endif |
| 1424 | 1424 | |
| 1425 | 1425 | |
| 1426 | 1426 | |
| 1427 | | - |
| 1428 | 1427 | /** |
| 1429 | 1428 | This type holds the "vtbl" for type-specific operations when |
| 1430 | 1429 | working with cson_value objects. |
| 1431 | 1430 | |
| 1432 | 1431 | All cson_values of a given logical type share a pointer to a single |
| | @@ -1524,13 +1523,11 @@ |
| 1524 | 1523 | */ |
| 1525 | 1524 | #define cson_value_empty_m { &cson_value_api_empty/*api*/, NULL/*value*/, 0/*refcount*/ } |
| 1526 | 1525 | /** |
| 1527 | 1526 | Empty-initialized cson_value object. |
| 1528 | 1527 | */ |
| 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; |
| 1532 | 1529 | const cson_parse_opt cson_parse_opt_empty = cson_parse_opt_empty_m; |
| 1533 | 1530 | const cson_output_opt cson_output_opt_empty = cson_output_opt_empty_m; |
| 1534 | 1531 | const cson_object_iterator cson_object_iterator_empty = cson_object_iterator_empty_m; |
| 1535 | 1532 | const cson_buffer cson_buffer_empty = cson_buffer_empty_m; |
| 1536 | 1533 | const cson_parse_info cson_parse_info_empty = cson_parse_info_empty_m; |
| | @@ -1661,11 +1658,11 @@ |
| 1661 | 1658 | { |
| 1662 | 1659 | if((m >= (void const *)&CSON_EMPTY_HOLDER) |
| 1663 | 1660 | && ( m < (void const *)(&CSON_EMPTY_HOLDER+1))) |
| 1664 | 1661 | return 1; |
| 1665 | 1662 | else return |
| 1666 | | - ((m > (void const *)&CSON_SPECIAL_VALUES[0]) |
| 1663 | + ((m >= (void const *)&CSON_SPECIAL_VALUES[0]) |
| 1667 | 1664 | && ( m < (void const *)&CSON_SPECIAL_VALUES[CSON_INTERNAL_VALUES_LENGTH]) ) |
| 1668 | 1665 | ? 1 |
| 1669 | 1666 | : 0; |
| 1670 | 1667 | } |
| 1671 | 1668 | |
| | @@ -1711,13 +1708,13 @@ |
| 1711 | 1708 | malloc/free funcs because fossil's lack of header files |
| 1712 | 1709 | means we would have to #include "main.c" here to |
| 1713 | 1710 | get the declarations. |
| 1714 | 1711 | */ |
| 1715 | 1712 | #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); |
| 1719 | 1716 | # define CSON_MALLOC_IMPL fossil_malloc |
| 1720 | 1717 | # define CSON_FREE_IMPL fossil_free |
| 1721 | 1718 | # define CSON_REALLOC_IMPL fossil_realloc |
| 1722 | 1719 | #endif |
| 1723 | 1720 | |
| | @@ -4380,11 +4377,11 @@ |
| 4380 | 4377 | arg MUST be a (cson_buffer*). This function appends n bytes at |
| 4381 | 4378 | position arg->used, expanding the buffer as necessary. |
| 4382 | 4379 | */ |
| 4383 | 4380 | static int cson_data_dest_cson_buffer( void * arg, void const * data_, unsigned int n ) |
| 4384 | 4381 | { |
| 4385 | | - if( ! arg || (n<0) ) return cson_rc.ArgError; |
| 4382 | + if( !arg ) return cson_rc.ArgError; |
| 4386 | 4383 | else if( ! n ) return 0; |
| 4387 | 4384 | else |
| 4388 | 4385 | { |
| 4389 | 4386 | cson_buffer * sb = (cson_buffer*)arg; |
| 4390 | 4387 | char const * data = (char const *)data_; |
| | @@ -4500,11 +4497,10 @@ |
| 4500 | 4497 | cson_value * cv = NULL; |
| 4501 | 4498 | cson_object const * curObj = obj; |
| 4502 | 4499 | enum { BufSize = 128 }; |
| 4503 | 4500 | char buf[BufSize]; |
| 4504 | 4501 | memset( buf, 0, BufSize ); |
| 4505 | | - rc = cson_rc.RangeError; |
| 4506 | 4502 | |
| 4507 | 4503 | while( cson_next_token( &beg, sep, &end ) ) |
| 4508 | 4504 | { |
| 4509 | 4505 | if( beg == end ) break; |
| 4510 | 4506 | else |
| 4511 | 4507 | |