Fossil SCM

Fix two more harmless gcc warning message (one of them as suggested by Stephan Beal)

jan.nijtmans 2016-06-14 12:07 trunk
Commit 6ef54dfaf7fd90a49ccd10c81a81cbc117a027ba
2 files changed +42 -42 +13 -14
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -19,14 +19,14 @@
1919
# define JSON_PARSER_DLL_API __declspec(dllexport)
2020
# else
2121
# define JSON_PARSER_DLL_API __declspec(dllimport)
2222
# endif
2323
# else
24
-# define JSON_PARSER_DLL_API
24
+# define JSON_PARSER_DLL_API
2525
# endif
2626
#else
27
-# define JSON_PARSER_DLL_API
27
+# define JSON_PARSER_DLL_API
2828
#endif
2929
3030
/* Determine the integer type use to parse non-floating point numbers */
3131
#ifdef _WIN32
3232
typedef __int64 JSON_int_t;
@@ -34,22 +34,22 @@
3434
#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%I64d"
3535
#elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
3636
typedef long long JSON_int_t;
3737
#define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld"
3838
#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld"
39
-#else
39
+#else
4040
typedef long JSON_int_t;
4141
#define JSON_PARSER_INTEGER_SSCANF_TOKEN "%ld"
4242
#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%ld"
4343
#endif
4444
4545
4646
#ifdef __cplusplus
4747
extern "C" {
48
-#endif
48
+#endif
4949
50
-typedef enum
50
+typedef enum
5151
{
5252
JSON_E_NONE = 0,
5353
JSON_E_INVALID_CHAR,
5454
JSON_E_INVALID_KEYWORD,
5555
JSON_E_INVALID_ESCAPE_SEQUENCE,
@@ -60,11 +60,11 @@
6060
JSON_E_EXPECTED_KEY,
6161
JSON_E_EXPECTED_COLON,
6262
JSON_E_OUT_OF_MEMORY
6363
} JSON_error;
6464
65
-typedef enum
65
+typedef enum
6666
{
6767
JSON_T_NONE = 0,
6868
JSON_T_ARRAY_BEGIN,
6969
JSON_T_ARRAY_END,
7070
JSON_T_OBJECT_BEGIN,
@@ -80,33 +80,33 @@
8080
} JSON_type;
8181
8282
typedef struct JSON_value_struct {
8383
union {
8484
JSON_int_t integer_value;
85
-
85
+
8686
double float_value;
87
-
87
+
8888
struct {
8989
const char* value;
9090
size_t length;
9191
} str;
9292
} vu;
9393
} JSON_value;
9494
9595
typedef struct JSON_parser_struct* JSON_parser;
9696
97
-/*! \brief JSON parser callback
97
+/*! \brief JSON parser callback
9898
9999
\param ctx The pointer passed to new_JSON_parser.
100
- \param type An element of JSON_type but not JSON_T_NONE.
100
+ \param type An element of JSON_type but not JSON_T_NONE.
101101
\param value A representation of the parsed value. This parameter is NULL for
102102
JSON_T_ARRAY_BEGIN, JSON_T_ARRAY_END, JSON_T_OBJECT_BEGIN, JSON_T_OBJECT_END,
103103
JSON_T_NULL, JSON_T_TRUE, and JSON_T_FALSE. String values are always returned
104104
as zero-terminated C strings.
105105
106106
\return Non-zero if parsing should continue, else zero.
107
-*/
107
+*/
108108
typedef int (*JSON_parser_callback)(void* ctx, int type, const JSON_value* value);
109109
110110
111111
/**
112112
A typedef for allocator functions semantically compatible with malloc().
@@ -115,11 +115,11 @@
115115
/**
116116
A typedef for deallocator functions semantically compatible with free().
117117
*/
118118
typedef void (*JSON_free_t)(void* mem);
119119
120
-/*! \brief The structure used to configure a JSON parser object
120
+/*! \brief The structure used to configure a JSON parser object
121121
*/
122122
typedef struct {
123123
/** Pointer to a callback, called when the parser has something to tell
124124
the user. This parameter may be NULL. In this case the input is
125125
merely checked for validity.
@@ -176,17 +176,17 @@
176176
177177
\param config. Used to configure the parser.
178178
*/
179179
JSON_PARSER_DLL_API void init_JSON_config(JSON_config * config);
180180
181
-/*! \brief Create a JSON parser object
181
+/*! \brief Create a JSON parser object
182182
183183
\param config. Used to configure the parser. Set to NULL to use
184184
the default configuration. See init_JSON_config. Its contents are
185185
copied by this function, so it need not outlive the returned
186186
object.
187
-
187
+
188188
\return The parser object, which is owned by the caller and must eventually
189189
be freed by calling delete_JSON_parser().
190190
*/
191191
JSON_PARSER_DLL_API JSON_parser new_JSON_parser(JSON_config const* config);
192192
@@ -200,16 +200,16 @@
200200
JSON_PARSER_DLL_API int JSON_parser_char(JSON_parser jc, int next_char);
201201
202202
/*! \brief Finalize parsing.
203203
204204
Call this method once after all input characters have been consumed.
205
-
205
+
206206
\return Non-zero, if all parsed characters are valid JSON, zero otherwise.
207207
*/
208208
JSON_PARSER_DLL_API int JSON_parser_done(JSON_parser jc);
209209
210
-/*! \brief Determine if a given string is valid JSON white space
210
+/*! \brief Determine if a given string is valid JSON white space
211211
212212
\return Non-zero if the string is valid, zero otherwise.
213213
*/
214214
JSON_PARSER_DLL_API int JSON_parser_is_legal_white_space_string(const char* s);
215215
@@ -226,12 +226,12 @@
226226
JSON_PARSER_DLL_API int JSON_parser_reset(JSON_parser jc);
227227
228228
229229
#ifdef __cplusplus
230230
}
231
-#endif
232
-
231
+#endif
232
+
233233
234234
#endif /* JSON_PARSER_H */
235235
/* end file parser/JSON_parser.h */
236236
/* begin file parser/JSON_parser.c */
237237
/*
@@ -1431,11 +1431,11 @@
14311431
#if defined(__cplusplus)
14321432
extern "C" {
14331433
#endif
14341434
14351435
1436
-
1436
+
14371437
/**
14381438
This type holds the "vtbl" for type-specific operations when
14391439
working with cson_value objects.
14401440
14411441
All cson_values of a given logical type share a pointer to a single
@@ -1607,11 +1607,11 @@
16071607
#define CSON_OBJ(V) CSON_CAST(cson_object,(V))
16081608
#define CSON_ARRAY(V) CSON_CAST(cson_array,(V))
16091609
16101610
/**
16111611
Holds special shared "constant" (though they are non-const)
1612
- values.
1612
+ values.
16131613
*/
16141614
static struct CSON_EMPTY_HOLDER_
16151615
{
16161616
char trueValue;
16171617
cson_string stringValue;
@@ -1620,17 +1620,17 @@
16201620
cson_string_empty_m
16211621
};
16221622
16231623
/**
16241624
Indexes into the CSON_SPECIAL_VALUES array.
1625
-
1625
+
16261626
If this enum changes in any way,
16271627
makes damned sure that CSON_SPECIAL_VALUES is updated
16281628
to match!!!
16291629
*/
16301630
enum CSON_INTERNAL_VALUES {
1631
-
1631
+
16321632
CSON_VAL_UNDEF = 0,
16331633
CSON_VAL_NULL = 1,
16341634
CSON_VAL_TRUE = 2,
16351635
CSON_VAL_FALSE = 3,
16361636
CSON_VAL_INT_0 = 4,
@@ -1642,11 +1642,11 @@
16421642
/**
16431643
Some "special" shared cson_value instances.
16441644
16451645
These values MUST be initialized in the order specified
16461646
by the CSON_INTERNAL_VALUES enum.
1647
-
1647
+
16481648
Note that they are not const because they are used as
16491649
shared-allocation objects in non-const contexts. However, the
16501650
public API provides no way to modifying them, and clients who
16511651
modify values directly are subject to The Wrath of Undefined
16521652
Behaviour.
@@ -1665,11 +1665,11 @@
16651665
16661666
/**
16671667
Returns non-0 (true) if m is one of our special
16681668
"built-in" values, e.g. from CSON_SPECIAL_VALUES and some
16691669
"empty" values.
1670
-
1670
+
16711671
If this returns true, m MUST NOT be free()d!
16721672
*/
16731673
static char cson_value_is_builtin( void const * m )
16741674
{
16751675
if((m >= (void const *)&CSON_EMPTY_HOLDER)
@@ -2183,11 +2183,11 @@
21832183
static int cson_value_list_visit( cson_value_list * self,
21842184
int (*visitor)(cson_value * obj, void * visitorState ),
21852185
void * visitorState );
21862186
#endif
21872187
#endif
2188
-
2188
+
21892189
#if 0
21902190
# define LIST_T cson_value_list
21912191
# define VALUE_T cson_value *
21922192
# define VALUE_T_IS_PTR 1
21932193
# define LIST_T cson_kvp_list
@@ -2362,11 +2362,11 @@
23622362
return cson_value_object_alloc();
23632363
}
23642364
23652365
cson_object * cson_new_object()
23662366
{
2367
-
2367
+
23682368
return cson_value_get_object( cson_value_new_object() );
23692369
}
23702370
23712371
cson_value * cson_value_new_array()
23722372
{
@@ -2608,11 +2608,11 @@
26082608
{
26092609
cson_int_t i = 0;
26102610
int rc = 0;
26112611
switch(val->api->typeID)
26122612
{
2613
- case CSON_TYPE_UNDEF:
2613
+ case CSON_TYPE_UNDEF:
26142614
case CSON_TYPE_NULL:
26152615
i = 0;
26162616
break;
26172617
case CSON_TYPE_BOOL: {
26182618
char b = 0;
@@ -2661,11 +2661,11 @@
26612661
{
26622662
cson_double_t d = 0.0;
26632663
int rc = 0;
26642664
switch(val->api->typeID)
26652665
{
2666
- case CSON_TYPE_UNDEF:
2666
+ case CSON_TYPE_UNDEF:
26672667
case CSON_TYPE_NULL:
26682668
d = 0;
26692669
break;
26702670
case CSON_TYPE_BOOL: {
26712671
char b = 0;
@@ -2791,11 +2791,11 @@
27912791
#if 0
27922792
/**
27932793
Removes and returns the last value from the given array,
27942794
shrinking its size by 1. Returns NULL if ar is NULL,
27952795
ar->list.count is 0, or the element at that index is NULL.
2796
-
2796
+
27972797
27982798
If removeRef is true then cson_value_free() is called to remove
27992799
ar's reference count for the value. In that case NULL is returned,
28002800
even if the object still has live references. If removeRef is false
28012801
then the caller takes over ownership of that reference count point.
@@ -2858,11 +2858,11 @@
28582858
#if !defined(NDEBUG) && CSON_VOID_PTR_IS_BIG
28592859
assert( sizeof(cson_int_t) <= sizeof(void *) );
28602860
#endif
28612861
if( c )
28622862
{
2863
- *CSON_INT(c) = v;
2863
+ memcpy(CSON_INT(c), &v, sizeof(v));
28642864
}
28652865
return c;
28662866
}
28672867
}
28682868
@@ -3068,11 +3068,11 @@
30683068
qsort( obj->kvp.list, obj->kvp.count, sizeof(cson_kvp*),
30693069
cson_kvp_cmp );
30703070
}
30713071
30723072
}
3073
-#endif
3073
+#endif
30743074
30753075
int cson_object_unset( cson_object * obj, char const * key )
30763076
{
30773077
if( ! obj || !key || !*key ) return cson_rc.ArgError;
30783078
else
@@ -3238,11 +3238,11 @@
32383238
using p->key. In any other case cson_rc.InternalError is returned.
32393239
32403240
Returns cson_rc.AllocError if an allocation fails.
32413241
32423242
Returns 0 on success. On error, parsing must be ceased immediately.
3243
-
3243
+
32443244
Ownership of val is ALWAYS TRANSFERED to this function. If this
32453245
function fails, val will be cleaned up and destroyed. (This
32463246
simplifies error handling in the core parser.)
32473247
*/
32483248
static int cson_parser_set_key( cson_parser * p, cson_value * val )
@@ -3485,11 +3485,11 @@
34853485
++p->totalKeyCount;
34863486
break;
34873487
}
34883488
case JSON_T_STRING: {
34893489
cson_value * v = cson_value_new_string( value->vu.str.value, value->vu.str.length );
3490
- rc = ( NULL == v )
3490
+ rc = ( NULL == v )
34913491
? cson_rc.AllocError
34923492
: cson_parser_push_value( p, v );
34933493
break;
34943494
}
34953495
default:
@@ -3532,11 +3532,11 @@
35323532
To properly take over ownership of the parser's root node on a
35333533
successful parse:
35343534
35353535
- Copy p->root's pointer and set p->root to NULL.
35363536
- Eventually free up p->root with cson_value_free().
3537
-
3537
+
35383538
If you do not set p->root to NULL, p->root will be freed along with
35393539
any other items inserted into it (or under it) during the parsing
35403540
process.
35413541
*/
35423542
static int cson_parser_clean( cson_parser * p )
@@ -3571,11 +3571,11 @@
35713571
int rc = 0;
35723572
unsigned int len = 1;
35733573
cson_parse_info info = info_ ? *info_ : cson_parse_info_empty;
35743574
cson_parser p = cson_parser_empty;
35753575
if( ! tgt || ! src ) return cson_rc.ArgError;
3576
-
3576
+
35773577
{
35783578
JSON_config jopt = {0};
35793579
init_JSON_config( &jopt );
35803580
jopt.allow_comments = opt.allowComments;
35813581
jopt.depth = opt.maxDepth;
@@ -4640,11 +4640,11 @@
46404640
#endif
46414641
#undef TRY_SHARING
46424642
cson_value_add_reference(rc);
46434643
return rc;
46444644
}
4645
-
4645
+
46464646
static cson_value * cson_value_clone_array( cson_value const * orig )
46474647
{
46484648
unsigned int i = 0;
46494649
cson_array const * asrc = cson_value_get_array( orig );
46504650
unsigned int alen = cson_array_length_get( asrc );
@@ -4680,11 +4680,11 @@
46804680
cson_value_free(cl)/*remove our artificial reference */;
46814681
}
46824682
}
46834683
return destV;
46844684
}
4685
-
4685
+
46864686
static cson_value * cson_value_clone_object( cson_value const * orig )
46874687
{
46884688
cson_object const * src = cson_value_get_object( orig );
46894689
cson_value * destV = NULL;
46904690
cson_object * dest = NULL;
@@ -4834,11 +4834,11 @@
48344834
}
48354835
case CSON_TYPE_STRING: {
48364836
cson_string const * jstr = cson_value_get_string(orig);
48374837
unsigned const int slen = cson_string_length_bytes( jstr );
48384838
assert( NULL != jstr );
4839
- v = cson_strdup( cson_string_cstr( jstr ), slen );
4839
+ v = cson_strdup( cson_string_cstr( jstr ), slen );
48404840
break;
48414841
}
48424842
case CSON_TYPE_INTEGER: {
48434843
char buf[BufSize] = {0};
48444844
if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) )
@@ -4887,11 +4887,11 @@
48874887
}
48884888
case CSON_TYPE_STRING: {
48894889
cson_string const * jstr = cson_value_get_string(orig);
48904890
unsigned const int slen = cson_string_length_bytes( jstr );
48914891
assert( NULL != jstr );
4892
- v = cson_strdup( cson_string_cstr( jstr ), slen );
4892
+ v = cson_strdup( cson_string_cstr( jstr ), slen );
48934893
break;
48944894
}
48954895
case CSON_TYPE_INTEGER: {
48964896
char buf[BufSize] = {0};
48974897
if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) )
@@ -5351,11 +5351,11 @@
53515351
int rc = 0;
53525352
int colCount = 0;
53535353
assert(st);
53545354
colCount = sqlite3_column_count(st);
53555355
if( colCount <= 0 ) return NULL;
5356
-
5356
+
53575357
aryV = cson_value_new_array();
53585358
if( ! aryV ) return NULL;
53595359
ary = cson_value_get_array(aryV);
53605360
assert(ary);
53615361
for( i = 0; (0 ==rc) && (i < colCount); ++i )
@@ -5491,11 +5491,11 @@
54915491
aryV = NULL;
54925492
end:
54935493
return aryV;
54945494
}
54955495
5496
-
5496
+
54975497
/**
54985498
Internal impl of cson_sqlite3_stmt_to_json() when the 'fat'
54995499
parameter is non-0.
55005500
*/
55015501
static int cson_sqlite3_stmt_to_json_fat( sqlite3_stmt * st, cson_value ** tgt )
@@ -5636,11 +5636,11 @@
56365636
int rc = sqlite3_prepare_v2( db, sql, -1, &st, NULL );
56375637
if( 0 != rc ) return cson_rc.IOError /* FIXME: Better error code? */;
56385638
rc = cson_sqlite3_stmt_to_json( st, tgt, fat );
56395639
sqlite3_finalize( st );
56405640
return rc;
5641
- }
5641
+ }
56425642
}
56435643
56445644
int cson_sqlite3_bind_value( sqlite3_stmt * st, int ndx, cson_value const * v )
56455645
{
56465646
int rc = 0;
56475647
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -19,14 +19,14 @@
19 # define JSON_PARSER_DLL_API __declspec(dllexport)
20 # else
21 # define JSON_PARSER_DLL_API __declspec(dllimport)
22 # endif
23 # else
24 # define JSON_PARSER_DLL_API
25 # endif
26 #else
27 # define JSON_PARSER_DLL_API
28 #endif
29
30 /* Determine the integer type use to parse non-floating point numbers */
31 #ifdef _WIN32
32 typedef __int64 JSON_int_t;
@@ -34,22 +34,22 @@
34 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%I64d"
35 #elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
36 typedef long long JSON_int_t;
37 #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld"
38 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld"
39 #else
40 typedef long JSON_int_t;
41 #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%ld"
42 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%ld"
43 #endif
44
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 typedef enum
51 {
52 JSON_E_NONE = 0,
53 JSON_E_INVALID_CHAR,
54 JSON_E_INVALID_KEYWORD,
55 JSON_E_INVALID_ESCAPE_SEQUENCE,
@@ -60,11 +60,11 @@
60 JSON_E_EXPECTED_KEY,
61 JSON_E_EXPECTED_COLON,
62 JSON_E_OUT_OF_MEMORY
63 } JSON_error;
64
65 typedef enum
66 {
67 JSON_T_NONE = 0,
68 JSON_T_ARRAY_BEGIN,
69 JSON_T_ARRAY_END,
70 JSON_T_OBJECT_BEGIN,
@@ -80,33 +80,33 @@
80 } JSON_type;
81
82 typedef struct JSON_value_struct {
83 union {
84 JSON_int_t integer_value;
85
86 double float_value;
87
88 struct {
89 const char* value;
90 size_t length;
91 } str;
92 } vu;
93 } JSON_value;
94
95 typedef struct JSON_parser_struct* JSON_parser;
96
97 /*! \brief JSON parser callback
98
99 \param ctx The pointer passed to new_JSON_parser.
100 \param type An element of JSON_type but not JSON_T_NONE.
101 \param value A representation of the parsed value. This parameter is NULL for
102 JSON_T_ARRAY_BEGIN, JSON_T_ARRAY_END, JSON_T_OBJECT_BEGIN, JSON_T_OBJECT_END,
103 JSON_T_NULL, JSON_T_TRUE, and JSON_T_FALSE. String values are always returned
104 as zero-terminated C strings.
105
106 \return Non-zero if parsing should continue, else zero.
107 */
108 typedef int (*JSON_parser_callback)(void* ctx, int type, const JSON_value* value);
109
110
111 /**
112 A typedef for allocator functions semantically compatible with malloc().
@@ -115,11 +115,11 @@
115 /**
116 A typedef for deallocator functions semantically compatible with free().
117 */
118 typedef void (*JSON_free_t)(void* mem);
119
120 /*! \brief The structure used to configure a JSON parser object
121 */
122 typedef struct {
123 /** Pointer to a callback, called when the parser has something to tell
124 the user. This parameter may be NULL. In this case the input is
125 merely checked for validity.
@@ -176,17 +176,17 @@
176
177 \param config. Used to configure the parser.
178 */
179 JSON_PARSER_DLL_API void init_JSON_config(JSON_config * config);
180
181 /*! \brief Create a JSON parser object
182
183 \param config. Used to configure the parser. Set to NULL to use
184 the default configuration. See init_JSON_config. Its contents are
185 copied by this function, so it need not outlive the returned
186 object.
187
188 \return The parser object, which is owned by the caller and must eventually
189 be freed by calling delete_JSON_parser().
190 */
191 JSON_PARSER_DLL_API JSON_parser new_JSON_parser(JSON_config const* config);
192
@@ -200,16 +200,16 @@
200 JSON_PARSER_DLL_API int JSON_parser_char(JSON_parser jc, int next_char);
201
202 /*! \brief Finalize parsing.
203
204 Call this method once after all input characters have been consumed.
205
206 \return Non-zero, if all parsed characters are valid JSON, zero otherwise.
207 */
208 JSON_PARSER_DLL_API int JSON_parser_done(JSON_parser jc);
209
210 /*! \brief Determine if a given string is valid JSON white space
211
212 \return Non-zero if the string is valid, zero otherwise.
213 */
214 JSON_PARSER_DLL_API int JSON_parser_is_legal_white_space_string(const char* s);
215
@@ -226,12 +226,12 @@
226 JSON_PARSER_DLL_API int JSON_parser_reset(JSON_parser jc);
227
228
229 #ifdef __cplusplus
230 }
231 #endif
232
233
234 #endif /* JSON_PARSER_H */
235 /* end file parser/JSON_parser.h */
236 /* begin file parser/JSON_parser.c */
237 /*
@@ -1431,11 +1431,11 @@
1431 #if defined(__cplusplus)
1432 extern "C" {
1433 #endif
1434
1435
1436
1437 /**
1438 This type holds the "vtbl" for type-specific operations when
1439 working with cson_value objects.
1440
1441 All cson_values of a given logical type share a pointer to a single
@@ -1607,11 +1607,11 @@
1607 #define CSON_OBJ(V) CSON_CAST(cson_object,(V))
1608 #define CSON_ARRAY(V) CSON_CAST(cson_array,(V))
1609
1610 /**
1611 Holds special shared "constant" (though they are non-const)
1612 values.
1613 */
1614 static struct CSON_EMPTY_HOLDER_
1615 {
1616 char trueValue;
1617 cson_string stringValue;
@@ -1620,17 +1620,17 @@
1620 cson_string_empty_m
1621 };
1622
1623 /**
1624 Indexes into the CSON_SPECIAL_VALUES array.
1625
1626 If this enum changes in any way,
1627 makes damned sure that CSON_SPECIAL_VALUES is updated
1628 to match!!!
1629 */
1630 enum CSON_INTERNAL_VALUES {
1631
1632 CSON_VAL_UNDEF = 0,
1633 CSON_VAL_NULL = 1,
1634 CSON_VAL_TRUE = 2,
1635 CSON_VAL_FALSE = 3,
1636 CSON_VAL_INT_0 = 4,
@@ -1642,11 +1642,11 @@
1642 /**
1643 Some "special" shared cson_value instances.
1644
1645 These values MUST be initialized in the order specified
1646 by the CSON_INTERNAL_VALUES enum.
1647
1648 Note that they are not const because they are used as
1649 shared-allocation objects in non-const contexts. However, the
1650 public API provides no way to modifying them, and clients who
1651 modify values directly are subject to The Wrath of Undefined
1652 Behaviour.
@@ -1665,11 +1665,11 @@
1665
1666 /**
1667 Returns non-0 (true) if m is one of our special
1668 "built-in" values, e.g. from CSON_SPECIAL_VALUES and some
1669 "empty" values.
1670
1671 If this returns true, m MUST NOT be free()d!
1672 */
1673 static char cson_value_is_builtin( void const * m )
1674 {
1675 if((m >= (void const *)&CSON_EMPTY_HOLDER)
@@ -2183,11 +2183,11 @@
2183 static int cson_value_list_visit( cson_value_list * self,
2184 int (*visitor)(cson_value * obj, void * visitorState ),
2185 void * visitorState );
2186 #endif
2187 #endif
2188
2189 #if 0
2190 # define LIST_T cson_value_list
2191 # define VALUE_T cson_value *
2192 # define VALUE_T_IS_PTR 1
2193 # define LIST_T cson_kvp_list
@@ -2362,11 +2362,11 @@
2362 return cson_value_object_alloc();
2363 }
2364
2365 cson_object * cson_new_object()
2366 {
2367
2368 return cson_value_get_object( cson_value_new_object() );
2369 }
2370
2371 cson_value * cson_value_new_array()
2372 {
@@ -2608,11 +2608,11 @@
2608 {
2609 cson_int_t i = 0;
2610 int rc = 0;
2611 switch(val->api->typeID)
2612 {
2613 case CSON_TYPE_UNDEF:
2614 case CSON_TYPE_NULL:
2615 i = 0;
2616 break;
2617 case CSON_TYPE_BOOL: {
2618 char b = 0;
@@ -2661,11 +2661,11 @@
2661 {
2662 cson_double_t d = 0.0;
2663 int rc = 0;
2664 switch(val->api->typeID)
2665 {
2666 case CSON_TYPE_UNDEF:
2667 case CSON_TYPE_NULL:
2668 d = 0;
2669 break;
2670 case CSON_TYPE_BOOL: {
2671 char b = 0;
@@ -2791,11 +2791,11 @@
2791 #if 0
2792 /**
2793 Removes and returns the last value from the given array,
2794 shrinking its size by 1. Returns NULL if ar is NULL,
2795 ar->list.count is 0, or the element at that index is NULL.
2796
2797
2798 If removeRef is true then cson_value_free() is called to remove
2799 ar's reference count for the value. In that case NULL is returned,
2800 even if the object still has live references. If removeRef is false
2801 then the caller takes over ownership of that reference count point.
@@ -2858,11 +2858,11 @@
2858 #if !defined(NDEBUG) && CSON_VOID_PTR_IS_BIG
2859 assert( sizeof(cson_int_t) <= sizeof(void *) );
2860 #endif
2861 if( c )
2862 {
2863 *CSON_INT(c) = v;
2864 }
2865 return c;
2866 }
2867 }
2868
@@ -3068,11 +3068,11 @@
3068 qsort( obj->kvp.list, obj->kvp.count, sizeof(cson_kvp*),
3069 cson_kvp_cmp );
3070 }
3071
3072 }
3073 #endif
3074
3075 int cson_object_unset( cson_object * obj, char const * key )
3076 {
3077 if( ! obj || !key || !*key ) return cson_rc.ArgError;
3078 else
@@ -3238,11 +3238,11 @@
3238 using p->key. In any other case cson_rc.InternalError is returned.
3239
3240 Returns cson_rc.AllocError if an allocation fails.
3241
3242 Returns 0 on success. On error, parsing must be ceased immediately.
3243
3244 Ownership of val is ALWAYS TRANSFERED to this function. If this
3245 function fails, val will be cleaned up and destroyed. (This
3246 simplifies error handling in the core parser.)
3247 */
3248 static int cson_parser_set_key( cson_parser * p, cson_value * val )
@@ -3485,11 +3485,11 @@
3485 ++p->totalKeyCount;
3486 break;
3487 }
3488 case JSON_T_STRING: {
3489 cson_value * v = cson_value_new_string( value->vu.str.value, value->vu.str.length );
3490 rc = ( NULL == v )
3491 ? cson_rc.AllocError
3492 : cson_parser_push_value( p, v );
3493 break;
3494 }
3495 default:
@@ -3532,11 +3532,11 @@
3532 To properly take over ownership of the parser's root node on a
3533 successful parse:
3534
3535 - Copy p->root's pointer and set p->root to NULL.
3536 - Eventually free up p->root with cson_value_free().
3537
3538 If you do not set p->root to NULL, p->root will be freed along with
3539 any other items inserted into it (or under it) during the parsing
3540 process.
3541 */
3542 static int cson_parser_clean( cson_parser * p )
@@ -3571,11 +3571,11 @@
3571 int rc = 0;
3572 unsigned int len = 1;
3573 cson_parse_info info = info_ ? *info_ : cson_parse_info_empty;
3574 cson_parser p = cson_parser_empty;
3575 if( ! tgt || ! src ) return cson_rc.ArgError;
3576
3577 {
3578 JSON_config jopt = {0};
3579 init_JSON_config( &jopt );
3580 jopt.allow_comments = opt.allowComments;
3581 jopt.depth = opt.maxDepth;
@@ -4640,11 +4640,11 @@
4640 #endif
4641 #undef TRY_SHARING
4642 cson_value_add_reference(rc);
4643 return rc;
4644 }
4645
4646 static cson_value * cson_value_clone_array( cson_value const * orig )
4647 {
4648 unsigned int i = 0;
4649 cson_array const * asrc = cson_value_get_array( orig );
4650 unsigned int alen = cson_array_length_get( asrc );
@@ -4680,11 +4680,11 @@
4680 cson_value_free(cl)/*remove our artificial reference */;
4681 }
4682 }
4683 return destV;
4684 }
4685
4686 static cson_value * cson_value_clone_object( cson_value const * orig )
4687 {
4688 cson_object const * src = cson_value_get_object( orig );
4689 cson_value * destV = NULL;
4690 cson_object * dest = NULL;
@@ -4834,11 +4834,11 @@
4834 }
4835 case CSON_TYPE_STRING: {
4836 cson_string const * jstr = cson_value_get_string(orig);
4837 unsigned const int slen = cson_string_length_bytes( jstr );
4838 assert( NULL != jstr );
4839 v = cson_strdup( cson_string_cstr( jstr ), slen );
4840 break;
4841 }
4842 case CSON_TYPE_INTEGER: {
4843 char buf[BufSize] = {0};
4844 if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) )
@@ -4887,11 +4887,11 @@
4887 }
4888 case CSON_TYPE_STRING: {
4889 cson_string const * jstr = cson_value_get_string(orig);
4890 unsigned const int slen = cson_string_length_bytes( jstr );
4891 assert( NULL != jstr );
4892 v = cson_strdup( cson_string_cstr( jstr ), slen );
4893 break;
4894 }
4895 case CSON_TYPE_INTEGER: {
4896 char buf[BufSize] = {0};
4897 if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) )
@@ -5351,11 +5351,11 @@
5351 int rc = 0;
5352 int colCount = 0;
5353 assert(st);
5354 colCount = sqlite3_column_count(st);
5355 if( colCount <= 0 ) return NULL;
5356
5357 aryV = cson_value_new_array();
5358 if( ! aryV ) return NULL;
5359 ary = cson_value_get_array(aryV);
5360 assert(ary);
5361 for( i = 0; (0 ==rc) && (i < colCount); ++i )
@@ -5491,11 +5491,11 @@
5491 aryV = NULL;
5492 end:
5493 return aryV;
5494 }
5495
5496
5497 /**
5498 Internal impl of cson_sqlite3_stmt_to_json() when the 'fat'
5499 parameter is non-0.
5500 */
5501 static int cson_sqlite3_stmt_to_json_fat( sqlite3_stmt * st, cson_value ** tgt )
@@ -5636,11 +5636,11 @@
5636 int rc = sqlite3_prepare_v2( db, sql, -1, &st, NULL );
5637 if( 0 != rc ) return cson_rc.IOError /* FIXME: Better error code? */;
5638 rc = cson_sqlite3_stmt_to_json( st, tgt, fat );
5639 sqlite3_finalize( st );
5640 return rc;
5641 }
5642 }
5643
5644 int cson_sqlite3_bind_value( sqlite3_stmt * st, int ndx, cson_value const * v )
5645 {
5646 int rc = 0;
5647
--- src/cson_amalgamation.c
+++ src/cson_amalgamation.c
@@ -19,14 +19,14 @@
19 # define JSON_PARSER_DLL_API __declspec(dllexport)
20 # else
21 # define JSON_PARSER_DLL_API __declspec(dllimport)
22 # endif
23 # else
24 # define JSON_PARSER_DLL_API
25 # endif
26 #else
27 # define JSON_PARSER_DLL_API
28 #endif
29
30 /* Determine the integer type use to parse non-floating point numbers */
31 #ifdef _WIN32
32 typedef __int64 JSON_int_t;
@@ -34,22 +34,22 @@
34 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%I64d"
35 #elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1)
36 typedef long long JSON_int_t;
37 #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld"
38 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld"
39 #else
40 typedef long JSON_int_t;
41 #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%ld"
42 #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%ld"
43 #endif
44
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 typedef enum
51 {
52 JSON_E_NONE = 0,
53 JSON_E_INVALID_CHAR,
54 JSON_E_INVALID_KEYWORD,
55 JSON_E_INVALID_ESCAPE_SEQUENCE,
@@ -60,11 +60,11 @@
60 JSON_E_EXPECTED_KEY,
61 JSON_E_EXPECTED_COLON,
62 JSON_E_OUT_OF_MEMORY
63 } JSON_error;
64
65 typedef enum
66 {
67 JSON_T_NONE = 0,
68 JSON_T_ARRAY_BEGIN,
69 JSON_T_ARRAY_END,
70 JSON_T_OBJECT_BEGIN,
@@ -80,33 +80,33 @@
80 } JSON_type;
81
82 typedef struct JSON_value_struct {
83 union {
84 JSON_int_t integer_value;
85
86 double float_value;
87
88 struct {
89 const char* value;
90 size_t length;
91 } str;
92 } vu;
93 } JSON_value;
94
95 typedef struct JSON_parser_struct* JSON_parser;
96
97 /*! \brief JSON parser callback
98
99 \param ctx The pointer passed to new_JSON_parser.
100 \param type An element of JSON_type but not JSON_T_NONE.
101 \param value A representation of the parsed value. This parameter is NULL for
102 JSON_T_ARRAY_BEGIN, JSON_T_ARRAY_END, JSON_T_OBJECT_BEGIN, JSON_T_OBJECT_END,
103 JSON_T_NULL, JSON_T_TRUE, and JSON_T_FALSE. String values are always returned
104 as zero-terminated C strings.
105
106 \return Non-zero if parsing should continue, else zero.
107 */
108 typedef int (*JSON_parser_callback)(void* ctx, int type, const JSON_value* value);
109
110
111 /**
112 A typedef for allocator functions semantically compatible with malloc().
@@ -115,11 +115,11 @@
115 /**
116 A typedef for deallocator functions semantically compatible with free().
117 */
118 typedef void (*JSON_free_t)(void* mem);
119
120 /*! \brief The structure used to configure a JSON parser object
121 */
122 typedef struct {
123 /** Pointer to a callback, called when the parser has something to tell
124 the user. This parameter may be NULL. In this case the input is
125 merely checked for validity.
@@ -176,17 +176,17 @@
176
177 \param config. Used to configure the parser.
178 */
179 JSON_PARSER_DLL_API void init_JSON_config(JSON_config * config);
180
181 /*! \brief Create a JSON parser object
182
183 \param config. Used to configure the parser. Set to NULL to use
184 the default configuration. See init_JSON_config. Its contents are
185 copied by this function, so it need not outlive the returned
186 object.
187
188 \return The parser object, which is owned by the caller and must eventually
189 be freed by calling delete_JSON_parser().
190 */
191 JSON_PARSER_DLL_API JSON_parser new_JSON_parser(JSON_config const* config);
192
@@ -200,16 +200,16 @@
200 JSON_PARSER_DLL_API int JSON_parser_char(JSON_parser jc, int next_char);
201
202 /*! \brief Finalize parsing.
203
204 Call this method once after all input characters have been consumed.
205
206 \return Non-zero, if all parsed characters are valid JSON, zero otherwise.
207 */
208 JSON_PARSER_DLL_API int JSON_parser_done(JSON_parser jc);
209
210 /*! \brief Determine if a given string is valid JSON white space
211
212 \return Non-zero if the string is valid, zero otherwise.
213 */
214 JSON_PARSER_DLL_API int JSON_parser_is_legal_white_space_string(const char* s);
215
@@ -226,12 +226,12 @@
226 JSON_PARSER_DLL_API int JSON_parser_reset(JSON_parser jc);
227
228
229 #ifdef __cplusplus
230 }
231 #endif
232
233
234 #endif /* JSON_PARSER_H */
235 /* end file parser/JSON_parser.h */
236 /* begin file parser/JSON_parser.c */
237 /*
@@ -1431,11 +1431,11 @@
1431 #if defined(__cplusplus)
1432 extern "C" {
1433 #endif
1434
1435
1436
1437 /**
1438 This type holds the "vtbl" for type-specific operations when
1439 working with cson_value objects.
1440
1441 All cson_values of a given logical type share a pointer to a single
@@ -1607,11 +1607,11 @@
1607 #define CSON_OBJ(V) CSON_CAST(cson_object,(V))
1608 #define CSON_ARRAY(V) CSON_CAST(cson_array,(V))
1609
1610 /**
1611 Holds special shared "constant" (though they are non-const)
1612 values.
1613 */
1614 static struct CSON_EMPTY_HOLDER_
1615 {
1616 char trueValue;
1617 cson_string stringValue;
@@ -1620,17 +1620,17 @@
1620 cson_string_empty_m
1621 };
1622
1623 /**
1624 Indexes into the CSON_SPECIAL_VALUES array.
1625
1626 If this enum changes in any way,
1627 makes damned sure that CSON_SPECIAL_VALUES is updated
1628 to match!!!
1629 */
1630 enum CSON_INTERNAL_VALUES {
1631
1632 CSON_VAL_UNDEF = 0,
1633 CSON_VAL_NULL = 1,
1634 CSON_VAL_TRUE = 2,
1635 CSON_VAL_FALSE = 3,
1636 CSON_VAL_INT_0 = 4,
@@ -1642,11 +1642,11 @@
1642 /**
1643 Some "special" shared cson_value instances.
1644
1645 These values MUST be initialized in the order specified
1646 by the CSON_INTERNAL_VALUES enum.
1647
1648 Note that they are not const because they are used as
1649 shared-allocation objects in non-const contexts. However, the
1650 public API provides no way to modifying them, and clients who
1651 modify values directly are subject to The Wrath of Undefined
1652 Behaviour.
@@ -1665,11 +1665,11 @@
1665
1666 /**
1667 Returns non-0 (true) if m is one of our special
1668 "built-in" values, e.g. from CSON_SPECIAL_VALUES and some
1669 "empty" values.
1670
1671 If this returns true, m MUST NOT be free()d!
1672 */
1673 static char cson_value_is_builtin( void const * m )
1674 {
1675 if((m >= (void const *)&CSON_EMPTY_HOLDER)
@@ -2183,11 +2183,11 @@
2183 static int cson_value_list_visit( cson_value_list * self,
2184 int (*visitor)(cson_value * obj, void * visitorState ),
2185 void * visitorState );
2186 #endif
2187 #endif
2188
2189 #if 0
2190 # define LIST_T cson_value_list
2191 # define VALUE_T cson_value *
2192 # define VALUE_T_IS_PTR 1
2193 # define LIST_T cson_kvp_list
@@ -2362,11 +2362,11 @@
2362 return cson_value_object_alloc();
2363 }
2364
2365 cson_object * cson_new_object()
2366 {
2367
2368 return cson_value_get_object( cson_value_new_object() );
2369 }
2370
2371 cson_value * cson_value_new_array()
2372 {
@@ -2608,11 +2608,11 @@
2608 {
2609 cson_int_t i = 0;
2610 int rc = 0;
2611 switch(val->api->typeID)
2612 {
2613 case CSON_TYPE_UNDEF:
2614 case CSON_TYPE_NULL:
2615 i = 0;
2616 break;
2617 case CSON_TYPE_BOOL: {
2618 char b = 0;
@@ -2661,11 +2661,11 @@
2661 {
2662 cson_double_t d = 0.0;
2663 int rc = 0;
2664 switch(val->api->typeID)
2665 {
2666 case CSON_TYPE_UNDEF:
2667 case CSON_TYPE_NULL:
2668 d = 0;
2669 break;
2670 case CSON_TYPE_BOOL: {
2671 char b = 0;
@@ -2791,11 +2791,11 @@
2791 #if 0
2792 /**
2793 Removes and returns the last value from the given array,
2794 shrinking its size by 1. Returns NULL if ar is NULL,
2795 ar->list.count is 0, or the element at that index is NULL.
2796
2797
2798 If removeRef is true then cson_value_free() is called to remove
2799 ar's reference count for the value. In that case NULL is returned,
2800 even if the object still has live references. If removeRef is false
2801 then the caller takes over ownership of that reference count point.
@@ -2858,11 +2858,11 @@
2858 #if !defined(NDEBUG) && CSON_VOID_PTR_IS_BIG
2859 assert( sizeof(cson_int_t) <= sizeof(void *) );
2860 #endif
2861 if( c )
2862 {
2863 memcpy(CSON_INT(c), &v, sizeof(v));
2864 }
2865 return c;
2866 }
2867 }
2868
@@ -3068,11 +3068,11 @@
3068 qsort( obj->kvp.list, obj->kvp.count, sizeof(cson_kvp*),
3069 cson_kvp_cmp );
3070 }
3071
3072 }
3073 #endif
3074
3075 int cson_object_unset( cson_object * obj, char const * key )
3076 {
3077 if( ! obj || !key || !*key ) return cson_rc.ArgError;
3078 else
@@ -3238,11 +3238,11 @@
3238 using p->key. In any other case cson_rc.InternalError is returned.
3239
3240 Returns cson_rc.AllocError if an allocation fails.
3241
3242 Returns 0 on success. On error, parsing must be ceased immediately.
3243
3244 Ownership of val is ALWAYS TRANSFERED to this function. If this
3245 function fails, val will be cleaned up and destroyed. (This
3246 simplifies error handling in the core parser.)
3247 */
3248 static int cson_parser_set_key( cson_parser * p, cson_value * val )
@@ -3485,11 +3485,11 @@
3485 ++p->totalKeyCount;
3486 break;
3487 }
3488 case JSON_T_STRING: {
3489 cson_value * v = cson_value_new_string( value->vu.str.value, value->vu.str.length );
3490 rc = ( NULL == v )
3491 ? cson_rc.AllocError
3492 : cson_parser_push_value( p, v );
3493 break;
3494 }
3495 default:
@@ -3532,11 +3532,11 @@
3532 To properly take over ownership of the parser's root node on a
3533 successful parse:
3534
3535 - Copy p->root's pointer and set p->root to NULL.
3536 - Eventually free up p->root with cson_value_free().
3537
3538 If you do not set p->root to NULL, p->root will be freed along with
3539 any other items inserted into it (or under it) during the parsing
3540 process.
3541 */
3542 static int cson_parser_clean( cson_parser * p )
@@ -3571,11 +3571,11 @@
3571 int rc = 0;
3572 unsigned int len = 1;
3573 cson_parse_info info = info_ ? *info_ : cson_parse_info_empty;
3574 cson_parser p = cson_parser_empty;
3575 if( ! tgt || ! src ) return cson_rc.ArgError;
3576
3577 {
3578 JSON_config jopt = {0};
3579 init_JSON_config( &jopt );
3580 jopt.allow_comments = opt.allowComments;
3581 jopt.depth = opt.maxDepth;
@@ -4640,11 +4640,11 @@
4640 #endif
4641 #undef TRY_SHARING
4642 cson_value_add_reference(rc);
4643 return rc;
4644 }
4645
4646 static cson_value * cson_value_clone_array( cson_value const * orig )
4647 {
4648 unsigned int i = 0;
4649 cson_array const * asrc = cson_value_get_array( orig );
4650 unsigned int alen = cson_array_length_get( asrc );
@@ -4680,11 +4680,11 @@
4680 cson_value_free(cl)/*remove our artificial reference */;
4681 }
4682 }
4683 return destV;
4684 }
4685
4686 static cson_value * cson_value_clone_object( cson_value const * orig )
4687 {
4688 cson_object const * src = cson_value_get_object( orig );
4689 cson_value * destV = NULL;
4690 cson_object * dest = NULL;
@@ -4834,11 +4834,11 @@
4834 }
4835 case CSON_TYPE_STRING: {
4836 cson_string const * jstr = cson_value_get_string(orig);
4837 unsigned const int slen = cson_string_length_bytes( jstr );
4838 assert( NULL != jstr );
4839 v = cson_strdup( cson_string_cstr( jstr ), slen );
4840 break;
4841 }
4842 case CSON_TYPE_INTEGER: {
4843 char buf[BufSize] = {0};
4844 if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) )
@@ -4887,11 +4887,11 @@
4887 }
4888 case CSON_TYPE_STRING: {
4889 cson_string const * jstr = cson_value_get_string(orig);
4890 unsigned const int slen = cson_string_length_bytes( jstr );
4891 assert( NULL != jstr );
4892 v = cson_strdup( cson_string_cstr( jstr ), slen );
4893 break;
4894 }
4895 case CSON_TYPE_INTEGER: {
4896 char buf[BufSize] = {0};
4897 if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) )
@@ -5351,11 +5351,11 @@
5351 int rc = 0;
5352 int colCount = 0;
5353 assert(st);
5354 colCount = sqlite3_column_count(st);
5355 if( colCount <= 0 ) return NULL;
5356
5357 aryV = cson_value_new_array();
5358 if( ! aryV ) return NULL;
5359 ary = cson_value_get_array(aryV);
5360 assert(ary);
5361 for( i = 0; (0 ==rc) && (i < colCount); ++i )
@@ -5491,11 +5491,11 @@
5491 aryV = NULL;
5492 end:
5493 return aryV;
5494 }
5495
5496
5497 /**
5498 Internal impl of cson_sqlite3_stmt_to_json() when the 'fat'
5499 parameter is non-0.
5500 */
5501 static int cson_sqlite3_stmt_to_json_fat( sqlite3_stmt * st, cson_value ** tgt )
@@ -5636,11 +5636,11 @@
5636 int rc = sqlite3_prepare_v2( db, sql, -1, &st, NULL );
5637 if( 0 != rc ) return cson_rc.IOError /* FIXME: Better error code? */;
5638 rc = cson_sqlite3_stmt_to_json( st, tgt, fat );
5639 sqlite3_finalize( st );
5640 return rc;
5641 }
5642 }
5643
5644 int cson_sqlite3_bind_value( sqlite3_stmt * st, int ndx, cson_value const * v )
5645 {
5646 int rc = 0;
5647
+13 -14
--- src/manifest.c
+++ src/manifest.c
@@ -1420,11 +1420,11 @@
14201420
if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){
14211421
manifest_destroy(*ppOther);
14221422
return;
14231423
}
14241424
isPublic = !content_is_private(mid);
1425
-
1425
+
14261426
/* If pParent is not the primary parent of pChild, and the primary
14271427
** parent of pChild is a phantom, then abort this routine without
14281428
** doing any work. The mlink entries will be computed when the
14291429
** primary parent dephantomizes.
14301430
*/
@@ -1530,11 +1530,11 @@
15301530
isPublic, isPrim, 0);
15311531
}
15321532
}
15331533
}
15341534
manifest_cache_insert(*ppOther);
1535
-
1535
+
15361536
/* If pParent is the primary parent of pChild, also run this analysis
15371537
** for all merge parents of pChild
15381538
*/
15391539
if( isPrim ){
15401540
for(i=1; i<pChild->nParent; i++){
@@ -1564,11 +1564,11 @@
15641564
int parentid = 0;
15651565
char zBaseId[30]; /* Baseline manifest RID for deltas. "NULL" otherwise */
15661566
Stmt q;
15671567
15681568
if( p->zBaseline ){
1569
- sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
1569
+ sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
15701570
uuid_to_rid(p->zBaseline,1));
15711571
}else{
15721572
sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
15731573
}
15741574
for(i=0; i<nParent; i++){
@@ -1611,11 +1611,11 @@
16111611
return parentid;
16121612
}
16131613
16141614
/*
16151615
** There exists a "parent" tag against checkin rid that has value zValue.
1616
-** If value is well-formed (meaning that it is a list of UUIDs), then use
1616
+** If value is well-formed (meaning that it is a list of UUIDs), then use
16171617
** zValue to reparent check-in rid.
16181618
*/
16191619
void manifest_reparent_checkin(int rid, const char *zValue){
16201620
int nParent;
16211621
char *zCopy = 0;
@@ -1632,11 +1632,11 @@
16321632
azParent[i] = &zCopy[i*(UUID_SIZE+1)];
16331633
if( i<nParent-1 && azParent[i][UUID_SIZE]!=' ' ) break;
16341634
azParent[i][UUID_SIZE] = 0;
16351635
if( !validate16(azParent[i],UUID_SIZE) ) break;
16361636
}
1637
- if( i==nParent
1637
+ if( i==nParent
16381638
&& !db_exists("SELECT 1 FROM plink WHERE cid=%d AND pid=%d",
16391639
rid, uuid_to_rid(azParent[0],0))
16401640
){
16411641
p = manifest_get(rid, CFTYPE_MANIFEST, 0);
16421642
}
@@ -1704,11 +1704,11 @@
17041704
rc = xfer_run_common_script();
17051705
if( rc==TH_OK ){
17061706
zScript = xfer_ticket_code();
17071707
}
17081708
}
1709
- db_prepare(&q,
1709
+ db_prepare(&q,
17101710
"SELECT rid, value FROM tagxref"
17111711
" WHERE tagid=%d AND tagtype=1",
17121712
TAG_PARENT
17131713
);
17141714
while( db_step(&q)==SQLITE_ROW ){
@@ -1921,11 +1921,10 @@
19211921
** file, is a legacy of its original use.
19221922
*/
19231923
int manifest_crosslink(int rid, Blob *pContent, int flags){
19241924
int i, rc = TH_OK;
19251925
Manifest *p;
1926
- Stmt q;
19271926
int parentid = 0;
19281927
int permitHooks = (flags & MC_PERMIT_HOOKS);
19291928
const char *zScript = 0;
19301929
const char *zUuid = 0;
19311930
@@ -2147,21 +2146,21 @@
21472146
char *zComment;
21482147
if( isAdd ){
21492148
zComment = mprintf(
21502149
"Add attachment [/artifact/%!S|%h] to"
21512150
" tech note [/technote/%!S|%S]",
2152
- zSrc, zName, zTarget, zTarget);
2151
+ zSrc, zName, zTarget, zTarget);
21532152
}else{
21542153
zComment = mprintf(
21552154
"Delete attachment \"%h\" from"
21562155
" tech note [/technote/%!S|%S]",
21572156
zName, zTarget, zTarget);
21582157
}
21592158
db_multi_exec("UPDATE event SET comment=%Q, type='e'"
21602159
" WHERE objid=%Q",
21612160
zComment, zAttachId);
2162
- fossil_free(zComment);
2161
+ fossil_free(zComment);
21632162
}
21642163
db_finalize(&qatt);
21652164
}
21662165
if( p->type==CFTYPE_TICKET ){
21672166
char *zTag;
@@ -2194,11 +2193,11 @@
21942193
zName, zTarget, zTarget);
21952194
}
21962195
db_multi_exec("UPDATE event SET comment=%Q, type='t'"
21972196
" WHERE objid=%Q",
21982197
zComment, zAttachId);
2199
- fossil_free(zComment);
2198
+ fossil_free(zComment);
22002199
}
22012200
db_finalize(&qatt);
22022201
}
22032202
if( p->type==CFTYPE_ATTACHMENT ){
22042203
char *zComment = 0;
@@ -2205,18 +2204,18 @@
22052204
const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0;
22062205
/* We assume that we're attaching to a wiki page until we
22072206
** prove otherwise (which could on a later artifact if we
22082207
** process the attachment artifact before the artifact to
22092208
** which it is attached!) */
2210
- char attachToType = 'w';
2209
+ char attachToType = 'w';
22112210
if( fossil_is_uuid(p->zAttachTarget) ){
22122211
if( db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'",
22132212
p->zAttachTarget)
22142213
){
22152214
attachToType = 't'; /* Attaching to known ticket */
22162215
}else if( db_exists("SELECT 1 FROM tag WHERE tagname='event-%q'",
2217
- p->zAttachTarget)
2216
+ p->zAttachTarget)
22182217
){
22192218
attachToType = 'e'; /* Attaching to known tech note */
22202219
}
22212220
}
22222221
db_multi_exec(
@@ -2245,18 +2244,18 @@
22452244
}
22462245
}else if( 'e' == attachToType ){
22472246
if( isAdd ){
22482247
zComment = mprintf(
22492248
"Add attachment [/artifact/%!S|%h] to tech note [/technote/%!S|%S]",
2250
- p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
2249
+ p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
22512250
}else{
22522251
zComment = mprintf(
22532252
"Delete attachment \"/artifact/%!S|%h\" from"
22542253
" tech note [/technote/%!S|%S]",
22552254
p->zAttachName, p->zAttachName,
22562255
p->zAttachTarget,p->zAttachTarget);
2257
- }
2256
+ }
22582257
}else{
22592258
if( isAdd ){
22602259
zComment = mprintf(
22612260
"Add attachment [/artifact/%!S|%h] to ticket [%!S|%S]",
22622261
p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
22632262
--- src/manifest.c
+++ src/manifest.c
@@ -1420,11 +1420,11 @@
1420 if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){
1421 manifest_destroy(*ppOther);
1422 return;
1423 }
1424 isPublic = !content_is_private(mid);
1425
1426 /* If pParent is not the primary parent of pChild, and the primary
1427 ** parent of pChild is a phantom, then abort this routine without
1428 ** doing any work. The mlink entries will be computed when the
1429 ** primary parent dephantomizes.
1430 */
@@ -1530,11 +1530,11 @@
1530 isPublic, isPrim, 0);
1531 }
1532 }
1533 }
1534 manifest_cache_insert(*ppOther);
1535
1536 /* If pParent is the primary parent of pChild, also run this analysis
1537 ** for all merge parents of pChild
1538 */
1539 if( isPrim ){
1540 for(i=1; i<pChild->nParent; i++){
@@ -1564,11 +1564,11 @@
1564 int parentid = 0;
1565 char zBaseId[30]; /* Baseline manifest RID for deltas. "NULL" otherwise */
1566 Stmt q;
1567
1568 if( p->zBaseline ){
1569 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
1570 uuid_to_rid(p->zBaseline,1));
1571 }else{
1572 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
1573 }
1574 for(i=0; i<nParent; i++){
@@ -1611,11 +1611,11 @@
1611 return parentid;
1612 }
1613
1614 /*
1615 ** There exists a "parent" tag against checkin rid that has value zValue.
1616 ** If value is well-formed (meaning that it is a list of UUIDs), then use
1617 ** zValue to reparent check-in rid.
1618 */
1619 void manifest_reparent_checkin(int rid, const char *zValue){
1620 int nParent;
1621 char *zCopy = 0;
@@ -1632,11 +1632,11 @@
1632 azParent[i] = &zCopy[i*(UUID_SIZE+1)];
1633 if( i<nParent-1 && azParent[i][UUID_SIZE]!=' ' ) break;
1634 azParent[i][UUID_SIZE] = 0;
1635 if( !validate16(azParent[i],UUID_SIZE) ) break;
1636 }
1637 if( i==nParent
1638 && !db_exists("SELECT 1 FROM plink WHERE cid=%d AND pid=%d",
1639 rid, uuid_to_rid(azParent[0],0))
1640 ){
1641 p = manifest_get(rid, CFTYPE_MANIFEST, 0);
1642 }
@@ -1704,11 +1704,11 @@
1704 rc = xfer_run_common_script();
1705 if( rc==TH_OK ){
1706 zScript = xfer_ticket_code();
1707 }
1708 }
1709 db_prepare(&q,
1710 "SELECT rid, value FROM tagxref"
1711 " WHERE tagid=%d AND tagtype=1",
1712 TAG_PARENT
1713 );
1714 while( db_step(&q)==SQLITE_ROW ){
@@ -1921,11 +1921,10 @@
1921 ** file, is a legacy of its original use.
1922 */
1923 int manifest_crosslink(int rid, Blob *pContent, int flags){
1924 int i, rc = TH_OK;
1925 Manifest *p;
1926 Stmt q;
1927 int parentid = 0;
1928 int permitHooks = (flags & MC_PERMIT_HOOKS);
1929 const char *zScript = 0;
1930 const char *zUuid = 0;
1931
@@ -2147,21 +2146,21 @@
2147 char *zComment;
2148 if( isAdd ){
2149 zComment = mprintf(
2150 "Add attachment [/artifact/%!S|%h] to"
2151 " tech note [/technote/%!S|%S]",
2152 zSrc, zName, zTarget, zTarget);
2153 }else{
2154 zComment = mprintf(
2155 "Delete attachment \"%h\" from"
2156 " tech note [/technote/%!S|%S]",
2157 zName, zTarget, zTarget);
2158 }
2159 db_multi_exec("UPDATE event SET comment=%Q, type='e'"
2160 " WHERE objid=%Q",
2161 zComment, zAttachId);
2162 fossil_free(zComment);
2163 }
2164 db_finalize(&qatt);
2165 }
2166 if( p->type==CFTYPE_TICKET ){
2167 char *zTag;
@@ -2194,11 +2193,11 @@
2194 zName, zTarget, zTarget);
2195 }
2196 db_multi_exec("UPDATE event SET comment=%Q, type='t'"
2197 " WHERE objid=%Q",
2198 zComment, zAttachId);
2199 fossil_free(zComment);
2200 }
2201 db_finalize(&qatt);
2202 }
2203 if( p->type==CFTYPE_ATTACHMENT ){
2204 char *zComment = 0;
@@ -2205,18 +2204,18 @@
2205 const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0;
2206 /* We assume that we're attaching to a wiki page until we
2207 ** prove otherwise (which could on a later artifact if we
2208 ** process the attachment artifact before the artifact to
2209 ** which it is attached!) */
2210 char attachToType = 'w';
2211 if( fossil_is_uuid(p->zAttachTarget) ){
2212 if( db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'",
2213 p->zAttachTarget)
2214 ){
2215 attachToType = 't'; /* Attaching to known ticket */
2216 }else if( db_exists("SELECT 1 FROM tag WHERE tagname='event-%q'",
2217 p->zAttachTarget)
2218 ){
2219 attachToType = 'e'; /* Attaching to known tech note */
2220 }
2221 }
2222 db_multi_exec(
@@ -2245,18 +2244,18 @@
2245 }
2246 }else if( 'e' == attachToType ){
2247 if( isAdd ){
2248 zComment = mprintf(
2249 "Add attachment [/artifact/%!S|%h] to tech note [/technote/%!S|%S]",
2250 p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
2251 }else{
2252 zComment = mprintf(
2253 "Delete attachment \"/artifact/%!S|%h\" from"
2254 " tech note [/technote/%!S|%S]",
2255 p->zAttachName, p->zAttachName,
2256 p->zAttachTarget,p->zAttachTarget);
2257 }
2258 }else{
2259 if( isAdd ){
2260 zComment = mprintf(
2261 "Add attachment [/artifact/%!S|%h] to ticket [%!S|%S]",
2262 p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
2263
--- src/manifest.c
+++ src/manifest.c
@@ -1420,11 +1420,11 @@
1420 if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){
1421 manifest_destroy(*ppOther);
1422 return;
1423 }
1424 isPublic = !content_is_private(mid);
1425
1426 /* If pParent is not the primary parent of pChild, and the primary
1427 ** parent of pChild is a phantom, then abort this routine without
1428 ** doing any work. The mlink entries will be computed when the
1429 ** primary parent dephantomizes.
1430 */
@@ -1530,11 +1530,11 @@
1530 isPublic, isPrim, 0);
1531 }
1532 }
1533 }
1534 manifest_cache_insert(*ppOther);
1535
1536 /* If pParent is the primary parent of pChild, also run this analysis
1537 ** for all merge parents of pChild
1538 */
1539 if( isPrim ){
1540 for(i=1; i<pChild->nParent; i++){
@@ -1564,11 +1564,11 @@
1564 int parentid = 0;
1565 char zBaseId[30]; /* Baseline manifest RID for deltas. "NULL" otherwise */
1566 Stmt q;
1567
1568 if( p->zBaseline ){
1569 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d",
1570 uuid_to_rid(p->zBaseline,1));
1571 }else{
1572 sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL");
1573 }
1574 for(i=0; i<nParent; i++){
@@ -1611,11 +1611,11 @@
1611 return parentid;
1612 }
1613
1614 /*
1615 ** There exists a "parent" tag against checkin rid that has value zValue.
1616 ** If value is well-formed (meaning that it is a list of UUIDs), then use
1617 ** zValue to reparent check-in rid.
1618 */
1619 void manifest_reparent_checkin(int rid, const char *zValue){
1620 int nParent;
1621 char *zCopy = 0;
@@ -1632,11 +1632,11 @@
1632 azParent[i] = &zCopy[i*(UUID_SIZE+1)];
1633 if( i<nParent-1 && azParent[i][UUID_SIZE]!=' ' ) break;
1634 azParent[i][UUID_SIZE] = 0;
1635 if( !validate16(azParent[i],UUID_SIZE) ) break;
1636 }
1637 if( i==nParent
1638 && !db_exists("SELECT 1 FROM plink WHERE cid=%d AND pid=%d",
1639 rid, uuid_to_rid(azParent[0],0))
1640 ){
1641 p = manifest_get(rid, CFTYPE_MANIFEST, 0);
1642 }
@@ -1704,11 +1704,11 @@
1704 rc = xfer_run_common_script();
1705 if( rc==TH_OK ){
1706 zScript = xfer_ticket_code();
1707 }
1708 }
1709 db_prepare(&q,
1710 "SELECT rid, value FROM tagxref"
1711 " WHERE tagid=%d AND tagtype=1",
1712 TAG_PARENT
1713 );
1714 while( db_step(&q)==SQLITE_ROW ){
@@ -1921,11 +1921,10 @@
1921 ** file, is a legacy of its original use.
1922 */
1923 int manifest_crosslink(int rid, Blob *pContent, int flags){
1924 int i, rc = TH_OK;
1925 Manifest *p;
 
1926 int parentid = 0;
1927 int permitHooks = (flags & MC_PERMIT_HOOKS);
1928 const char *zScript = 0;
1929 const char *zUuid = 0;
1930
@@ -2147,21 +2146,21 @@
2146 char *zComment;
2147 if( isAdd ){
2148 zComment = mprintf(
2149 "Add attachment [/artifact/%!S|%h] to"
2150 " tech note [/technote/%!S|%S]",
2151 zSrc, zName, zTarget, zTarget);
2152 }else{
2153 zComment = mprintf(
2154 "Delete attachment \"%h\" from"
2155 " tech note [/technote/%!S|%S]",
2156 zName, zTarget, zTarget);
2157 }
2158 db_multi_exec("UPDATE event SET comment=%Q, type='e'"
2159 " WHERE objid=%Q",
2160 zComment, zAttachId);
2161 fossil_free(zComment);
2162 }
2163 db_finalize(&qatt);
2164 }
2165 if( p->type==CFTYPE_TICKET ){
2166 char *zTag;
@@ -2194,11 +2193,11 @@
2193 zName, zTarget, zTarget);
2194 }
2195 db_multi_exec("UPDATE event SET comment=%Q, type='t'"
2196 " WHERE objid=%Q",
2197 zComment, zAttachId);
2198 fossil_free(zComment);
2199 }
2200 db_finalize(&qatt);
2201 }
2202 if( p->type==CFTYPE_ATTACHMENT ){
2203 char *zComment = 0;
@@ -2205,18 +2204,18 @@
2204 const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0;
2205 /* We assume that we're attaching to a wiki page until we
2206 ** prove otherwise (which could on a later artifact if we
2207 ** process the attachment artifact before the artifact to
2208 ** which it is attached!) */
2209 char attachToType = 'w';
2210 if( fossil_is_uuid(p->zAttachTarget) ){
2211 if( db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'",
2212 p->zAttachTarget)
2213 ){
2214 attachToType = 't'; /* Attaching to known ticket */
2215 }else if( db_exists("SELECT 1 FROM tag WHERE tagname='event-%q'",
2216 p->zAttachTarget)
2217 ){
2218 attachToType = 'e'; /* Attaching to known tech note */
2219 }
2220 }
2221 db_multi_exec(
@@ -2245,18 +2244,18 @@
2244 }
2245 }else if( 'e' == attachToType ){
2246 if( isAdd ){
2247 zComment = mprintf(
2248 "Add attachment [/artifact/%!S|%h] to tech note [/technote/%!S|%S]",
2249 p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
2250 }else{
2251 zComment = mprintf(
2252 "Delete attachment \"/artifact/%!S|%h\" from"
2253 " tech note [/technote/%!S|%S]",
2254 p->zAttachName, p->zAttachName,
2255 p->zAttachTarget,p->zAttachTarget);
2256 }
2257 }else{
2258 if( isAdd ){
2259 zComment = mprintf(
2260 "Add attachment [/artifact/%!S|%h] to ticket [%!S|%S]",
2261 p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget);
2262

Keyboard Shortcuts

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