Fossil SCM
merged from trunk
Commit
12675ab794495717b4c68b896ac8e0fc80b34542
Parent
d3fc377276b80b4…
8 files changed
+1
-1
+42
-42
+13
-14
+1
-1
+5
-4
+155
-141
+6
-1
+2
-2
M
VERSION
+1
-1
| --- VERSION | ||
| +++ VERSION | ||
| @@ -1,1 +1,1 @@ | ||
| 1 | -1.35 | |
| 1 | +1.36 | |
| 2 | 2 |
| --- VERSION | |
| +++ VERSION | |
| @@ -1,1 +1,1 @@ | |
| 1 | 1.35 |
| 2 |
| --- VERSION | |
| +++ VERSION | |
| @@ -1,1 +1,1 @@ | |
| 1 | 1.36 |
| 2 |
+42
-42
| --- src/cson_amalgamation.c | ||
| +++ src/cson_amalgamation.c | ||
| @@ -19,14 +19,14 @@ | ||
| 19 | 19 | # define JSON_PARSER_DLL_API __declspec(dllexport) |
| 20 | 20 | # else |
| 21 | 21 | # define JSON_PARSER_DLL_API __declspec(dllimport) |
| 22 | 22 | # endif |
| 23 | 23 | # else |
| 24 | -# define JSON_PARSER_DLL_API | |
| 24 | +# define JSON_PARSER_DLL_API | |
| 25 | 25 | # endif |
| 26 | 26 | #else |
| 27 | -# define JSON_PARSER_DLL_API | |
| 27 | +# define JSON_PARSER_DLL_API | |
| 28 | 28 | #endif |
| 29 | 29 | |
| 30 | 30 | /* Determine the integer type use to parse non-floating point numbers */ |
| 31 | 31 | #ifdef _WIN32 |
| 32 | 32 | typedef __int64 JSON_int_t; |
| @@ -34,22 +34,22 @@ | ||
| 34 | 34 | #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%I64d" |
| 35 | 35 | #elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1) |
| 36 | 36 | typedef long long JSON_int_t; |
| 37 | 37 | #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld" |
| 38 | 38 | #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld" |
| 39 | -#else | |
| 39 | +#else | |
| 40 | 40 | typedef long JSON_int_t; |
| 41 | 41 | #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%ld" |
| 42 | 42 | #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%ld" |
| 43 | 43 | #endif |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | #ifdef __cplusplus |
| 47 | 47 | extern "C" { |
| 48 | -#endif | |
| 48 | +#endif | |
| 49 | 49 | |
| 50 | -typedef enum | |
| 50 | +typedef enum | |
| 51 | 51 | { |
| 52 | 52 | JSON_E_NONE = 0, |
| 53 | 53 | JSON_E_INVALID_CHAR, |
| 54 | 54 | JSON_E_INVALID_KEYWORD, |
| 55 | 55 | JSON_E_INVALID_ESCAPE_SEQUENCE, |
| @@ -60,11 +60,11 @@ | ||
| 60 | 60 | JSON_E_EXPECTED_KEY, |
| 61 | 61 | JSON_E_EXPECTED_COLON, |
| 62 | 62 | JSON_E_OUT_OF_MEMORY |
| 63 | 63 | } JSON_error; |
| 64 | 64 | |
| 65 | -typedef enum | |
| 65 | +typedef enum | |
| 66 | 66 | { |
| 67 | 67 | JSON_T_NONE = 0, |
| 68 | 68 | JSON_T_ARRAY_BEGIN, |
| 69 | 69 | JSON_T_ARRAY_END, |
| 70 | 70 | JSON_T_OBJECT_BEGIN, |
| @@ -80,33 +80,33 @@ | ||
| 80 | 80 | } JSON_type; |
| 81 | 81 | |
| 82 | 82 | typedef struct JSON_value_struct { |
| 83 | 83 | union { |
| 84 | 84 | JSON_int_t integer_value; |
| 85 | - | |
| 85 | + | |
| 86 | 86 | double float_value; |
| 87 | - | |
| 87 | + | |
| 88 | 88 | struct { |
| 89 | 89 | const char* value; |
| 90 | 90 | size_t length; |
| 91 | 91 | } str; |
| 92 | 92 | } vu; |
| 93 | 93 | } JSON_value; |
| 94 | 94 | |
| 95 | 95 | typedef struct JSON_parser_struct* JSON_parser; |
| 96 | 96 | |
| 97 | -/*! \brief JSON parser callback | |
| 97 | +/*! \brief JSON parser callback | |
| 98 | 98 | |
| 99 | 99 | \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. | |
| 101 | 101 | \param value A representation of the parsed value. This parameter is NULL for |
| 102 | 102 | JSON_T_ARRAY_BEGIN, JSON_T_ARRAY_END, JSON_T_OBJECT_BEGIN, JSON_T_OBJECT_END, |
| 103 | 103 | JSON_T_NULL, JSON_T_TRUE, and JSON_T_FALSE. String values are always returned |
| 104 | 104 | as zero-terminated C strings. |
| 105 | 105 | |
| 106 | 106 | \return Non-zero if parsing should continue, else zero. |
| 107 | -*/ | |
| 107 | +*/ | |
| 108 | 108 | typedef int (*JSON_parser_callback)(void* ctx, int type, const JSON_value* value); |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | A typedef for allocator functions semantically compatible with malloc(). |
| @@ -115,11 +115,11 @@ | ||
| 115 | 115 | /** |
| 116 | 116 | A typedef for deallocator functions semantically compatible with free(). |
| 117 | 117 | */ |
| 118 | 118 | typedef void (*JSON_free_t)(void* mem); |
| 119 | 119 | |
| 120 | -/*! \brief The structure used to configure a JSON parser object | |
| 120 | +/*! \brief The structure used to configure a JSON parser object | |
| 121 | 121 | */ |
| 122 | 122 | typedef struct { |
| 123 | 123 | /** Pointer to a callback, called when the parser has something to tell |
| 124 | 124 | the user. This parameter may be NULL. In this case the input is |
| 125 | 125 | merely checked for validity. |
| @@ -176,17 +176,17 @@ | ||
| 176 | 176 | |
| 177 | 177 | \param config. Used to configure the parser. |
| 178 | 178 | */ |
| 179 | 179 | JSON_PARSER_DLL_API void init_JSON_config(JSON_config * config); |
| 180 | 180 | |
| 181 | -/*! \brief Create a JSON parser object | |
| 181 | +/*! \brief Create a JSON parser object | |
| 182 | 182 | |
| 183 | 183 | \param config. Used to configure the parser. Set to NULL to use |
| 184 | 184 | the default configuration. See init_JSON_config. Its contents are |
| 185 | 185 | copied by this function, so it need not outlive the returned |
| 186 | 186 | object. |
| 187 | - | |
| 187 | + | |
| 188 | 188 | \return The parser object, which is owned by the caller and must eventually |
| 189 | 189 | be freed by calling delete_JSON_parser(). |
| 190 | 190 | */ |
| 191 | 191 | JSON_PARSER_DLL_API JSON_parser new_JSON_parser(JSON_config const* config); |
| 192 | 192 | |
| @@ -200,16 +200,16 @@ | ||
| 200 | 200 | JSON_PARSER_DLL_API int JSON_parser_char(JSON_parser jc, int next_char); |
| 201 | 201 | |
| 202 | 202 | /*! \brief Finalize parsing. |
| 203 | 203 | |
| 204 | 204 | Call this method once after all input characters have been consumed. |
| 205 | - | |
| 205 | + | |
| 206 | 206 | \return Non-zero, if all parsed characters are valid JSON, zero otherwise. |
| 207 | 207 | */ |
| 208 | 208 | JSON_PARSER_DLL_API int JSON_parser_done(JSON_parser jc); |
| 209 | 209 | |
| 210 | -/*! \brief Determine if a given string is valid JSON white space | |
| 210 | +/*! \brief Determine if a given string is valid JSON white space | |
| 211 | 211 | |
| 212 | 212 | \return Non-zero if the string is valid, zero otherwise. |
| 213 | 213 | */ |
| 214 | 214 | JSON_PARSER_DLL_API int JSON_parser_is_legal_white_space_string(const char* s); |
| 215 | 215 | |
| @@ -226,12 +226,12 @@ | ||
| 226 | 226 | JSON_PARSER_DLL_API int JSON_parser_reset(JSON_parser jc); |
| 227 | 227 | |
| 228 | 228 | |
| 229 | 229 | #ifdef __cplusplus |
| 230 | 230 | } |
| 231 | -#endif | |
| 232 | - | |
| 231 | +#endif | |
| 232 | + | |
| 233 | 233 | |
| 234 | 234 | #endif /* JSON_PARSER_H */ |
| 235 | 235 | /* end file parser/JSON_parser.h */ |
| 236 | 236 | /* begin file parser/JSON_parser.c */ |
| 237 | 237 | /* |
| @@ -1431,11 +1431,11 @@ | ||
| 1431 | 1431 | #if defined(__cplusplus) |
| 1432 | 1432 | extern "C" { |
| 1433 | 1433 | #endif |
| 1434 | 1434 | |
| 1435 | 1435 | |
| 1436 | - | |
| 1436 | + | |
| 1437 | 1437 | /** |
| 1438 | 1438 | This type holds the "vtbl" for type-specific operations when |
| 1439 | 1439 | working with cson_value objects. |
| 1440 | 1440 | |
| 1441 | 1441 | All cson_values of a given logical type share a pointer to a single |
| @@ -1607,11 +1607,11 @@ | ||
| 1607 | 1607 | #define CSON_OBJ(V) CSON_CAST(cson_object,(V)) |
| 1608 | 1608 | #define CSON_ARRAY(V) CSON_CAST(cson_array,(V)) |
| 1609 | 1609 | |
| 1610 | 1610 | /** |
| 1611 | 1611 | Holds special shared "constant" (though they are non-const) |
| 1612 | - values. | |
| 1612 | + values. | |
| 1613 | 1613 | */ |
| 1614 | 1614 | static struct CSON_EMPTY_HOLDER_ |
| 1615 | 1615 | { |
| 1616 | 1616 | char trueValue; |
| 1617 | 1617 | cson_string stringValue; |
| @@ -1620,17 +1620,17 @@ | ||
| 1620 | 1620 | cson_string_empty_m |
| 1621 | 1621 | }; |
| 1622 | 1622 | |
| 1623 | 1623 | /** |
| 1624 | 1624 | Indexes into the CSON_SPECIAL_VALUES array. |
| 1625 | - | |
| 1625 | + | |
| 1626 | 1626 | If this enum changes in any way, |
| 1627 | 1627 | makes damned sure that CSON_SPECIAL_VALUES is updated |
| 1628 | 1628 | to match!!! |
| 1629 | 1629 | */ |
| 1630 | 1630 | enum CSON_INTERNAL_VALUES { |
| 1631 | - | |
| 1631 | + | |
| 1632 | 1632 | CSON_VAL_UNDEF = 0, |
| 1633 | 1633 | CSON_VAL_NULL = 1, |
| 1634 | 1634 | CSON_VAL_TRUE = 2, |
| 1635 | 1635 | CSON_VAL_FALSE = 3, |
| 1636 | 1636 | CSON_VAL_INT_0 = 4, |
| @@ -1642,11 +1642,11 @@ | ||
| 1642 | 1642 | /** |
| 1643 | 1643 | Some "special" shared cson_value instances. |
| 1644 | 1644 | |
| 1645 | 1645 | These values MUST be initialized in the order specified |
| 1646 | 1646 | by the CSON_INTERNAL_VALUES enum. |
| 1647 | - | |
| 1647 | + | |
| 1648 | 1648 | Note that they are not const because they are used as |
| 1649 | 1649 | shared-allocation objects in non-const contexts. However, the |
| 1650 | 1650 | public API provides no way to modifying them, and clients who |
| 1651 | 1651 | modify values directly are subject to The Wrath of Undefined |
| 1652 | 1652 | Behaviour. |
| @@ -1665,11 +1665,11 @@ | ||
| 1665 | 1665 | |
| 1666 | 1666 | /** |
| 1667 | 1667 | Returns non-0 (true) if m is one of our special |
| 1668 | 1668 | "built-in" values, e.g. from CSON_SPECIAL_VALUES and some |
| 1669 | 1669 | "empty" values. |
| 1670 | - | |
| 1670 | + | |
| 1671 | 1671 | If this returns true, m MUST NOT be free()d! |
| 1672 | 1672 | */ |
| 1673 | 1673 | static char cson_value_is_builtin( void const * m ) |
| 1674 | 1674 | { |
| 1675 | 1675 | if((m >= (void const *)&CSON_EMPTY_HOLDER) |
| @@ -2183,11 +2183,11 @@ | ||
| 2183 | 2183 | static int cson_value_list_visit( cson_value_list * self, |
| 2184 | 2184 | int (*visitor)(cson_value * obj, void * visitorState ), |
| 2185 | 2185 | void * visitorState ); |
| 2186 | 2186 | #endif |
| 2187 | 2187 | #endif |
| 2188 | - | |
| 2188 | + | |
| 2189 | 2189 | #if 0 |
| 2190 | 2190 | # define LIST_T cson_value_list |
| 2191 | 2191 | # define VALUE_T cson_value * |
| 2192 | 2192 | # define VALUE_T_IS_PTR 1 |
| 2193 | 2193 | # define LIST_T cson_kvp_list |
| @@ -2362,11 +2362,11 @@ | ||
| 2362 | 2362 | return cson_value_object_alloc(); |
| 2363 | 2363 | } |
| 2364 | 2364 | |
| 2365 | 2365 | cson_object * cson_new_object() |
| 2366 | 2366 | { |
| 2367 | - | |
| 2367 | + | |
| 2368 | 2368 | return cson_value_get_object( cson_value_new_object() ); |
| 2369 | 2369 | } |
| 2370 | 2370 | |
| 2371 | 2371 | cson_value * cson_value_new_array() |
| 2372 | 2372 | { |
| @@ -2608,11 +2608,11 @@ | ||
| 2608 | 2608 | { |
| 2609 | 2609 | cson_int_t i = 0; |
| 2610 | 2610 | int rc = 0; |
| 2611 | 2611 | switch(val->api->typeID) |
| 2612 | 2612 | { |
| 2613 | - case CSON_TYPE_UNDEF: | |
| 2613 | + case CSON_TYPE_UNDEF: | |
| 2614 | 2614 | case CSON_TYPE_NULL: |
| 2615 | 2615 | i = 0; |
| 2616 | 2616 | break; |
| 2617 | 2617 | case CSON_TYPE_BOOL: { |
| 2618 | 2618 | char b = 0; |
| @@ -2661,11 +2661,11 @@ | ||
| 2661 | 2661 | { |
| 2662 | 2662 | cson_double_t d = 0.0; |
| 2663 | 2663 | int rc = 0; |
| 2664 | 2664 | switch(val->api->typeID) |
| 2665 | 2665 | { |
| 2666 | - case CSON_TYPE_UNDEF: | |
| 2666 | + case CSON_TYPE_UNDEF: | |
| 2667 | 2667 | case CSON_TYPE_NULL: |
| 2668 | 2668 | d = 0; |
| 2669 | 2669 | break; |
| 2670 | 2670 | case CSON_TYPE_BOOL: { |
| 2671 | 2671 | char b = 0; |
| @@ -2791,11 +2791,11 @@ | ||
| 2791 | 2791 | #if 0 |
| 2792 | 2792 | /** |
| 2793 | 2793 | Removes and returns the last value from the given array, |
| 2794 | 2794 | shrinking its size by 1. Returns NULL if ar is NULL, |
| 2795 | 2795 | ar->list.count is 0, or the element at that index is NULL. |
| 2796 | - | |
| 2796 | + | |
| 2797 | 2797 | |
| 2798 | 2798 | If removeRef is true then cson_value_free() is called to remove |
| 2799 | 2799 | ar's reference count for the value. In that case NULL is returned, |
| 2800 | 2800 | even if the object still has live references. If removeRef is false |
| 2801 | 2801 | then the caller takes over ownership of that reference count point. |
| @@ -2858,11 +2858,11 @@ | ||
| 2858 | 2858 | #if !defined(NDEBUG) && CSON_VOID_PTR_IS_BIG |
| 2859 | 2859 | assert( sizeof(cson_int_t) <= sizeof(void *) ); |
| 2860 | 2860 | #endif |
| 2861 | 2861 | if( c ) |
| 2862 | 2862 | { |
| 2863 | - *CSON_INT(c) = v; | |
| 2863 | + memcpy(CSON_INT(c), &v, sizeof(v)); | |
| 2864 | 2864 | } |
| 2865 | 2865 | return c; |
| 2866 | 2866 | } |
| 2867 | 2867 | } |
| 2868 | 2868 | |
| @@ -3068,11 +3068,11 @@ | ||
| 3068 | 3068 | qsort( obj->kvp.list, obj->kvp.count, sizeof(cson_kvp*), |
| 3069 | 3069 | cson_kvp_cmp ); |
| 3070 | 3070 | } |
| 3071 | 3071 | |
| 3072 | 3072 | } |
| 3073 | -#endif | |
| 3073 | +#endif | |
| 3074 | 3074 | |
| 3075 | 3075 | int cson_object_unset( cson_object * obj, char const * key ) |
| 3076 | 3076 | { |
| 3077 | 3077 | if( ! obj || !key || !*key ) return cson_rc.ArgError; |
| 3078 | 3078 | else |
| @@ -3238,11 +3238,11 @@ | ||
| 3238 | 3238 | using p->key. In any other case cson_rc.InternalError is returned. |
| 3239 | 3239 | |
| 3240 | 3240 | Returns cson_rc.AllocError if an allocation fails. |
| 3241 | 3241 | |
| 3242 | 3242 | Returns 0 on success. On error, parsing must be ceased immediately. |
| 3243 | - | |
| 3243 | + | |
| 3244 | 3244 | Ownership of val is ALWAYS TRANSFERED to this function. If this |
| 3245 | 3245 | function fails, val will be cleaned up and destroyed. (This |
| 3246 | 3246 | simplifies error handling in the core parser.) |
| 3247 | 3247 | */ |
| 3248 | 3248 | static int cson_parser_set_key( cson_parser * p, cson_value * val ) |
| @@ -3485,11 +3485,11 @@ | ||
| 3485 | 3485 | ++p->totalKeyCount; |
| 3486 | 3486 | break; |
| 3487 | 3487 | } |
| 3488 | 3488 | case JSON_T_STRING: { |
| 3489 | 3489 | cson_value * v = cson_value_new_string( value->vu.str.value, value->vu.str.length ); |
| 3490 | - rc = ( NULL == v ) | |
| 3490 | + rc = ( NULL == v ) | |
| 3491 | 3491 | ? cson_rc.AllocError |
| 3492 | 3492 | : cson_parser_push_value( p, v ); |
| 3493 | 3493 | break; |
| 3494 | 3494 | } |
| 3495 | 3495 | default: |
| @@ -3532,11 +3532,11 @@ | ||
| 3532 | 3532 | To properly take over ownership of the parser's root node on a |
| 3533 | 3533 | successful parse: |
| 3534 | 3534 | |
| 3535 | 3535 | - Copy p->root's pointer and set p->root to NULL. |
| 3536 | 3536 | - Eventually free up p->root with cson_value_free(). |
| 3537 | - | |
| 3537 | + | |
| 3538 | 3538 | If you do not set p->root to NULL, p->root will be freed along with |
| 3539 | 3539 | any other items inserted into it (or under it) during the parsing |
| 3540 | 3540 | process. |
| 3541 | 3541 | */ |
| 3542 | 3542 | static int cson_parser_clean( cson_parser * p ) |
| @@ -3571,11 +3571,11 @@ | ||
| 3571 | 3571 | int rc = 0; |
| 3572 | 3572 | unsigned int len = 1; |
| 3573 | 3573 | cson_parse_info info = info_ ? *info_ : cson_parse_info_empty; |
| 3574 | 3574 | cson_parser p = cson_parser_empty; |
| 3575 | 3575 | if( ! tgt || ! src ) return cson_rc.ArgError; |
| 3576 | - | |
| 3576 | + | |
| 3577 | 3577 | { |
| 3578 | 3578 | JSON_config jopt = {0}; |
| 3579 | 3579 | init_JSON_config( &jopt ); |
| 3580 | 3580 | jopt.allow_comments = opt.allowComments; |
| 3581 | 3581 | jopt.depth = opt.maxDepth; |
| @@ -4640,11 +4640,11 @@ | ||
| 4640 | 4640 | #endif |
| 4641 | 4641 | #undef TRY_SHARING |
| 4642 | 4642 | cson_value_add_reference(rc); |
| 4643 | 4643 | return rc; |
| 4644 | 4644 | } |
| 4645 | - | |
| 4645 | + | |
| 4646 | 4646 | static cson_value * cson_value_clone_array( cson_value const * orig ) |
| 4647 | 4647 | { |
| 4648 | 4648 | unsigned int i = 0; |
| 4649 | 4649 | cson_array const * asrc = cson_value_get_array( orig ); |
| 4650 | 4650 | unsigned int alen = cson_array_length_get( asrc ); |
| @@ -4680,11 +4680,11 @@ | ||
| 4680 | 4680 | cson_value_free(cl)/*remove our artificial reference */; |
| 4681 | 4681 | } |
| 4682 | 4682 | } |
| 4683 | 4683 | return destV; |
| 4684 | 4684 | } |
| 4685 | - | |
| 4685 | + | |
| 4686 | 4686 | static cson_value * cson_value_clone_object( cson_value const * orig ) |
| 4687 | 4687 | { |
| 4688 | 4688 | cson_object const * src = cson_value_get_object( orig ); |
| 4689 | 4689 | cson_value * destV = NULL; |
| 4690 | 4690 | cson_object * dest = NULL; |
| @@ -4834,11 +4834,11 @@ | ||
| 4834 | 4834 | } |
| 4835 | 4835 | case CSON_TYPE_STRING: { |
| 4836 | 4836 | cson_string const * jstr = cson_value_get_string(orig); |
| 4837 | 4837 | unsigned const int slen = cson_string_length_bytes( jstr ); |
| 4838 | 4838 | assert( NULL != jstr ); |
| 4839 | - v = cson_strdup( cson_string_cstr( jstr ), slen ); | |
| 4839 | + v = cson_strdup( cson_string_cstr( jstr ), slen ); | |
| 4840 | 4840 | break; |
| 4841 | 4841 | } |
| 4842 | 4842 | case CSON_TYPE_INTEGER: { |
| 4843 | 4843 | char buf[BufSize] = {0}; |
| 4844 | 4844 | if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) ) |
| @@ -4887,11 +4887,11 @@ | ||
| 4887 | 4887 | } |
| 4888 | 4888 | case CSON_TYPE_STRING: { |
| 4889 | 4889 | cson_string const * jstr = cson_value_get_string(orig); |
| 4890 | 4890 | unsigned const int slen = cson_string_length_bytes( jstr ); |
| 4891 | 4891 | assert( NULL != jstr ); |
| 4892 | - v = cson_strdup( cson_string_cstr( jstr ), slen ); | |
| 4892 | + v = cson_strdup( cson_string_cstr( jstr ), slen ); | |
| 4893 | 4893 | break; |
| 4894 | 4894 | } |
| 4895 | 4895 | case CSON_TYPE_INTEGER: { |
| 4896 | 4896 | char buf[BufSize] = {0}; |
| 4897 | 4897 | if( 0 < sprintf( v, "%"CSON_INT_T_PFMT, cson_value_get_integer(orig)) ) |
| @@ -5351,11 +5351,11 @@ | ||
| 5351 | 5351 | int rc = 0; |
| 5352 | 5352 | int colCount = 0; |
| 5353 | 5353 | assert(st); |
| 5354 | 5354 | colCount = sqlite3_column_count(st); |
| 5355 | 5355 | if( colCount <= 0 ) return NULL; |
| 5356 | - | |
| 5356 | + | |
| 5357 | 5357 | aryV = cson_value_new_array(); |
| 5358 | 5358 | if( ! aryV ) return NULL; |
| 5359 | 5359 | ary = cson_value_get_array(aryV); |
| 5360 | 5360 | assert(ary); |
| 5361 | 5361 | for( i = 0; (0 ==rc) && (i < colCount); ++i ) |
| @@ -5491,11 +5491,11 @@ | ||
| 5491 | 5491 | aryV = NULL; |
| 5492 | 5492 | end: |
| 5493 | 5493 | return aryV; |
| 5494 | 5494 | } |
| 5495 | 5495 | |
| 5496 | - | |
| 5496 | + | |
| 5497 | 5497 | /** |
| 5498 | 5498 | Internal impl of cson_sqlite3_stmt_to_json() when the 'fat' |
| 5499 | 5499 | parameter is non-0. |
| 5500 | 5500 | */ |
| 5501 | 5501 | static int cson_sqlite3_stmt_to_json_fat( sqlite3_stmt * st, cson_value ** tgt ) |
| @@ -5636,11 +5636,11 @@ | ||
| 5636 | 5636 | int rc = sqlite3_prepare_v2( db, sql, -1, &st, NULL ); |
| 5637 | 5637 | if( 0 != rc ) return cson_rc.IOError /* FIXME: Better error code? */; |
| 5638 | 5638 | rc = cson_sqlite3_stmt_to_json( st, tgt, fat ); |
| 5639 | 5639 | sqlite3_finalize( st ); |
| 5640 | 5640 | return rc; |
| 5641 | - } | |
| 5641 | + } | |
| 5642 | 5642 | } |
| 5643 | 5643 | |
| 5644 | 5644 | int cson_sqlite3_bind_value( sqlite3_stmt * st, int ndx, cson_value const * v ) |
| 5645 | 5645 | { |
| 5646 | 5646 | int rc = 0; |
| 5647 | 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 | *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 @@ | ||
| 1420 | 1420 | if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){ |
| 1421 | 1421 | manifest_destroy(*ppOther); |
| 1422 | 1422 | return; |
| 1423 | 1423 | } |
| 1424 | 1424 | isPublic = !content_is_private(mid); |
| 1425 | - | |
| 1425 | + | |
| 1426 | 1426 | /* If pParent is not the primary parent of pChild, and the primary |
| 1427 | 1427 | ** parent of pChild is a phantom, then abort this routine without |
| 1428 | 1428 | ** doing any work. The mlink entries will be computed when the |
| 1429 | 1429 | ** primary parent dephantomizes. |
| 1430 | 1430 | */ |
| @@ -1530,11 +1530,11 @@ | ||
| 1530 | 1530 | isPublic, isPrim, 0); |
| 1531 | 1531 | } |
| 1532 | 1532 | } |
| 1533 | 1533 | } |
| 1534 | 1534 | manifest_cache_insert(*ppOther); |
| 1535 | - | |
| 1535 | + | |
| 1536 | 1536 | /* If pParent is the primary parent of pChild, also run this analysis |
| 1537 | 1537 | ** for all merge parents of pChild |
| 1538 | 1538 | */ |
| 1539 | 1539 | if( isPrim ){ |
| 1540 | 1540 | for(i=1; i<pChild->nParent; i++){ |
| @@ -1564,11 +1564,11 @@ | ||
| 1564 | 1564 | int parentid = 0; |
| 1565 | 1565 | char zBaseId[30]; /* Baseline manifest RID for deltas. "NULL" otherwise */ |
| 1566 | 1566 | Stmt q; |
| 1567 | 1567 | |
| 1568 | 1568 | if( p->zBaseline ){ |
| 1569 | - sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d", | |
| 1569 | + sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d", | |
| 1570 | 1570 | uuid_to_rid(p->zBaseline,1)); |
| 1571 | 1571 | }else{ |
| 1572 | 1572 | sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL"); |
| 1573 | 1573 | } |
| 1574 | 1574 | for(i=0; i<nParent; i++){ |
| @@ -1611,11 +1611,11 @@ | ||
| 1611 | 1611 | return parentid; |
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | 1614 | /* |
| 1615 | 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 | |
| 1616 | +** If value is well-formed (meaning that it is a list of UUIDs), then use | |
| 1617 | 1617 | ** zValue to reparent check-in rid. |
| 1618 | 1618 | */ |
| 1619 | 1619 | void manifest_reparent_checkin(int rid, const char *zValue){ |
| 1620 | 1620 | int nParent; |
| 1621 | 1621 | char *zCopy = 0; |
| @@ -1632,11 +1632,11 @@ | ||
| 1632 | 1632 | azParent[i] = &zCopy[i*(UUID_SIZE+1)]; |
| 1633 | 1633 | if( i<nParent-1 && azParent[i][UUID_SIZE]!=' ' ) break; |
| 1634 | 1634 | azParent[i][UUID_SIZE] = 0; |
| 1635 | 1635 | if( !validate16(azParent[i],UUID_SIZE) ) break; |
| 1636 | 1636 | } |
| 1637 | - if( i==nParent | |
| 1637 | + if( i==nParent | |
| 1638 | 1638 | && !db_exists("SELECT 1 FROM plink WHERE cid=%d AND pid=%d", |
| 1639 | 1639 | rid, uuid_to_rid(azParent[0],0)) |
| 1640 | 1640 | ){ |
| 1641 | 1641 | p = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 1642 | 1642 | } |
| @@ -1704,11 +1704,11 @@ | ||
| 1704 | 1704 | rc = xfer_run_common_script(); |
| 1705 | 1705 | if( rc==TH_OK ){ |
| 1706 | 1706 | zScript = xfer_ticket_code(); |
| 1707 | 1707 | } |
| 1708 | 1708 | } |
| 1709 | - db_prepare(&q, | |
| 1709 | + db_prepare(&q, | |
| 1710 | 1710 | "SELECT rid, value FROM tagxref" |
| 1711 | 1711 | " WHERE tagid=%d AND tagtype=1", |
| 1712 | 1712 | TAG_PARENT |
| 1713 | 1713 | ); |
| 1714 | 1714 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -1921,11 +1921,10 @@ | ||
| 1921 | 1921 | ** file, is a legacy of its original use. |
| 1922 | 1922 | */ |
| 1923 | 1923 | int manifest_crosslink(int rid, Blob *pContent, int flags){ |
| 1924 | 1924 | int i, rc = TH_OK; |
| 1925 | 1925 | Manifest *p; |
| 1926 | - Stmt q; | |
| 1927 | 1926 | int parentid = 0; |
| 1928 | 1927 | int permitHooks = (flags & MC_PERMIT_HOOKS); |
| 1929 | 1928 | const char *zScript = 0; |
| 1930 | 1929 | const char *zUuid = 0; |
| 1931 | 1930 | |
| @@ -2147,21 +2146,21 @@ | ||
| 2147 | 2146 | char *zComment; |
| 2148 | 2147 | if( isAdd ){ |
| 2149 | 2148 | zComment = mprintf( |
| 2150 | 2149 | "Add attachment [/artifact/%!S|%h] to" |
| 2151 | 2150 | " tech note [/technote/%!S|%S]", |
| 2152 | - zSrc, zName, zTarget, zTarget); | |
| 2151 | + zSrc, zName, zTarget, zTarget); | |
| 2153 | 2152 | }else{ |
| 2154 | 2153 | zComment = mprintf( |
| 2155 | 2154 | "Delete attachment \"%h\" from" |
| 2156 | 2155 | " tech note [/technote/%!S|%S]", |
| 2157 | 2156 | zName, zTarget, zTarget); |
| 2158 | 2157 | } |
| 2159 | 2158 | db_multi_exec("UPDATE event SET comment=%Q, type='e'" |
| 2160 | 2159 | " WHERE objid=%Q", |
| 2161 | 2160 | zComment, zAttachId); |
| 2162 | - fossil_free(zComment); | |
| 2161 | + fossil_free(zComment); | |
| 2163 | 2162 | } |
| 2164 | 2163 | db_finalize(&qatt); |
| 2165 | 2164 | } |
| 2166 | 2165 | if( p->type==CFTYPE_TICKET ){ |
| 2167 | 2166 | char *zTag; |
| @@ -2194,11 +2193,11 @@ | ||
| 2194 | 2193 | zName, zTarget, zTarget); |
| 2195 | 2194 | } |
| 2196 | 2195 | db_multi_exec("UPDATE event SET comment=%Q, type='t'" |
| 2197 | 2196 | " WHERE objid=%Q", |
| 2198 | 2197 | zComment, zAttachId); |
| 2199 | - fossil_free(zComment); | |
| 2198 | + fossil_free(zComment); | |
| 2200 | 2199 | } |
| 2201 | 2200 | db_finalize(&qatt); |
| 2202 | 2201 | } |
| 2203 | 2202 | if( p->type==CFTYPE_ATTACHMENT ){ |
| 2204 | 2203 | char *zComment = 0; |
| @@ -2205,18 +2204,18 @@ | ||
| 2205 | 2204 | const char isAdd = (p->zAttachSrc && p->zAttachSrc[0]) ? 1 : 0; |
| 2206 | 2205 | /* We assume that we're attaching to a wiki page until we |
| 2207 | 2206 | ** prove otherwise (which could on a later artifact if we |
| 2208 | 2207 | ** process the attachment artifact before the artifact to |
| 2209 | 2208 | ** which it is attached!) */ |
| 2210 | - char attachToType = 'w'; | |
| 2209 | + char attachToType = 'w'; | |
| 2211 | 2210 | if( fossil_is_uuid(p->zAttachTarget) ){ |
| 2212 | 2211 | if( db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", |
| 2213 | 2212 | p->zAttachTarget) |
| 2214 | 2213 | ){ |
| 2215 | 2214 | attachToType = 't'; /* Attaching to known ticket */ |
| 2216 | 2215 | }else if( db_exists("SELECT 1 FROM tag WHERE tagname='event-%q'", |
| 2217 | - p->zAttachTarget) | |
| 2216 | + p->zAttachTarget) | |
| 2218 | 2217 | ){ |
| 2219 | 2218 | attachToType = 'e'; /* Attaching to known tech note */ |
| 2220 | 2219 | } |
| 2221 | 2220 | } |
| 2222 | 2221 | db_multi_exec( |
| @@ -2245,18 +2244,18 @@ | ||
| 2245 | 2244 | } |
| 2246 | 2245 | }else if( 'e' == attachToType ){ |
| 2247 | 2246 | if( isAdd ){ |
| 2248 | 2247 | zComment = mprintf( |
| 2249 | 2248 | "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); | |
| 2251 | 2250 | }else{ |
| 2252 | 2251 | zComment = mprintf( |
| 2253 | 2252 | "Delete attachment \"/artifact/%!S|%h\" from" |
| 2254 | 2253 | " tech note [/technote/%!S|%S]", |
| 2255 | 2254 | p->zAttachName, p->zAttachName, |
| 2256 | 2255 | p->zAttachTarget,p->zAttachTarget); |
| 2257 | - } | |
| 2256 | + } | |
| 2258 | 2257 | }else{ |
| 2259 | 2258 | if( isAdd ){ |
| 2260 | 2259 | zComment = mprintf( |
| 2261 | 2260 | "Add attachment [/artifact/%!S|%h] to ticket [%!S|%S]", |
| 2262 | 2261 | p->zAttachSrc, p->zAttachName, p->zAttachTarget, p->zAttachTarget); |
| 2263 | 2262 |
| --- 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 |
+1
-1
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -493,11 +493,11 @@ | ||
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | style_header("Skins"); |
| 497 | 497 | if( zErr ){ |
| 498 | - @ <p><font color="red">%h(zErr)</font></p> | |
| 498 | + @ <p style="color:red">%h(zErr)</p> | |
| 499 | 499 | } |
| 500 | 500 | @ <p>A "skin" is a combination of |
| 501 | 501 | @ <a href="setup_skinedit?w=0">CSS</a>, |
| 502 | 502 | @ <a href="setup_skinedit?w=2">Header</a>, |
| 503 | 503 | @ <a href="setup_skinedit?w=1">Footer</a>, and |
| 504 | 504 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -493,11 +493,11 @@ | |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | style_header("Skins"); |
| 497 | if( zErr ){ |
| 498 | @ <p><font color="red">%h(zErr)</font></p> |
| 499 | } |
| 500 | @ <p>A "skin" is a combination of |
| 501 | @ <a href="setup_skinedit?w=0">CSS</a>, |
| 502 | @ <a href="setup_skinedit?w=2">Header</a>, |
| 503 | @ <a href="setup_skinedit?w=1">Footer</a>, and |
| 504 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -493,11 +493,11 @@ | |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | style_header("Skins"); |
| 497 | if( zErr ){ |
| 498 | @ <p style="color:red">%h(zErr)</p> |
| 499 | } |
| 500 | @ <p>A "skin" is a combination of |
| 501 | @ <a href="setup_skinedit?w=0">CSS</a>, |
| 502 | @ <a href="setup_skinedit?w=2">Header</a>, |
| 503 | @ <a href="setup_skinedit?w=1">Footer</a>, and |
| 504 |
+5
-4
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -423,11 +423,11 @@ | ||
| 423 | 423 | ** For trouble-shooting purposes, render a dump of the aField[] table to |
| 424 | 424 | ** the webpage currently under construction. |
| 425 | 425 | */ |
| 426 | 426 | static void showAllFields(void){ |
| 427 | 427 | int i; |
| 428 | - @ <font color="blue"> | |
| 428 | + @ <div style="color:blue"> | |
| 429 | 429 | @ <p>Database fields:</p><ul> |
| 430 | 430 | for(i=0; i<nField; i++){ |
| 431 | 431 | @ <li>aField[%d(i)].zName = "%h(aField[i].zName)"; |
| 432 | 432 | @ originally = "%h(aField[i].zValue)"; |
| 433 | 433 | @ currently = "%h(PD(aField[i].zName,""))"; |
| @@ -434,11 +434,11 @@ | ||
| 434 | 434 | if( aField[i].zAppend ){ |
| 435 | 435 | @ zAppend = "%h(aField[i].zAppend)"; |
| 436 | 436 | } |
| 437 | 437 | @ mUsed = %d(aField[i].mUsed); |
| 438 | 438 | } |
| 439 | - @ </ul></font> | |
| 439 | + @ </ul></div> | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /* |
| 443 | 443 | ** WEBPAGE: tktview |
| 444 | 444 | ** URL: tktview?name=UUID |
| @@ -652,15 +652,16 @@ | ||
| 652 | 652 | } |
| 653 | 653 | needMod = ticket_need_moderation(0); |
| 654 | 654 | if( g.zPath[0]=='d' ){ |
| 655 | 655 | const char *zNeedMod = needMod ? "required" : "skipped"; |
| 656 | 656 | /* If called from /debug_tktnew or /debug_tktedit... */ |
| 657 | - @ <font color="blue"> | |
| 657 | + @ <div style="color:blue"> | |
| 658 | 658 | @ <p>Ticket artifact that would have been submitted:</p> |
| 659 | 659 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 660 | 660 | @ <blockquote><pre>Moderation would be %h(zNeedMod).</pre></blockquote> |
| 661 | - @ <hr /></font> | |
| 661 | + @ </div> | |
| 662 | + @ <hr> | |
| 662 | 663 | return TH_OK; |
| 663 | 664 | }else{ |
| 664 | 665 | if( g.thTrace ){ |
| 665 | 666 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 666 | 667 | "}<br />\n", |
| 667 | 668 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -423,11 +423,11 @@ | |
| 423 | ** For trouble-shooting purposes, render a dump of the aField[] table to |
| 424 | ** the webpage currently under construction. |
| 425 | */ |
| 426 | static void showAllFields(void){ |
| 427 | int i; |
| 428 | @ <font color="blue"> |
| 429 | @ <p>Database fields:</p><ul> |
| 430 | for(i=0; i<nField; i++){ |
| 431 | @ <li>aField[%d(i)].zName = "%h(aField[i].zName)"; |
| 432 | @ originally = "%h(aField[i].zValue)"; |
| 433 | @ currently = "%h(PD(aField[i].zName,""))"; |
| @@ -434,11 +434,11 @@ | |
| 434 | if( aField[i].zAppend ){ |
| 435 | @ zAppend = "%h(aField[i].zAppend)"; |
| 436 | } |
| 437 | @ mUsed = %d(aField[i].mUsed); |
| 438 | } |
| 439 | @ </ul></font> |
| 440 | } |
| 441 | |
| 442 | /* |
| 443 | ** WEBPAGE: tktview |
| 444 | ** URL: tktview?name=UUID |
| @@ -652,15 +652,16 @@ | |
| 652 | } |
| 653 | needMod = ticket_need_moderation(0); |
| 654 | if( g.zPath[0]=='d' ){ |
| 655 | const char *zNeedMod = needMod ? "required" : "skipped"; |
| 656 | /* If called from /debug_tktnew or /debug_tktedit... */ |
| 657 | @ <font color="blue"> |
| 658 | @ <p>Ticket artifact that would have been submitted:</p> |
| 659 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 660 | @ <blockquote><pre>Moderation would be %h(zNeedMod).</pre></blockquote> |
| 661 | @ <hr /></font> |
| 662 | return TH_OK; |
| 663 | }else{ |
| 664 | if( g.thTrace ){ |
| 665 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 666 | "}<br />\n", |
| 667 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -423,11 +423,11 @@ | |
| 423 | ** For trouble-shooting purposes, render a dump of the aField[] table to |
| 424 | ** the webpage currently under construction. |
| 425 | */ |
| 426 | static void showAllFields(void){ |
| 427 | int i; |
| 428 | @ <div style="color:blue"> |
| 429 | @ <p>Database fields:</p><ul> |
| 430 | for(i=0; i<nField; i++){ |
| 431 | @ <li>aField[%d(i)].zName = "%h(aField[i].zName)"; |
| 432 | @ originally = "%h(aField[i].zValue)"; |
| 433 | @ currently = "%h(PD(aField[i].zName,""))"; |
| @@ -434,11 +434,11 @@ | |
| 434 | if( aField[i].zAppend ){ |
| 435 | @ zAppend = "%h(aField[i].zAppend)"; |
| 436 | } |
| 437 | @ mUsed = %d(aField[i].mUsed); |
| 438 | } |
| 439 | @ </ul></div> |
| 440 | } |
| 441 | |
| 442 | /* |
| 443 | ** WEBPAGE: tktview |
| 444 | ** URL: tktview?name=UUID |
| @@ -652,15 +652,16 @@ | |
| 652 | } |
| 653 | needMod = ticket_need_moderation(0); |
| 654 | if( g.zPath[0]=='d' ){ |
| 655 | const char *zNeedMod = needMod ? "required" : "skipped"; |
| 656 | /* If called from /debug_tktnew or /debug_tktedit... */ |
| 657 | @ <div style="color:blue"> |
| 658 | @ <p>Ticket artifact that would have been submitted:</p> |
| 659 | @ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote> |
| 660 | @ <blockquote><pre>Moderation would be %h(zNeedMod).</pre></blockquote> |
| 661 | @ </div> |
| 662 | @ <hr> |
| 663 | return TH_OK; |
| 664 | }else{ |
| 665 | if( g.thTrace ){ |
| 666 | Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n" |
| 667 | "}<br />\n", |
| 668 |
+155
-141
| --- src/unicode.c | ||
| +++ src/unicode.c | ||
| @@ -13,11 +13,11 @@ | ||
| 13 | 13 | ** [email protected] |
| 14 | 14 | ** http://www.hwaci.com/drh/ |
| 15 | 15 | ** |
| 16 | 16 | ******************************************************************************* |
| 17 | 17 | ** |
| 18 | -** This file is copied from ext/fts3/fts3_unicode2.c of SQLite3 with | |
| 18 | +** This file is copied from ext/fts5/fts5_unicode2.c of SQLite3 with | |
| 19 | 19 | ** minor changes. |
| 20 | 20 | */ |
| 21 | 21 | #include "config.h" |
| 22 | 22 | #include "unicode.h" |
| 23 | 23 | |
| @@ -49,11 +49,11 @@ | ||
| 49 | 49 | 0x00164437, 0x0017CC02, 0x0018001D, 0x00187802, 0x00192C15, |
| 50 | 50 | 0x0019A804, 0x0019C001, 0x001B5001, 0x001B580F, 0x001B9C07, |
| 51 | 51 | 0x001BF402, 0x001C000E, 0x001C3C01, 0x001C4401, 0x001CC01B, |
| 52 | 52 | 0x001E980B, 0x001FAC09, 0x001FD804, 0x00205804, 0x00206C09, |
| 53 | 53 | 0x00209403, 0x0020A405, 0x0020C00F, 0x00216403, 0x00217801, |
| 54 | - 0x00238C21, 0x0024E803, 0x0024F812, 0x00254407, 0x00258804, | |
| 54 | + 0x00235030, 0x0024E803, 0x0024F812, 0x00254407, 0x00258804, | |
| 55 | 55 | 0x0025C001, 0x00260403, 0x0026F001, 0x0026F807, 0x00271C02, |
| 56 | 56 | 0x00272C03, 0x00275C01, 0x00278802, 0x0027C802, 0x0027E802, |
| 57 | 57 | 0x00280403, 0x0028F001, 0x0028F805, 0x00291C02, 0x00292C03, |
| 58 | 58 | 0x00294401, 0x0029C002, 0x0029D401, 0x002A0403, 0x002AF001, |
| 59 | 59 | 0x002AF808, 0x002B1C03, 0x002B2C03, 0x002B8802, 0x002BC002, |
| @@ -61,86 +61,91 @@ | ||
| 61 | 61 | 0x002D5802, 0x002D8802, 0x002DC001, 0x002E0801, 0x002EF805, |
| 62 | 62 | 0x002F1803, 0x002F2804, 0x002F5C01, 0x002FCC08, 0x00300004, |
| 63 | 63 | 0x0030F807, 0x00311803, 0x00312804, 0x00315402, 0x00318802, |
| 64 | 64 | 0x0031FC01, 0x00320403, 0x0032F001, 0x0032F807, 0x00331803, |
| 65 | 65 | 0x00332804, 0x00335402, 0x00338802, 0x00340403, 0x0034F807, |
| 66 | - 0x00351803, 0x00352804, 0x00355C01, 0x00358802, 0x0035E401, | |
| 67 | - 0x00360802, 0x00372801, 0x00373C06, 0x00375801, 0x00376008, | |
| 68 | - 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01, 0x00391C09, | |
| 69 | - 0x00396802, 0x003AC401, 0x003AD006, 0x003AEC02, 0x003B2006, | |
| 70 | - 0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, 0x003E6424, | |
| 71 | - 0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, 0x00415804, | |
| 72 | - 0x00417803, 0x00418803, 0x00419C07, 0x0041C404, 0x0042080C, | |
| 73 | - 0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, 0x004E400A, | |
| 74 | - 0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, 0x005BAC03, | |
| 75 | - 0x005C4803, 0x005CC805, 0x005D4802, 0x005DC802, 0x005ED023, | |
| 76 | - 0x005F6004, 0x005F7401, 0x0060000F, 0x0062A401, 0x0064800C, | |
| 77 | - 0x0064C00C, 0x00650001, 0x00651002, 0x00677822, 0x00685C05, | |
| 78 | - 0x00687802, 0x0069540A, 0x0069801D, 0x0069FC01, 0x006A8007, | |
| 79 | - 0x006AA006, 0x006AC00F, 0x006C0005, 0x006CD011, 0x006D6823, | |
| 80 | - 0x006E0003, 0x006E840D, 0x006F980E, 0x006FF004, 0x00709014, | |
| 81 | - 0x0070EC05, 0x0071F802, 0x00730008, 0x00734019, 0x0073B401, | |
| 82 | - 0x0073C803, 0x0073E002, 0x00770036, 0x0077F004, 0x007EF401, | |
| 83 | - 0x007EFC03, 0x007F3403, 0x007F7403, 0x007FB403, 0x007FF402, | |
| 84 | - 0x00800065, 0x0081980A, 0x0081E805, 0x00822805, 0x0082801F, | |
| 85 | - 0x00834021, 0x00840002, 0x00840C04, 0x00842002, 0x00845001, | |
| 86 | - 0x00845803, 0x00847806, 0x00849401, 0x00849C01, 0x0084A401, | |
| 87 | - 0x0084B801, 0x0084E802, 0x00850005, 0x00852804, 0x00853C01, | |
| 88 | - 0x00862802, 0x0086426B, 0x00900027, 0x0091000B, 0x0092704E, | |
| 89 | - 0x00940276, 0x009E53E0, 0x00ADD820, 0x00AE6022, 0x00AEF40C, | |
| 90 | - 0x00AF2808, 0x00AFB004, 0x00B39406, 0x00B3BC03, 0x00B3E404, | |
| 91 | - 0x00B3F802, 0x00B5C001, 0x00B5FC01, 0x00B7804F, 0x00B8C013, | |
| 92 | - 0x00BA001A, 0x00BA6C59, 0x00BC00D6, 0x00BFC00C, 0x00C00005, | |
| 93 | - 0x00C02019, 0x00C0A807, 0x00C0D802, 0x00C0F403, 0x00C26404, | |
| 94 | - 0x00C28001, 0x00C3EC01, 0x00C64002, 0x00C6580A, 0x00C70024, | |
| 95 | - 0x00C8001F, 0x00C8A81E, 0x00C94001, 0x00C98020, 0x00CA2827, | |
| 96 | - 0x00CB003F, 0x00CC0100, 0x01370040, 0x02924037, 0x0293F802, | |
| 97 | - 0x02983403, 0x0299BC10, 0x029A7802, 0x029BC008, 0x029C0017, | |
| 98 | - 0x029C8002, 0x029E2402, 0x02A00801, 0x02A01801, 0x02A02C01, | |
| 99 | - 0x02A08C09, 0x02A0D804, 0x02A1D004, 0x02A20002, 0x02A2D011, | |
| 100 | - 0x02A33802, 0x02A38012, 0x02A3E003, 0x02A3F001, 0x02A4980A, | |
| 101 | - 0x02A51C0D, 0x02A57C01, 0x02A60004, 0x02A6CC1B, 0x02A77802, | |
| 102 | - 0x02A79401, 0x02A8A40E, 0x02A90C01, 0x02A93002, 0x02A97004, | |
| 103 | - 0x02A9DC03, 0x02A9EC03, 0x02AAC001, 0x02AAC803, 0x02AADC02, | |
| 104 | - 0x02AAF802, 0x02AB0401, 0x02AB7802, 0x02ABAC07, 0x02ABD402, | |
| 105 | - 0x02AD6C01, 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02, | |
| 106 | - 0x037FFC01, 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802, | |
| 107 | - 0x03F7F002, 0x03F8001A, 0x03F88033, 0x03F95013, 0x03F9A004, | |
| 108 | - 0x03FBFC01, 0x03FC040F, 0x03FC6807, 0x03FCEC06, 0x03FD6C0B, | |
| 109 | - 0x03FF8007, 0x03FFA007, 0x03FFE405, 0x04040003, 0x0404DC09, | |
| 110 | - 0x0405E411, 0x04063001, 0x0406400C, 0x04068001, 0x0407402E, | |
| 111 | - 0x040B8001, 0x040DD805, 0x040E7C01, 0x040F4001, 0x0415BC01, | |
| 112 | - 0x04215C01, 0x0421DC02, 0x04247C01, 0x0424FC01, 0x04280403, | |
| 113 | - 0x04281402, 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009, | |
| 114 | - 0x0429FC01, 0x042B2001, 0x042B9402, 0x042BC007, 0x042CE407, | |
| 115 | - 0x042E6404, 0x04400003, 0x0440E016, 0x0441FC04, 0x0442C012, | |
| 116 | - 0x04440003, 0x04449C0E, 0x04450004, 0x0445CC03, 0x04460003, | |
| 117 | - 0x0446CC0E, 0x04471409, 0x04476C01, 0x04477403, 0x0448B012, | |
| 118 | - 0x044AA401, 0x044B7C0C, 0x044C0004, 0x044CF001, 0x044CF807, | |
| 119 | - 0x044D1C02, 0x044D2C03, 0x044D5C01, 0x044D8802, 0x044D9807, | |
| 120 | - 0x044DC005, 0x0452C014, 0x04531801, 0x0456BC07, 0x0456E020, | |
| 121 | - 0x04577002, 0x0458C014, 0x045AAC0D, 0x045C740F, 0x045CF004, | |
| 122 | - 0x0491C005, 0x05A9B802, 0x05ABC006, 0x05ACC010, 0x05AD1002, | |
| 123 | - 0x05BD442E, 0x05BE3C04, 0x06F27008, 0x074000F6, 0x07440027, | |
| 124 | - 0x0744A4C0, 0x07480046, 0x074C0057, 0x075B0401, 0x075B6C01, | |
| 125 | - 0x075BEC01, 0x075C5401, 0x075CD401, 0x075D3C01, 0x075DBC01, | |
| 126 | - 0x075E2401, 0x075EA401, 0x075F0C01, 0x0760028C, 0x076A6C05, | |
| 127 | - 0x076A840F, 0x07A34007, 0x07BBC002, 0x07C0002C, 0x07C0C064, | |
| 66 | + 0x00351803, 0x00352804, 0x00353C01, 0x00355C01, 0x00358802, | |
| 67 | + 0x0035E401, 0x00360802, 0x00372801, 0x00373C06, 0x00375801, | |
| 68 | + 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01, | |
| 69 | + 0x00391C09, 0x00396802, 0x003AC401, 0x003AD006, 0x003AEC02, | |
| 70 | + 0x003B2006, 0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, | |
| 71 | + 0x003E6424, 0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, | |
| 72 | + 0x00415804, 0x00417803, 0x00418803, 0x00419C07, 0x0041C404, | |
| 73 | + 0x0042080C, 0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, | |
| 74 | + 0x004E400A, 0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, | |
| 75 | + 0x005BAC03, 0x005C4803, 0x005CC805, 0x005D4802, 0x005DC802, | |
| 76 | + 0x005ED023, 0x005F6004, 0x005F7401, 0x0060000F, 0x00621402, | |
| 77 | + 0x0062A401, 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002, | |
| 78 | + 0x00677822, 0x00685C05, 0x00687802, 0x0069540A, 0x0069801D, | |
| 79 | + 0x0069FC01, 0x006A8007, 0x006AA006, 0x006AC00F, 0x006C0005, | |
| 80 | + 0x006CD011, 0x006D6823, 0x006E0003, 0x006E840D, 0x006F980E, | |
| 81 | + 0x006FF004, 0x00709014, 0x0070EC05, 0x0071F802, 0x00730008, | |
| 82 | + 0x00734019, 0x0073B401, 0x0073C803, 0x0073E002, 0x00770036, | |
| 83 | + 0x0077EC05, 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403, | |
| 84 | + 0x007FB403, 0x007FF402, 0x00800065, 0x0081980A, 0x0081E805, | |
| 85 | + 0x00822805, 0x0082801F, 0x00834021, 0x00840002, 0x00840C04, | |
| 86 | + 0x00842002, 0x00845001, 0x00845803, 0x00847806, 0x00849401, | |
| 87 | + 0x00849C01, 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005, | |
| 88 | + 0x00852804, 0x00853C01, 0x00862802, 0x0086426F, 0x00900027, | |
| 89 | + 0x0091000B, 0x0092704E, 0x00940276, 0x009E53E0, 0x00ADD820, | |
| 90 | + 0x00AE6022, 0x00AEF40C, 0x00AF2808, 0x00AFB004, 0x00B39406, | |
| 91 | + 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001, 0x00B5FC01, | |
| 92 | + 0x00B7804F, 0x00B8C015, 0x00BA001A, 0x00BA6C59, 0x00BC00D6, | |
| 93 | + 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807, 0x00C0D802, | |
| 94 | + 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01, 0x00C64002, | |
| 95 | + 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E, 0x00C94001, | |
| 96 | + 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100, 0x01370040, | |
| 97 | + 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10, 0x029A7802, | |
| 98 | + 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402, 0x02A00801, | |
| 99 | + 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804, 0x02A1D004, | |
| 100 | + 0x02A20002, 0x02A2D012, 0x02A33802, 0x02A38012, 0x02A3E003, | |
| 101 | + 0x02A3F001, 0x02A4980A, 0x02A51C0D, 0x02A57C01, 0x02A60004, | |
| 102 | + 0x02A6CC1B, 0x02A77802, 0x02A79401, 0x02A8A40E, 0x02A90C01, | |
| 103 | + 0x02A93002, 0x02A97004, 0x02A9DC03, 0x02A9EC03, 0x02AAC001, | |
| 104 | + 0x02AAC803, 0x02AADC02, 0x02AAF802, 0x02AB0401, 0x02AB7802, | |
| 105 | + 0x02ABAC07, 0x02ABD402, 0x02AD6C01, 0x02AF8C0B, 0x03600001, | |
| 106 | + 0x036DFC02, 0x036FFC02, 0x037FFC01, 0x03EC7801, 0x03ECA401, | |
| 107 | + 0x03EEC810, 0x03F4F802, 0x03F7F002, 0x03F8001A, 0x03F88033, | |
| 108 | + 0x03F95013, 0x03F9A004, 0x03FBFC01, 0x03FC040F, 0x03FC6807, | |
| 109 | + 0x03FCEC06, 0x03FD6C0B, 0x03FF8007, 0x03FFA007, 0x03FFE405, | |
| 110 | + 0x04040003, 0x0404DC09, 0x0405E411, 0x04063003, 0x0406400C, | |
| 111 | + 0x04068001, 0x0407402E, 0x040B8001, 0x040DD805, 0x040E7C01, | |
| 112 | + 0x040F4001, 0x0415BC01, 0x04215C01, 0x0421DC02, 0x04247C01, | |
| 113 | + 0x0424FC01, 0x04280403, 0x04281402, 0x04283004, 0x0428E003, | |
| 114 | + 0x0428FC01, 0x04294009, 0x0429FC01, 0x042B2001, 0x042B9402, | |
| 115 | + 0x042BC007, 0x042CE407, 0x042E6404, 0x04400003, 0x0440E016, | |
| 116 | + 0x0441FC04, 0x0442C012, 0x04440003, 0x04449C0E, 0x04450004, | |
| 117 | + 0x0445CC03, 0x04460003, 0x0446CC0E, 0x04471409, 0x04476C01, | |
| 118 | + 0x04477403, 0x0448B013, 0x044AA401, 0x044B7C0C, 0x044C0004, | |
| 119 | + 0x044CF001, 0x044CF807, 0x044D1C02, 0x044D2C03, 0x044D5C01, | |
| 120 | + 0x044D8802, 0x044D9807, 0x044DC005, 0x0450D412, 0x04512C05, | |
| 121 | + 0x04516C01, 0x04517401, 0x0452C014, 0x04531801, 0x0456BC07, | |
| 122 | + 0x0456E020, 0x04577002, 0x0458C014, 0x0459800D, 0x045AAC0D, | |
| 123 | + 0x045C740F, 0x045CF004, 0x0470BC08, 0x0470E008, 0x04710405, | |
| 124 | + 0x0471C002, 0x04724816, 0x0472A40E, 0x0491C005, 0x05A9B802, | |
| 125 | + 0x05ABC006, 0x05ACC010, 0x05AD1002, 0x05BD442E, 0x05BE3C04, | |
| 126 | + 0x06F27008, 0x074000F6, 0x07440027, 0x0744A4C0, 0x07480046, | |
| 127 | + 0x074C0057, 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401, | |
| 128 | + 0x075CD401, 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401, | |
| 129 | + 0x075F0C01, 0x0760028C, 0x076A6C05, 0x076A840F, 0x07800007, | |
| 130 | + 0x07802011, 0x07806C07, 0x07808C02, 0x07809805, 0x07A34007, | |
| 131 | + 0x07A51007, 0x07A57802, 0x07BBC002, 0x07C0002C, 0x07C0C064, | |
| 128 | 132 | 0x07C2800F, 0x07C2C40F, 0x07C3040F, 0x07C34425, 0x07C4401F, |
| 129 | - 0x07C4C03C, 0x07C5C02B, 0x07C7981D, 0x07C8402B, 0x07C90009, | |
| 130 | - 0x07C94002, 0x07CC027A, 0x07D5EC29, 0x07D6952C, 0x07DB800D, | |
| 131 | - 0x07DBC004, 0x07DC0074, 0x07DE0055, 0x07E0000C, 0x07E04038, | |
| 132 | - 0x07E1400A, 0x07E18028, 0x07E2401E, 0x07E44009, 0x07E60005, | |
| 133 | - 0x07E70001, 0x38000401, 0x38008060, 0x380400F0, | |
| 133 | + 0x07C4C03C, 0x07C5C03D, 0x07C7981D, 0x07C8402C, 0x07C90009, | |
| 134 | + 0x07C94002, 0x07CC03D3, 0x07DB800D, 0x07DBC007, 0x07DC0074, | |
| 135 | + 0x07DE0055, 0x07E0000C, 0x07E04038, 0x07E1400A, 0x07E18028, | |
| 136 | + 0x07E2401E, 0x07E4400F, 0x07E48008, 0x07E4C001, 0x07E4CC0C, | |
| 137 | + 0x07E5000C, 0x07E5400F, 0x07E60012, 0x07E70001, 0x38000401, | |
| 138 | + 0x38008060, 0x380400F0, | |
| 134 | 139 | }; |
| 135 | 140 | static const unsigned int aAscii[4] = { |
| 136 | 141 | 0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001, |
| 137 | 142 | }; |
| 138 | 143 | |
| 139 | - if( c<128 ){ | |
| 144 | + if( (unsigned int)c<128 ){ | |
| 140 | 145 | return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 ); |
| 141 | - }else if( c<(1<<22) ){ | |
| 146 | + }else if( (unsigned int)c<(1<<22) ){ | |
| 142 | 147 | unsigned int key = (((unsigned int)c)<<10) | 0x000003FF; |
| 143 | 148 | int iRes = 0; |
| 144 | 149 | int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; |
| 145 | 150 | int iLo = 0; |
| 146 | 151 | while( iHi>=iLo ){ |
| @@ -258,95 +263,100 @@ | ||
| 258 | 263 | static const struct TableEntry { |
| 259 | 264 | unsigned short iCode; |
| 260 | 265 | unsigned char flags; |
| 261 | 266 | unsigned char nRange; |
| 262 | 267 | } aEntry[] = { |
| 263 | - {65, 14, 26}, {181, 64, 1}, {192, 14, 23}, | |
| 268 | + {65, 14, 26}, {181, 66, 1}, {192, 14, 23}, | |
| 264 | 269 | {216, 14, 7}, {256, 1, 48}, {306, 1, 6}, |
| 265 | - {313, 1, 16}, {330, 1, 46}, {376, 132, 1}, | |
| 266 | - {377, 1, 6}, {383, 120, 1}, {385, 50, 1}, | |
| 267 | - {386, 1, 4}, {390, 44, 1}, {391, 0, 1}, | |
| 268 | - {393, 42, 2}, {395, 0, 1}, {398, 32, 1}, | |
| 269 | - {399, 38, 1}, {400, 40, 1}, {401, 0, 1}, | |
| 270 | - {403, 42, 1}, {404, 46, 1}, {406, 52, 1}, | |
| 271 | - {407, 48, 1}, {408, 0, 1}, {412, 52, 1}, | |
| 272 | - {413, 54, 1}, {415, 56, 1}, {416, 1, 6}, | |
| 273 | - {422, 60, 1}, {423, 0, 1}, {425, 60, 1}, | |
| 274 | - {428, 0, 1}, {430, 60, 1}, {431, 0, 1}, | |
| 275 | - {433, 58, 2}, {435, 1, 4}, {439, 62, 1}, | |
| 270 | + {313, 1, 16}, {330, 1, 46}, {376, 150, 1}, | |
| 271 | + {377, 1, 6}, {383, 138, 1}, {385, 52, 1}, | |
| 272 | + {386, 1, 4}, {390, 46, 1}, {391, 0, 1}, | |
| 273 | + {393, 44, 2}, {395, 0, 1}, {398, 34, 1}, | |
| 274 | + {399, 40, 1}, {400, 42, 1}, {401, 0, 1}, | |
| 275 | + {403, 44, 1}, {404, 48, 1}, {406, 54, 1}, | |
| 276 | + {407, 50, 1}, {408, 0, 1}, {412, 54, 1}, | |
| 277 | + {413, 56, 1}, {415, 58, 1}, {416, 1, 6}, | |
| 278 | + {422, 62, 1}, {423, 0, 1}, {425, 62, 1}, | |
| 279 | + {428, 0, 1}, {430, 62, 1}, {431, 0, 1}, | |
| 280 | + {433, 60, 2}, {435, 1, 4}, {439, 64, 1}, | |
| 276 | 281 | {440, 0, 1}, {444, 0, 1}, {452, 2, 1}, |
| 277 | 282 | {453, 0, 1}, {455, 2, 1}, {456, 0, 1}, |
| 278 | 283 | {458, 2, 1}, {459, 1, 18}, {478, 1, 18}, |
| 279 | - {497, 2, 1}, {498, 1, 4}, {502, 138, 1}, | |
| 280 | - {503, 150, 1}, {504, 1, 40}, {544, 126, 1}, | |
| 281 | - {546, 1, 18}, {570, 72, 1}, {571, 0, 1}, | |
| 282 | - {573, 124, 1}, {574, 70, 1}, {577, 0, 1}, | |
| 283 | - {579, 122, 1}, {580, 28, 1}, {581, 30, 1}, | |
| 284 | - {582, 1, 10}, {837, 36, 1}, {880, 1, 4}, | |
| 285 | - {886, 0, 1}, {895, 36, 1}, {902, 18, 1}, | |
| 286 | - {904, 16, 3}, {908, 26, 1}, {910, 24, 2}, | |
| 284 | + {497, 2, 1}, {498, 1, 4}, {502, 156, 1}, | |
| 285 | + {503, 168, 1}, {504, 1, 40}, {544, 144, 1}, | |
| 286 | + {546, 1, 18}, {570, 74, 1}, {571, 0, 1}, | |
| 287 | + {573, 142, 1}, {574, 72, 1}, {577, 0, 1}, | |
| 288 | + {579, 140, 1}, {580, 30, 1}, {581, 32, 1}, | |
| 289 | + {582, 1, 10}, {837, 38, 1}, {880, 1, 4}, | |
| 290 | + {886, 0, 1}, {895, 38, 1}, {902, 20, 1}, | |
| 291 | + {904, 18, 3}, {908, 28, 1}, {910, 26, 2}, | |
| 287 | 292 | {913, 14, 17}, {931, 14, 9}, {962, 0, 1}, |
| 288 | - {975, 4, 1}, {976, 156, 1}, {977, 158, 1}, | |
| 289 | - {981, 162, 1}, {982, 160, 1}, {984, 1, 24}, | |
| 290 | - {1008, 152, 1}, {1009, 154, 1}, {1012, 146, 1}, | |
| 291 | - {1013, 144, 1}, {1015, 0, 1}, {1017, 168, 1}, | |
| 292 | - {1018, 0, 1}, {1021, 126, 3}, {1024, 34, 16}, | |
| 293 | + {975, 4, 1}, {976, 174, 1}, {977, 176, 1}, | |
| 294 | + {981, 180, 1}, {982, 178, 1}, {984, 1, 24}, | |
| 295 | + {1008, 170, 1}, {1009, 172, 1}, {1012, 164, 1}, | |
| 296 | + {1013, 162, 1}, {1015, 0, 1}, {1017, 186, 1}, | |
| 297 | + {1018, 0, 1}, {1021, 144, 3}, {1024, 36, 16}, | |
| 293 | 298 | {1040, 14, 32}, {1120, 1, 34}, {1162, 1, 54}, |
| 294 | 299 | {1216, 6, 1}, {1217, 1, 14}, {1232, 1, 96}, |
| 295 | - {1329, 22, 38}, {4256, 68, 38}, {4295, 68, 1}, | |
| 296 | - {4301, 68, 1}, {5112, 166, 6}, {7680, 1, 150}, | |
| 297 | - {7835, 148, 1}, {7838, 112, 1}, {7840, 1, 96}, | |
| 298 | - {7944, 166, 8}, {7960, 166, 6}, {7976, 166, 8}, | |
| 299 | - {7992, 166, 8}, {8008, 166, 6}, {8025, 167, 8}, | |
| 300 | - {8040, 166, 8}, {8072, 166, 8}, {8088, 166, 8}, | |
| 301 | - {8104, 166, 8}, {8120, 166, 2}, {8122, 142, 2}, | |
| 302 | - {8124, 164, 1}, {8126, 116, 1}, {8136, 140, 4}, | |
| 303 | - {8140, 164, 1}, {8152, 166, 2}, {8154, 136, 2}, | |
| 304 | - {8168, 166, 2}, {8170, 134, 2}, {8172, 168, 1}, | |
| 305 | - {8184, 128, 2}, {8186, 130, 2}, {8188, 164, 1}, | |
| 306 | - {8486, 114, 1}, {8490, 108, 1}, {8491, 110, 1}, | |
| 307 | - {8498, 12, 1}, {8544, 8, 16}, {8579, 0, 1}, | |
| 308 | - {9398, 10, 26}, {11264, 22, 47}, {11360, 0, 1}, | |
| 309 | - {11362, 104, 1}, {11363, 118, 1}, {11364, 106, 1}, | |
| 310 | - {11367, 1, 6}, {11373, 100, 1}, {11374, 102, 1}, | |
| 311 | - {11375, 96, 1}, {11376, 98, 1}, {11378, 0, 1}, | |
| 312 | - {11381, 0, 1}, {11390, 94, 2}, {11392, 1, 100}, | |
| 313 | - {11499, 1, 4}, {11506, 0, 1}, {42560, 1, 46}, | |
| 314 | - {42624, 1, 28}, {42786, 1, 14}, {42802, 1, 62}, | |
| 315 | - {42873, 1, 4}, {42877, 92, 1}, {42878, 1, 10}, | |
| 316 | - {42891, 0, 1}, {42893, 84, 1}, {42896, 1, 4}, | |
| 317 | - {42902, 1, 20}, {42922, 78, 1}, {42923, 74, 1}, | |
| 318 | - {42924, 76, 1}, {42925, 80, 1}, {42928, 88, 1}, | |
| 319 | - {42929, 82, 1}, {42930, 86, 1}, {42931, 66, 1}, | |
| 320 | - {42932, 1, 4}, {43888, 90, 80}, {65313, 14, 26}, | |
| 300 | + {1329, 24, 38}, {4256, 70, 38}, {4295, 70, 1}, | |
| 301 | + {4301, 70, 1}, {5112, 184, 6}, {7296, 122, 1}, | |
| 302 | + {7297, 124, 1}, {7298, 126, 1}, {7299, 130, 2}, | |
| 303 | + {7301, 128, 1}, {7302, 132, 1}, {7303, 134, 1}, | |
| 304 | + {7304, 96, 1}, {7680, 1, 150}, {7835, 166, 1}, | |
| 305 | + {7838, 116, 1}, {7840, 1, 96}, {7944, 184, 8}, | |
| 306 | + {7960, 184, 6}, {7976, 184, 8}, {7992, 184, 8}, | |
| 307 | + {8008, 184, 6}, {8025, 185, 8}, {8040, 184, 8}, | |
| 308 | + {8072, 184, 8}, {8088, 184, 8}, {8104, 184, 8}, | |
| 309 | + {8120, 184, 2}, {8122, 160, 2}, {8124, 182, 1}, | |
| 310 | + {8126, 120, 1}, {8136, 158, 4}, {8140, 182, 1}, | |
| 311 | + {8152, 184, 2}, {8154, 154, 2}, {8168, 184, 2}, | |
| 312 | + {8170, 152, 2}, {8172, 186, 1}, {8184, 146, 2}, | |
| 313 | + {8186, 148, 2}, {8188, 182, 1}, {8486, 118, 1}, | |
| 314 | + {8490, 112, 1}, {8491, 114, 1}, {8498, 12, 1}, | |
| 315 | + {8544, 8, 16}, {8579, 0, 1}, {9398, 10, 26}, | |
| 316 | + {11264, 24, 47}, {11360, 0, 1}, {11362, 108, 1}, | |
| 317 | + {11363, 136, 1}, {11364, 110, 1}, {11367, 1, 6}, | |
| 318 | + {11373, 104, 1}, {11374, 106, 1}, {11375, 100, 1}, | |
| 319 | + {11376, 102, 1}, {11378, 0, 1}, {11381, 0, 1}, | |
| 320 | + {11390, 98, 2}, {11392, 1, 100}, {11499, 1, 4}, | |
| 321 | + {11506, 0, 1}, {42560, 1, 46}, {42624, 1, 28}, | |
| 322 | + {42786, 1, 14}, {42802, 1, 62}, {42873, 1, 4}, | |
| 323 | + {42877, 94, 1}, {42878, 1, 10}, {42891, 0, 1}, | |
| 324 | + {42893, 86, 1}, {42896, 1, 4}, {42902, 1, 20}, | |
| 325 | + {42922, 80, 1}, {42923, 76, 1}, {42924, 78, 1}, | |
| 326 | + {42925, 82, 1}, {42926, 80, 1}, {42928, 90, 1}, | |
| 327 | + {42929, 84, 1}, {42930, 88, 1}, {42931, 68, 1}, | |
| 328 | + {42932, 1, 4}, {43888, 92, 80}, {65313, 14, 26}, | |
| 321 | 329 | }; |
| 322 | 330 | static const unsigned short aiOff[] = { |
| 323 | 331 | 1, 2, 8, 15, 16, 26, 28, 32, |
| 324 | - 37, 38, 40, 48, 63, 64, 69, 71, | |
| 325 | - 79, 80, 116, 202, 203, 205, 206, 207, | |
| 326 | - 209, 210, 211, 213, 214, 217, 218, 219, | |
| 327 | - 775, 928, 7264, 10792, 10795, 23217, 23221, 23228, | |
| 328 | - 23231, 23254, 23256, 23275, 23278, 26672, 30204, 54721, | |
| 329 | - 54753, 54754, 54756, 54787, 54793, 54809, 57153, 57274, | |
| 330 | - 57921, 58019, 58363, 61722, 65268, 65341, 65373, 65406, | |
| 331 | - 65408, 65410, 65415, 65424, 65436, 65439, 65450, 65462, | |
| 332 | - 65472, 65476, 65478, 65480, 65482, 65488, 65506, 65511, | |
| 333 | - 65514, 65521, 65527, 65528, 65529, | |
| 332 | + 34, 37, 38, 40, 48, 63, 64, 69, | |
| 333 | + 71, 79, 80, 116, 202, 203, 205, 206, | |
| 334 | + 207, 209, 210, 211, 213, 214, 217, 218, | |
| 335 | + 219, 775, 928, 7264, 10792, 10795, 23217, 23221, | |
| 336 | + 23228, 23231, 23254, 23256, 23275, 23278, 26672, 30204, | |
| 337 | + 35267, 54721, 54753, 54754, 54756, 54787, 54793, 54809, | |
| 338 | + 57153, 57274, 57921, 58019, 58363, 59314, 59315, 59324, | |
| 339 | + 59325, 59326, 59332, 59356, 61722, 65268, 65341, 65373, | |
| 340 | + 65406, 65408, 65410, 65415, 65424, 65436, 65439, 65450, | |
| 341 | + 65462, 65472, 65476, 65478, 65480, 65482, 65488, 65506, | |
| 342 | + 65511, 65514, 65521, 65527, 65528, 65529, | |
| 334 | 343 | }; |
| 335 | 344 | |
| 336 | 345 | int ret = c; |
| 337 | 346 | |
| 338 | - assert( c>=0 ); | |
| 339 | 347 | assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 ); |
| 340 | 348 | |
| 341 | 349 | if( c<128 ){ |
| 342 | 350 | if( c>='A' && c<='Z' ) ret = c + ('a' - 'A'); |
| 343 | 351 | }else if( c<65536 ){ |
| 352 | + const struct TableEntry *p; | |
| 344 | 353 | int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; |
| 345 | 354 | int iLo = 0; |
| 346 | 355 | int iRes = -1; |
| 347 | 356 | |
| 357 | + assert( c>aEntry[0].iCode ); | |
| 348 | 358 | while( iHi>=iLo ){ |
| 349 | 359 | int iTest = (iHi + iLo) / 2; |
| 350 | 360 | int cmp = (c - aEntry[iTest].iCode); |
| 351 | 361 | if( cmp>=0 ){ |
| 352 | 362 | iRes = iTest; |
| @@ -353,30 +363,34 @@ | ||
| 353 | 363 | iLo = iTest+1; |
| 354 | 364 | }else{ |
| 355 | 365 | iHi = iTest-1; |
| 356 | 366 | } |
| 357 | 367 | } |
| 358 | - assert( iRes<0 || c>=aEntry[iRes].iCode ); | |
| 359 | - | |
| 360 | - if( iRes>=0 ){ | |
| 361 | - const struct TableEntry *p = &aEntry[iRes]; | |
| 362 | - if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){ | |
| 363 | - ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF; | |
| 364 | - assert( ret>0 ); | |
| 365 | - } | |
| 368 | + | |
| 369 | + assert( iRes>=0 && c>=aEntry[iRes].iCode ); | |
| 370 | + p = &aEntry[iRes]; | |
| 371 | + if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){ | |
| 372 | + ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF; | |
| 373 | + assert( ret>0 ); | |
| 366 | 374 | } |
| 367 | 375 | |
| 368 | 376 | if( bRemoveDiacritic ) ret = unicode_remove_diacritic(ret); |
| 369 | 377 | } |
| 370 | 378 | |
| 371 | 379 | else if( c>=66560 && c<66600 ){ |
| 372 | 380 | ret = c + 40; |
| 381 | + } | |
| 382 | + else if( c>=66736 && c<66772 ){ | |
| 383 | + ret = c + 40; | |
| 373 | 384 | } |
| 374 | 385 | else if( c>=68736 && c<68787 ){ |
| 375 | 386 | ret = c + 64; |
| 376 | 387 | } |
| 377 | 388 | else if( c>=71840 && c<71872 ){ |
| 378 | 389 | ret = c + 32; |
| 390 | + } | |
| 391 | + else if( c>=125184 && c<125218 ){ | |
| 392 | + ret = c + 34; | |
| 379 | 393 | } |
| 380 | 394 | |
| 381 | 395 | return ret; |
| 382 | 396 | } |
| 383 | 397 |
| --- src/unicode.c | |
| +++ src/unicode.c | |
| @@ -13,11 +13,11 @@ | |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** This file is copied from ext/fts3/fts3_unicode2.c of SQLite3 with |
| 19 | ** minor changes. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "unicode.h" |
| 23 | |
| @@ -49,11 +49,11 @@ | |
| 49 | 0x00164437, 0x0017CC02, 0x0018001D, 0x00187802, 0x00192C15, |
| 50 | 0x0019A804, 0x0019C001, 0x001B5001, 0x001B580F, 0x001B9C07, |
| 51 | 0x001BF402, 0x001C000E, 0x001C3C01, 0x001C4401, 0x001CC01B, |
| 52 | 0x001E980B, 0x001FAC09, 0x001FD804, 0x00205804, 0x00206C09, |
| 53 | 0x00209403, 0x0020A405, 0x0020C00F, 0x00216403, 0x00217801, |
| 54 | 0x00238C21, 0x0024E803, 0x0024F812, 0x00254407, 0x00258804, |
| 55 | 0x0025C001, 0x00260403, 0x0026F001, 0x0026F807, 0x00271C02, |
| 56 | 0x00272C03, 0x00275C01, 0x00278802, 0x0027C802, 0x0027E802, |
| 57 | 0x00280403, 0x0028F001, 0x0028F805, 0x00291C02, 0x00292C03, |
| 58 | 0x00294401, 0x0029C002, 0x0029D401, 0x002A0403, 0x002AF001, |
| 59 | 0x002AF808, 0x002B1C03, 0x002B2C03, 0x002B8802, 0x002BC002, |
| @@ -61,86 +61,91 @@ | |
| 61 | 0x002D5802, 0x002D8802, 0x002DC001, 0x002E0801, 0x002EF805, |
| 62 | 0x002F1803, 0x002F2804, 0x002F5C01, 0x002FCC08, 0x00300004, |
| 63 | 0x0030F807, 0x00311803, 0x00312804, 0x00315402, 0x00318802, |
| 64 | 0x0031FC01, 0x00320403, 0x0032F001, 0x0032F807, 0x00331803, |
| 65 | 0x00332804, 0x00335402, 0x00338802, 0x00340403, 0x0034F807, |
| 66 | 0x00351803, 0x00352804, 0x00355C01, 0x00358802, 0x0035E401, |
| 67 | 0x00360802, 0x00372801, 0x00373C06, 0x00375801, 0x00376008, |
| 68 | 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01, 0x00391C09, |
| 69 | 0x00396802, 0x003AC401, 0x003AD006, 0x003AEC02, 0x003B2006, |
| 70 | 0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, 0x003E6424, |
| 71 | 0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, 0x00415804, |
| 72 | 0x00417803, 0x00418803, 0x00419C07, 0x0041C404, 0x0042080C, |
| 73 | 0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, 0x004E400A, |
| 74 | 0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, 0x005BAC03, |
| 75 | 0x005C4803, 0x005CC805, 0x005D4802, 0x005DC802, 0x005ED023, |
| 76 | 0x005F6004, 0x005F7401, 0x0060000F, 0x0062A401, 0x0064800C, |
| 77 | 0x0064C00C, 0x00650001, 0x00651002, 0x00677822, 0x00685C05, |
| 78 | 0x00687802, 0x0069540A, 0x0069801D, 0x0069FC01, 0x006A8007, |
| 79 | 0x006AA006, 0x006AC00F, 0x006C0005, 0x006CD011, 0x006D6823, |
| 80 | 0x006E0003, 0x006E840D, 0x006F980E, 0x006FF004, 0x00709014, |
| 81 | 0x0070EC05, 0x0071F802, 0x00730008, 0x00734019, 0x0073B401, |
| 82 | 0x0073C803, 0x0073E002, 0x00770036, 0x0077F004, 0x007EF401, |
| 83 | 0x007EFC03, 0x007F3403, 0x007F7403, 0x007FB403, 0x007FF402, |
| 84 | 0x00800065, 0x0081980A, 0x0081E805, 0x00822805, 0x0082801F, |
| 85 | 0x00834021, 0x00840002, 0x00840C04, 0x00842002, 0x00845001, |
| 86 | 0x00845803, 0x00847806, 0x00849401, 0x00849C01, 0x0084A401, |
| 87 | 0x0084B801, 0x0084E802, 0x00850005, 0x00852804, 0x00853C01, |
| 88 | 0x00862802, 0x0086426B, 0x00900027, 0x0091000B, 0x0092704E, |
| 89 | 0x00940276, 0x009E53E0, 0x00ADD820, 0x00AE6022, 0x00AEF40C, |
| 90 | 0x00AF2808, 0x00AFB004, 0x00B39406, 0x00B3BC03, 0x00B3E404, |
| 91 | 0x00B3F802, 0x00B5C001, 0x00B5FC01, 0x00B7804F, 0x00B8C013, |
| 92 | 0x00BA001A, 0x00BA6C59, 0x00BC00D6, 0x00BFC00C, 0x00C00005, |
| 93 | 0x00C02019, 0x00C0A807, 0x00C0D802, 0x00C0F403, 0x00C26404, |
| 94 | 0x00C28001, 0x00C3EC01, 0x00C64002, 0x00C6580A, 0x00C70024, |
| 95 | 0x00C8001F, 0x00C8A81E, 0x00C94001, 0x00C98020, 0x00CA2827, |
| 96 | 0x00CB003F, 0x00CC0100, 0x01370040, 0x02924037, 0x0293F802, |
| 97 | 0x02983403, 0x0299BC10, 0x029A7802, 0x029BC008, 0x029C0017, |
| 98 | 0x029C8002, 0x029E2402, 0x02A00801, 0x02A01801, 0x02A02C01, |
| 99 | 0x02A08C09, 0x02A0D804, 0x02A1D004, 0x02A20002, 0x02A2D011, |
| 100 | 0x02A33802, 0x02A38012, 0x02A3E003, 0x02A3F001, 0x02A4980A, |
| 101 | 0x02A51C0D, 0x02A57C01, 0x02A60004, 0x02A6CC1B, 0x02A77802, |
| 102 | 0x02A79401, 0x02A8A40E, 0x02A90C01, 0x02A93002, 0x02A97004, |
| 103 | 0x02A9DC03, 0x02A9EC03, 0x02AAC001, 0x02AAC803, 0x02AADC02, |
| 104 | 0x02AAF802, 0x02AB0401, 0x02AB7802, 0x02ABAC07, 0x02ABD402, |
| 105 | 0x02AD6C01, 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02, |
| 106 | 0x037FFC01, 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802, |
| 107 | 0x03F7F002, 0x03F8001A, 0x03F88033, 0x03F95013, 0x03F9A004, |
| 108 | 0x03FBFC01, 0x03FC040F, 0x03FC6807, 0x03FCEC06, 0x03FD6C0B, |
| 109 | 0x03FF8007, 0x03FFA007, 0x03FFE405, 0x04040003, 0x0404DC09, |
| 110 | 0x0405E411, 0x04063001, 0x0406400C, 0x04068001, 0x0407402E, |
| 111 | 0x040B8001, 0x040DD805, 0x040E7C01, 0x040F4001, 0x0415BC01, |
| 112 | 0x04215C01, 0x0421DC02, 0x04247C01, 0x0424FC01, 0x04280403, |
| 113 | 0x04281402, 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009, |
| 114 | 0x0429FC01, 0x042B2001, 0x042B9402, 0x042BC007, 0x042CE407, |
| 115 | 0x042E6404, 0x04400003, 0x0440E016, 0x0441FC04, 0x0442C012, |
| 116 | 0x04440003, 0x04449C0E, 0x04450004, 0x0445CC03, 0x04460003, |
| 117 | 0x0446CC0E, 0x04471409, 0x04476C01, 0x04477403, 0x0448B012, |
| 118 | 0x044AA401, 0x044B7C0C, 0x044C0004, 0x044CF001, 0x044CF807, |
| 119 | 0x044D1C02, 0x044D2C03, 0x044D5C01, 0x044D8802, 0x044D9807, |
| 120 | 0x044DC005, 0x0452C014, 0x04531801, 0x0456BC07, 0x0456E020, |
| 121 | 0x04577002, 0x0458C014, 0x045AAC0D, 0x045C740F, 0x045CF004, |
| 122 | 0x0491C005, 0x05A9B802, 0x05ABC006, 0x05ACC010, 0x05AD1002, |
| 123 | 0x05BD442E, 0x05BE3C04, 0x06F27008, 0x074000F6, 0x07440027, |
| 124 | 0x0744A4C0, 0x07480046, 0x074C0057, 0x075B0401, 0x075B6C01, |
| 125 | 0x075BEC01, 0x075C5401, 0x075CD401, 0x075D3C01, 0x075DBC01, |
| 126 | 0x075E2401, 0x075EA401, 0x075F0C01, 0x0760028C, 0x076A6C05, |
| 127 | 0x076A840F, 0x07A34007, 0x07BBC002, 0x07C0002C, 0x07C0C064, |
| 128 | 0x07C2800F, 0x07C2C40F, 0x07C3040F, 0x07C34425, 0x07C4401F, |
| 129 | 0x07C4C03C, 0x07C5C02B, 0x07C7981D, 0x07C8402B, 0x07C90009, |
| 130 | 0x07C94002, 0x07CC027A, 0x07D5EC29, 0x07D6952C, 0x07DB800D, |
| 131 | 0x07DBC004, 0x07DC0074, 0x07DE0055, 0x07E0000C, 0x07E04038, |
| 132 | 0x07E1400A, 0x07E18028, 0x07E2401E, 0x07E44009, 0x07E60005, |
| 133 | 0x07E70001, 0x38000401, 0x38008060, 0x380400F0, |
| 134 | }; |
| 135 | static const unsigned int aAscii[4] = { |
| 136 | 0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001, |
| 137 | }; |
| 138 | |
| 139 | if( c<128 ){ |
| 140 | return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 ); |
| 141 | }else if( c<(1<<22) ){ |
| 142 | unsigned int key = (((unsigned int)c)<<10) | 0x000003FF; |
| 143 | int iRes = 0; |
| 144 | int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; |
| 145 | int iLo = 0; |
| 146 | while( iHi>=iLo ){ |
| @@ -258,95 +263,100 @@ | |
| 258 | static const struct TableEntry { |
| 259 | unsigned short iCode; |
| 260 | unsigned char flags; |
| 261 | unsigned char nRange; |
| 262 | } aEntry[] = { |
| 263 | {65, 14, 26}, {181, 64, 1}, {192, 14, 23}, |
| 264 | {216, 14, 7}, {256, 1, 48}, {306, 1, 6}, |
| 265 | {313, 1, 16}, {330, 1, 46}, {376, 132, 1}, |
| 266 | {377, 1, 6}, {383, 120, 1}, {385, 50, 1}, |
| 267 | {386, 1, 4}, {390, 44, 1}, {391, 0, 1}, |
| 268 | {393, 42, 2}, {395, 0, 1}, {398, 32, 1}, |
| 269 | {399, 38, 1}, {400, 40, 1}, {401, 0, 1}, |
| 270 | {403, 42, 1}, {404, 46, 1}, {406, 52, 1}, |
| 271 | {407, 48, 1}, {408, 0, 1}, {412, 52, 1}, |
| 272 | {413, 54, 1}, {415, 56, 1}, {416, 1, 6}, |
| 273 | {422, 60, 1}, {423, 0, 1}, {425, 60, 1}, |
| 274 | {428, 0, 1}, {430, 60, 1}, {431, 0, 1}, |
| 275 | {433, 58, 2}, {435, 1, 4}, {439, 62, 1}, |
| 276 | {440, 0, 1}, {444, 0, 1}, {452, 2, 1}, |
| 277 | {453, 0, 1}, {455, 2, 1}, {456, 0, 1}, |
| 278 | {458, 2, 1}, {459, 1, 18}, {478, 1, 18}, |
| 279 | {497, 2, 1}, {498, 1, 4}, {502, 138, 1}, |
| 280 | {503, 150, 1}, {504, 1, 40}, {544, 126, 1}, |
| 281 | {546, 1, 18}, {570, 72, 1}, {571, 0, 1}, |
| 282 | {573, 124, 1}, {574, 70, 1}, {577, 0, 1}, |
| 283 | {579, 122, 1}, {580, 28, 1}, {581, 30, 1}, |
| 284 | {582, 1, 10}, {837, 36, 1}, {880, 1, 4}, |
| 285 | {886, 0, 1}, {895, 36, 1}, {902, 18, 1}, |
| 286 | {904, 16, 3}, {908, 26, 1}, {910, 24, 2}, |
| 287 | {913, 14, 17}, {931, 14, 9}, {962, 0, 1}, |
| 288 | {975, 4, 1}, {976, 156, 1}, {977, 158, 1}, |
| 289 | {981, 162, 1}, {982, 160, 1}, {984, 1, 24}, |
| 290 | {1008, 152, 1}, {1009, 154, 1}, {1012, 146, 1}, |
| 291 | {1013, 144, 1}, {1015, 0, 1}, {1017, 168, 1}, |
| 292 | {1018, 0, 1}, {1021, 126, 3}, {1024, 34, 16}, |
| 293 | {1040, 14, 32}, {1120, 1, 34}, {1162, 1, 54}, |
| 294 | {1216, 6, 1}, {1217, 1, 14}, {1232, 1, 96}, |
| 295 | {1329, 22, 38}, {4256, 68, 38}, {4295, 68, 1}, |
| 296 | {4301, 68, 1}, {5112, 166, 6}, {7680, 1, 150}, |
| 297 | {7835, 148, 1}, {7838, 112, 1}, {7840, 1, 96}, |
| 298 | {7944, 166, 8}, {7960, 166, 6}, {7976, 166, 8}, |
| 299 | {7992, 166, 8}, {8008, 166, 6}, {8025, 167, 8}, |
| 300 | {8040, 166, 8}, {8072, 166, 8}, {8088, 166, 8}, |
| 301 | {8104, 166, 8}, {8120, 166, 2}, {8122, 142, 2}, |
| 302 | {8124, 164, 1}, {8126, 116, 1}, {8136, 140, 4}, |
| 303 | {8140, 164, 1}, {8152, 166, 2}, {8154, 136, 2}, |
| 304 | {8168, 166, 2}, {8170, 134, 2}, {8172, 168, 1}, |
| 305 | {8184, 128, 2}, {8186, 130, 2}, {8188, 164, 1}, |
| 306 | {8486, 114, 1}, {8490, 108, 1}, {8491, 110, 1}, |
| 307 | {8498, 12, 1}, {8544, 8, 16}, {8579, 0, 1}, |
| 308 | {9398, 10, 26}, {11264, 22, 47}, {11360, 0, 1}, |
| 309 | {11362, 104, 1}, {11363, 118, 1}, {11364, 106, 1}, |
| 310 | {11367, 1, 6}, {11373, 100, 1}, {11374, 102, 1}, |
| 311 | {11375, 96, 1}, {11376, 98, 1}, {11378, 0, 1}, |
| 312 | {11381, 0, 1}, {11390, 94, 2}, {11392, 1, 100}, |
| 313 | {11499, 1, 4}, {11506, 0, 1}, {42560, 1, 46}, |
| 314 | {42624, 1, 28}, {42786, 1, 14}, {42802, 1, 62}, |
| 315 | {42873, 1, 4}, {42877, 92, 1}, {42878, 1, 10}, |
| 316 | {42891, 0, 1}, {42893, 84, 1}, {42896, 1, 4}, |
| 317 | {42902, 1, 20}, {42922, 78, 1}, {42923, 74, 1}, |
| 318 | {42924, 76, 1}, {42925, 80, 1}, {42928, 88, 1}, |
| 319 | {42929, 82, 1}, {42930, 86, 1}, {42931, 66, 1}, |
| 320 | {42932, 1, 4}, {43888, 90, 80}, {65313, 14, 26}, |
| 321 | }; |
| 322 | static const unsigned short aiOff[] = { |
| 323 | 1, 2, 8, 15, 16, 26, 28, 32, |
| 324 | 37, 38, 40, 48, 63, 64, 69, 71, |
| 325 | 79, 80, 116, 202, 203, 205, 206, 207, |
| 326 | 209, 210, 211, 213, 214, 217, 218, 219, |
| 327 | 775, 928, 7264, 10792, 10795, 23217, 23221, 23228, |
| 328 | 23231, 23254, 23256, 23275, 23278, 26672, 30204, 54721, |
| 329 | 54753, 54754, 54756, 54787, 54793, 54809, 57153, 57274, |
| 330 | 57921, 58019, 58363, 61722, 65268, 65341, 65373, 65406, |
| 331 | 65408, 65410, 65415, 65424, 65436, 65439, 65450, 65462, |
| 332 | 65472, 65476, 65478, 65480, 65482, 65488, 65506, 65511, |
| 333 | 65514, 65521, 65527, 65528, 65529, |
| 334 | }; |
| 335 | |
| 336 | int ret = c; |
| 337 | |
| 338 | assert( c>=0 ); |
| 339 | assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 ); |
| 340 | |
| 341 | if( c<128 ){ |
| 342 | if( c>='A' && c<='Z' ) ret = c + ('a' - 'A'); |
| 343 | }else if( c<65536 ){ |
| 344 | int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; |
| 345 | int iLo = 0; |
| 346 | int iRes = -1; |
| 347 | |
| 348 | while( iHi>=iLo ){ |
| 349 | int iTest = (iHi + iLo) / 2; |
| 350 | int cmp = (c - aEntry[iTest].iCode); |
| 351 | if( cmp>=0 ){ |
| 352 | iRes = iTest; |
| @@ -353,30 +363,34 @@ | |
| 353 | iLo = iTest+1; |
| 354 | }else{ |
| 355 | iHi = iTest-1; |
| 356 | } |
| 357 | } |
| 358 | assert( iRes<0 || c>=aEntry[iRes].iCode ); |
| 359 | |
| 360 | if( iRes>=0 ){ |
| 361 | const struct TableEntry *p = &aEntry[iRes]; |
| 362 | if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){ |
| 363 | ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF; |
| 364 | assert( ret>0 ); |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | if( bRemoveDiacritic ) ret = unicode_remove_diacritic(ret); |
| 369 | } |
| 370 | |
| 371 | else if( c>=66560 && c<66600 ){ |
| 372 | ret = c + 40; |
| 373 | } |
| 374 | else if( c>=68736 && c<68787 ){ |
| 375 | ret = c + 64; |
| 376 | } |
| 377 | else if( c>=71840 && c<71872 ){ |
| 378 | ret = c + 32; |
| 379 | } |
| 380 | |
| 381 | return ret; |
| 382 | } |
| 383 |
| --- src/unicode.c | |
| +++ src/unicode.c | |
| @@ -13,11 +13,11 @@ | |
| 13 | ** [email protected] |
| 14 | ** http://www.hwaci.com/drh/ |
| 15 | ** |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** This file is copied from ext/fts5/fts5_unicode2.c of SQLite3 with |
| 19 | ** minor changes. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "unicode.h" |
| 23 | |
| @@ -49,11 +49,11 @@ | |
| 49 | 0x00164437, 0x0017CC02, 0x0018001D, 0x00187802, 0x00192C15, |
| 50 | 0x0019A804, 0x0019C001, 0x001B5001, 0x001B580F, 0x001B9C07, |
| 51 | 0x001BF402, 0x001C000E, 0x001C3C01, 0x001C4401, 0x001CC01B, |
| 52 | 0x001E980B, 0x001FAC09, 0x001FD804, 0x00205804, 0x00206C09, |
| 53 | 0x00209403, 0x0020A405, 0x0020C00F, 0x00216403, 0x00217801, |
| 54 | 0x00235030, 0x0024E803, 0x0024F812, 0x00254407, 0x00258804, |
| 55 | 0x0025C001, 0x00260403, 0x0026F001, 0x0026F807, 0x00271C02, |
| 56 | 0x00272C03, 0x00275C01, 0x00278802, 0x0027C802, 0x0027E802, |
| 57 | 0x00280403, 0x0028F001, 0x0028F805, 0x00291C02, 0x00292C03, |
| 58 | 0x00294401, 0x0029C002, 0x0029D401, 0x002A0403, 0x002AF001, |
| 59 | 0x002AF808, 0x002B1C03, 0x002B2C03, 0x002B8802, 0x002BC002, |
| @@ -61,86 +61,91 @@ | |
| 61 | 0x002D5802, 0x002D8802, 0x002DC001, 0x002E0801, 0x002EF805, |
| 62 | 0x002F1803, 0x002F2804, 0x002F5C01, 0x002FCC08, 0x00300004, |
| 63 | 0x0030F807, 0x00311803, 0x00312804, 0x00315402, 0x00318802, |
| 64 | 0x0031FC01, 0x00320403, 0x0032F001, 0x0032F807, 0x00331803, |
| 65 | 0x00332804, 0x00335402, 0x00338802, 0x00340403, 0x0034F807, |
| 66 | 0x00351803, 0x00352804, 0x00353C01, 0x00355C01, 0x00358802, |
| 67 | 0x0035E401, 0x00360802, 0x00372801, 0x00373C06, 0x00375801, |
| 68 | 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01, |
| 69 | 0x00391C09, 0x00396802, 0x003AC401, 0x003AD006, 0x003AEC02, |
| 70 | 0x003B2006, 0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, |
| 71 | 0x003E6424, 0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, |
| 72 | 0x00415804, 0x00417803, 0x00418803, 0x00419C07, 0x0041C404, |
| 73 | 0x0042080C, 0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, |
| 74 | 0x004E400A, 0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, |
| 75 | 0x005BAC03, 0x005C4803, 0x005CC805, 0x005D4802, 0x005DC802, |
| 76 | 0x005ED023, 0x005F6004, 0x005F7401, 0x0060000F, 0x00621402, |
| 77 | 0x0062A401, 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002, |
| 78 | 0x00677822, 0x00685C05, 0x00687802, 0x0069540A, 0x0069801D, |
| 79 | 0x0069FC01, 0x006A8007, 0x006AA006, 0x006AC00F, 0x006C0005, |
| 80 | 0x006CD011, 0x006D6823, 0x006E0003, 0x006E840D, 0x006F980E, |
| 81 | 0x006FF004, 0x00709014, 0x0070EC05, 0x0071F802, 0x00730008, |
| 82 | 0x00734019, 0x0073B401, 0x0073C803, 0x0073E002, 0x00770036, |
| 83 | 0x0077EC05, 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403, |
| 84 | 0x007FB403, 0x007FF402, 0x00800065, 0x0081980A, 0x0081E805, |
| 85 | 0x00822805, 0x0082801F, 0x00834021, 0x00840002, 0x00840C04, |
| 86 | 0x00842002, 0x00845001, 0x00845803, 0x00847806, 0x00849401, |
| 87 | 0x00849C01, 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005, |
| 88 | 0x00852804, 0x00853C01, 0x00862802, 0x0086426F, 0x00900027, |
| 89 | 0x0091000B, 0x0092704E, 0x00940276, 0x009E53E0, 0x00ADD820, |
| 90 | 0x00AE6022, 0x00AEF40C, 0x00AF2808, 0x00AFB004, 0x00B39406, |
| 91 | 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001, 0x00B5FC01, |
| 92 | 0x00B7804F, 0x00B8C015, 0x00BA001A, 0x00BA6C59, 0x00BC00D6, |
| 93 | 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807, 0x00C0D802, |
| 94 | 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01, 0x00C64002, |
| 95 | 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E, 0x00C94001, |
| 96 | 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100, 0x01370040, |
| 97 | 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10, 0x029A7802, |
| 98 | 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402, 0x02A00801, |
| 99 | 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804, 0x02A1D004, |
| 100 | 0x02A20002, 0x02A2D012, 0x02A33802, 0x02A38012, 0x02A3E003, |
| 101 | 0x02A3F001, 0x02A4980A, 0x02A51C0D, 0x02A57C01, 0x02A60004, |
| 102 | 0x02A6CC1B, 0x02A77802, 0x02A79401, 0x02A8A40E, 0x02A90C01, |
| 103 | 0x02A93002, 0x02A97004, 0x02A9DC03, 0x02A9EC03, 0x02AAC001, |
| 104 | 0x02AAC803, 0x02AADC02, 0x02AAF802, 0x02AB0401, 0x02AB7802, |
| 105 | 0x02ABAC07, 0x02ABD402, 0x02AD6C01, 0x02AF8C0B, 0x03600001, |
| 106 | 0x036DFC02, 0x036FFC02, 0x037FFC01, 0x03EC7801, 0x03ECA401, |
| 107 | 0x03EEC810, 0x03F4F802, 0x03F7F002, 0x03F8001A, 0x03F88033, |
| 108 | 0x03F95013, 0x03F9A004, 0x03FBFC01, 0x03FC040F, 0x03FC6807, |
| 109 | 0x03FCEC06, 0x03FD6C0B, 0x03FF8007, 0x03FFA007, 0x03FFE405, |
| 110 | 0x04040003, 0x0404DC09, 0x0405E411, 0x04063003, 0x0406400C, |
| 111 | 0x04068001, 0x0407402E, 0x040B8001, 0x040DD805, 0x040E7C01, |
| 112 | 0x040F4001, 0x0415BC01, 0x04215C01, 0x0421DC02, 0x04247C01, |
| 113 | 0x0424FC01, 0x04280403, 0x04281402, 0x04283004, 0x0428E003, |
| 114 | 0x0428FC01, 0x04294009, 0x0429FC01, 0x042B2001, 0x042B9402, |
| 115 | 0x042BC007, 0x042CE407, 0x042E6404, 0x04400003, 0x0440E016, |
| 116 | 0x0441FC04, 0x0442C012, 0x04440003, 0x04449C0E, 0x04450004, |
| 117 | 0x0445CC03, 0x04460003, 0x0446CC0E, 0x04471409, 0x04476C01, |
| 118 | 0x04477403, 0x0448B013, 0x044AA401, 0x044B7C0C, 0x044C0004, |
| 119 | 0x044CF001, 0x044CF807, 0x044D1C02, 0x044D2C03, 0x044D5C01, |
| 120 | 0x044D8802, 0x044D9807, 0x044DC005, 0x0450D412, 0x04512C05, |
| 121 | 0x04516C01, 0x04517401, 0x0452C014, 0x04531801, 0x0456BC07, |
| 122 | 0x0456E020, 0x04577002, 0x0458C014, 0x0459800D, 0x045AAC0D, |
| 123 | 0x045C740F, 0x045CF004, 0x0470BC08, 0x0470E008, 0x04710405, |
| 124 | 0x0471C002, 0x04724816, 0x0472A40E, 0x0491C005, 0x05A9B802, |
| 125 | 0x05ABC006, 0x05ACC010, 0x05AD1002, 0x05BD442E, 0x05BE3C04, |
| 126 | 0x06F27008, 0x074000F6, 0x07440027, 0x0744A4C0, 0x07480046, |
| 127 | 0x074C0057, 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401, |
| 128 | 0x075CD401, 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401, |
| 129 | 0x075F0C01, 0x0760028C, 0x076A6C05, 0x076A840F, 0x07800007, |
| 130 | 0x07802011, 0x07806C07, 0x07808C02, 0x07809805, 0x07A34007, |
| 131 | 0x07A51007, 0x07A57802, 0x07BBC002, 0x07C0002C, 0x07C0C064, |
| 132 | 0x07C2800F, 0x07C2C40F, 0x07C3040F, 0x07C34425, 0x07C4401F, |
| 133 | 0x07C4C03C, 0x07C5C03D, 0x07C7981D, 0x07C8402C, 0x07C90009, |
| 134 | 0x07C94002, 0x07CC03D3, 0x07DB800D, 0x07DBC007, 0x07DC0074, |
| 135 | 0x07DE0055, 0x07E0000C, 0x07E04038, 0x07E1400A, 0x07E18028, |
| 136 | 0x07E2401E, 0x07E4400F, 0x07E48008, 0x07E4C001, 0x07E4CC0C, |
| 137 | 0x07E5000C, 0x07E5400F, 0x07E60012, 0x07E70001, 0x38000401, |
| 138 | 0x38008060, 0x380400F0, |
| 139 | }; |
| 140 | static const unsigned int aAscii[4] = { |
| 141 | 0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001, |
| 142 | }; |
| 143 | |
| 144 | if( (unsigned int)c<128 ){ |
| 145 | return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 ); |
| 146 | }else if( (unsigned int)c<(1<<22) ){ |
| 147 | unsigned int key = (((unsigned int)c)<<10) | 0x000003FF; |
| 148 | int iRes = 0; |
| 149 | int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; |
| 150 | int iLo = 0; |
| 151 | while( iHi>=iLo ){ |
| @@ -258,95 +263,100 @@ | |
| 263 | static const struct TableEntry { |
| 264 | unsigned short iCode; |
| 265 | unsigned char flags; |
| 266 | unsigned char nRange; |
| 267 | } aEntry[] = { |
| 268 | {65, 14, 26}, {181, 66, 1}, {192, 14, 23}, |
| 269 | {216, 14, 7}, {256, 1, 48}, {306, 1, 6}, |
| 270 | {313, 1, 16}, {330, 1, 46}, {376, 150, 1}, |
| 271 | {377, 1, 6}, {383, 138, 1}, {385, 52, 1}, |
| 272 | {386, 1, 4}, {390, 46, 1}, {391, 0, 1}, |
| 273 | {393, 44, 2}, {395, 0, 1}, {398, 34, 1}, |
| 274 | {399, 40, 1}, {400, 42, 1}, {401, 0, 1}, |
| 275 | {403, 44, 1}, {404, 48, 1}, {406, 54, 1}, |
| 276 | {407, 50, 1}, {408, 0, 1}, {412, 54, 1}, |
| 277 | {413, 56, 1}, {415, 58, 1}, {416, 1, 6}, |
| 278 | {422, 62, 1}, {423, 0, 1}, {425, 62, 1}, |
| 279 | {428, 0, 1}, {430, 62, 1}, {431, 0, 1}, |
| 280 | {433, 60, 2}, {435, 1, 4}, {439, 64, 1}, |
| 281 | {440, 0, 1}, {444, 0, 1}, {452, 2, 1}, |
| 282 | {453, 0, 1}, {455, 2, 1}, {456, 0, 1}, |
| 283 | {458, 2, 1}, {459, 1, 18}, {478, 1, 18}, |
| 284 | {497, 2, 1}, {498, 1, 4}, {502, 156, 1}, |
| 285 | {503, 168, 1}, {504, 1, 40}, {544, 144, 1}, |
| 286 | {546, 1, 18}, {570, 74, 1}, {571, 0, 1}, |
| 287 | {573, 142, 1}, {574, 72, 1}, {577, 0, 1}, |
| 288 | {579, 140, 1}, {580, 30, 1}, {581, 32, 1}, |
| 289 | {582, 1, 10}, {837, 38, 1}, {880, 1, 4}, |
| 290 | {886, 0, 1}, {895, 38, 1}, {902, 20, 1}, |
| 291 | {904, 18, 3}, {908, 28, 1}, {910, 26, 2}, |
| 292 | {913, 14, 17}, {931, 14, 9}, {962, 0, 1}, |
| 293 | {975, 4, 1}, {976, 174, 1}, {977, 176, 1}, |
| 294 | {981, 180, 1}, {982, 178, 1}, {984, 1, 24}, |
| 295 | {1008, 170, 1}, {1009, 172, 1}, {1012, 164, 1}, |
| 296 | {1013, 162, 1}, {1015, 0, 1}, {1017, 186, 1}, |
| 297 | {1018, 0, 1}, {1021, 144, 3}, {1024, 36, 16}, |
| 298 | {1040, 14, 32}, {1120, 1, 34}, {1162, 1, 54}, |
| 299 | {1216, 6, 1}, {1217, 1, 14}, {1232, 1, 96}, |
| 300 | {1329, 24, 38}, {4256, 70, 38}, {4295, 70, 1}, |
| 301 | {4301, 70, 1}, {5112, 184, 6}, {7296, 122, 1}, |
| 302 | {7297, 124, 1}, {7298, 126, 1}, {7299, 130, 2}, |
| 303 | {7301, 128, 1}, {7302, 132, 1}, {7303, 134, 1}, |
| 304 | {7304, 96, 1}, {7680, 1, 150}, {7835, 166, 1}, |
| 305 | {7838, 116, 1}, {7840, 1, 96}, {7944, 184, 8}, |
| 306 | {7960, 184, 6}, {7976, 184, 8}, {7992, 184, 8}, |
| 307 | {8008, 184, 6}, {8025, 185, 8}, {8040, 184, 8}, |
| 308 | {8072, 184, 8}, {8088, 184, 8}, {8104, 184, 8}, |
| 309 | {8120, 184, 2}, {8122, 160, 2}, {8124, 182, 1}, |
| 310 | {8126, 120, 1}, {8136, 158, 4}, {8140, 182, 1}, |
| 311 | {8152, 184, 2}, {8154, 154, 2}, {8168, 184, 2}, |
| 312 | {8170, 152, 2}, {8172, 186, 1}, {8184, 146, 2}, |
| 313 | {8186, 148, 2}, {8188, 182, 1}, {8486, 118, 1}, |
| 314 | {8490, 112, 1}, {8491, 114, 1}, {8498, 12, 1}, |
| 315 | {8544, 8, 16}, {8579, 0, 1}, {9398, 10, 26}, |
| 316 | {11264, 24, 47}, {11360, 0, 1}, {11362, 108, 1}, |
| 317 | {11363, 136, 1}, {11364, 110, 1}, {11367, 1, 6}, |
| 318 | {11373, 104, 1}, {11374, 106, 1}, {11375, 100, 1}, |
| 319 | {11376, 102, 1}, {11378, 0, 1}, {11381, 0, 1}, |
| 320 | {11390, 98, 2}, {11392, 1, 100}, {11499, 1, 4}, |
| 321 | {11506, 0, 1}, {42560, 1, 46}, {42624, 1, 28}, |
| 322 | {42786, 1, 14}, {42802, 1, 62}, {42873, 1, 4}, |
| 323 | {42877, 94, 1}, {42878, 1, 10}, {42891, 0, 1}, |
| 324 | {42893, 86, 1}, {42896, 1, 4}, {42902, 1, 20}, |
| 325 | {42922, 80, 1}, {42923, 76, 1}, {42924, 78, 1}, |
| 326 | {42925, 82, 1}, {42926, 80, 1}, {42928, 90, 1}, |
| 327 | {42929, 84, 1}, {42930, 88, 1}, {42931, 68, 1}, |
| 328 | {42932, 1, 4}, {43888, 92, 80}, {65313, 14, 26}, |
| 329 | }; |
| 330 | static const unsigned short aiOff[] = { |
| 331 | 1, 2, 8, 15, 16, 26, 28, 32, |
| 332 | 34, 37, 38, 40, 48, 63, 64, 69, |
| 333 | 71, 79, 80, 116, 202, 203, 205, 206, |
| 334 | 207, 209, 210, 211, 213, 214, 217, 218, |
| 335 | 219, 775, 928, 7264, 10792, 10795, 23217, 23221, |
| 336 | 23228, 23231, 23254, 23256, 23275, 23278, 26672, 30204, |
| 337 | 35267, 54721, 54753, 54754, 54756, 54787, 54793, 54809, |
| 338 | 57153, 57274, 57921, 58019, 58363, 59314, 59315, 59324, |
| 339 | 59325, 59326, 59332, 59356, 61722, 65268, 65341, 65373, |
| 340 | 65406, 65408, 65410, 65415, 65424, 65436, 65439, 65450, |
| 341 | 65462, 65472, 65476, 65478, 65480, 65482, 65488, 65506, |
| 342 | 65511, 65514, 65521, 65527, 65528, 65529, |
| 343 | }; |
| 344 | |
| 345 | int ret = c; |
| 346 | |
| 347 | assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 ); |
| 348 | |
| 349 | if( c<128 ){ |
| 350 | if( c>='A' && c<='Z' ) ret = c + ('a' - 'A'); |
| 351 | }else if( c<65536 ){ |
| 352 | const struct TableEntry *p; |
| 353 | int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; |
| 354 | int iLo = 0; |
| 355 | int iRes = -1; |
| 356 | |
| 357 | assert( c>aEntry[0].iCode ); |
| 358 | while( iHi>=iLo ){ |
| 359 | int iTest = (iHi + iLo) / 2; |
| 360 | int cmp = (c - aEntry[iTest].iCode); |
| 361 | if( cmp>=0 ){ |
| 362 | iRes = iTest; |
| @@ -353,30 +363,34 @@ | |
| 363 | iLo = iTest+1; |
| 364 | }else{ |
| 365 | iHi = iTest-1; |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | assert( iRes>=0 && c>=aEntry[iRes].iCode ); |
| 370 | p = &aEntry[iRes]; |
| 371 | if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){ |
| 372 | ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF; |
| 373 | assert( ret>0 ); |
| 374 | } |
| 375 | |
| 376 | if( bRemoveDiacritic ) ret = unicode_remove_diacritic(ret); |
| 377 | } |
| 378 | |
| 379 | else if( c>=66560 && c<66600 ){ |
| 380 | ret = c + 40; |
| 381 | } |
| 382 | else if( c>=66736 && c<66772 ){ |
| 383 | ret = c + 40; |
| 384 | } |
| 385 | else if( c>=68736 && c<68787 ){ |
| 386 | ret = c + 64; |
| 387 | } |
| 388 | else if( c>=71840 && c<71872 ){ |
| 389 | ret = c + 32; |
| 390 | } |
| 391 | else if( c>=125184 && c<125218 ){ |
| 392 | ret = c + 34; |
| 393 | } |
| 394 | |
| 395 | return ret; |
| 396 | } |
| 397 |
+6
-1
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -1,8 +1,13 @@ | ||
| 1 | 1 | <title>Change Log</title> |
| 2 | 2 | |
| 3 | -<h2>Changes for Version 1.35 (2016-00-00)</h2> | |
| 3 | +<h2>Changes for Version 1.36 (2016-00-00)</h2> | |
| 4 | + | |
| 5 | + * Update internal Unicode character tables, used in regular expression | |
| 6 | + handling, from version 8.0 to 9.0. | |
| 7 | + | |
| 8 | +<h2>Changes for Version 1.35 (2016-06-14)</h2> | |
| 4 | 9 | |
| 5 | 10 | * Enable symlinks by default on all non-Windows platforms. |
| 6 | 11 | * Enhance the [/md_rules|Markdown formatting] so that hyperlinks that begin |
| 7 | 12 | with "/" are relative to the root of the Fossil repository. |
| 8 | 13 | * Rework the [/help?cmd=/setup_ulist|/setup_list page] (the User List page) |
| 9 | 14 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,8 +1,13 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes for Version 1.35 (2016-00-00)</h2> |
| 4 | |
| 5 | * Enable symlinks by default on all non-Windows platforms. |
| 6 | * Enhance the [/md_rules|Markdown formatting] so that hyperlinks that begin |
| 7 | with "/" are relative to the root of the Fossil repository. |
| 8 | * Rework the [/help?cmd=/setup_ulist|/setup_list page] (the User List page) |
| 9 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,8 +1,13 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes for Version 1.36 (2016-00-00)</h2> |
| 4 | |
| 5 | * Update internal Unicode character tables, used in regular expression |
| 6 | handling, from version 8.0 to 9.0. |
| 7 | |
| 8 | <h2>Changes for Version 1.35 (2016-06-14)</h2> |
| 9 | |
| 10 | * Enable symlinks by default on all non-Windows platforms. |
| 11 | * Enhance the [/md_rules|Markdown formatting] so that hyperlinks that begin |
| 12 | with "/" are relative to the root of the Fossil repository. |
| 13 | * Rework the [/help?cmd=/setup_ulist|/setup_list page] (the User List page) |
| 14 |
+2
-2
| --- www/password.wiki | ||
| +++ www/password.wiki | ||
| @@ -133,11 +133,11 @@ | ||
| 133 | 133 | able to authenticate to the server. |
| 134 | 134 | |
| 135 | 135 | The client normally gets the login and password from the "remote URL". |
| 136 | 136 | |
| 137 | 137 | <blockquote><pre> |
| 138 | -http://<font color="blue">login:password</font>@servername.org/path | |
| 138 | +http://<span style="color:blue">login:password</span>@servername.org/path | |
| 139 | 139 | </pre></blockquote> |
| 140 | 140 | |
| 141 | 141 | For older clients, the password is used for the shared secret as stated |
| 142 | 142 | in the URL and with no encoding. |
| 143 | 143 | For newer clients, the shared secret is derived from the password |
| @@ -145,11 +145,11 @@ | ||
| 145 | 145 | described above. However, if the first character of the password is |
| 146 | 146 | "*" (ASCII 0x2a) then the "*" is skipped and the rest of the password |
| 147 | 147 | is used directly as the share secret without the SHA1 encoding. |
| 148 | 148 | |
| 149 | 149 | <blockquote><pre> |
| 150 | -http://<font color="blue">login:*password</font>@servername.org/path | |
| 150 | +http://<span style="color:blue">login:*password</span>@servername.org/path | |
| 151 | 151 | </pre></blockquote> |
| 152 | 152 | |
| 153 | 153 | This *-before-the-password trick can be used by newer clients to |
| 154 | 154 | sync against a legacy server that does not understand the new SHA1 |
| 155 | 155 | password encoding. |
| 156 | 156 |
| --- www/password.wiki | |
| +++ www/password.wiki | |
| @@ -133,11 +133,11 @@ | |
| 133 | able to authenticate to the server. |
| 134 | |
| 135 | The client normally gets the login and password from the "remote URL". |
| 136 | |
| 137 | <blockquote><pre> |
| 138 | http://<font color="blue">login:password</font>@servername.org/path |
| 139 | </pre></blockquote> |
| 140 | |
| 141 | For older clients, the password is used for the shared secret as stated |
| 142 | in the URL and with no encoding. |
| 143 | For newer clients, the shared secret is derived from the password |
| @@ -145,11 +145,11 @@ | |
| 145 | described above. However, if the first character of the password is |
| 146 | "*" (ASCII 0x2a) then the "*" is skipped and the rest of the password |
| 147 | is used directly as the share secret without the SHA1 encoding. |
| 148 | |
| 149 | <blockquote><pre> |
| 150 | http://<font color="blue">login:*password</font>@servername.org/path |
| 151 | </pre></blockquote> |
| 152 | |
| 153 | This *-before-the-password trick can be used by newer clients to |
| 154 | sync against a legacy server that does not understand the new SHA1 |
| 155 | password encoding. |
| 156 |
| --- www/password.wiki | |
| +++ www/password.wiki | |
| @@ -133,11 +133,11 @@ | |
| 133 | able to authenticate to the server. |
| 134 | |
| 135 | The client normally gets the login and password from the "remote URL". |
| 136 | |
| 137 | <blockquote><pre> |
| 138 | http://<span style="color:blue">login:password</span>@servername.org/path |
| 139 | </pre></blockquote> |
| 140 | |
| 141 | For older clients, the password is used for the shared secret as stated |
| 142 | in the URL and with no encoding. |
| 143 | For newer clients, the shared secret is derived from the password |
| @@ -145,11 +145,11 @@ | |
| 145 | described above. However, if the first character of the password is |
| 146 | "*" (ASCII 0x2a) then the "*" is skipped and the rest of the password |
| 147 | is used directly as the share secret without the SHA1 encoding. |
| 148 | |
| 149 | <blockquote><pre> |
| 150 | http://<span style="color:blue">login:*password</span>@servername.org/path |
| 151 | </pre></blockquote> |
| 152 | |
| 153 | This *-before-the-password trick can be used by newer clients to |
| 154 | sync against a legacy server that does not understand the new SHA1 |
| 155 | password encoding. |
| 156 |