>>>From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
>>>Behalf Of Ziemowit Laski
Sent: Thursday, 26 January 2017 7:36 AM
To: sqlite-users@mailinglists.sqlite.org
Subject: [sqlite] BUG: Illegal initialization in icu.c : sqlite3IcuInit
>>>
>>>Visual C++ correctly catches this.  The fragment
>>>
>>>  struct IcuScalar {
>>>    const char *zName;                        /* Function name */
>>>    int nArg;                                 /* Number of arguments */
>>>    int enc;                                  /* Optimal text encoding */
>>>    void *pContext;                           /* sqlite3_user_data() context 
>>> */
>>>    void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
>>>  } scalars[] = {
>>>    {"regexp", 2, SQLITE_ANY|SQLITE_DETERMINISTIC,          0, 
>>> icuRegexpFunc},
>>>
>>>    {"lower",  1, SQLITE_UTF16|SQLITE_DETERMINISTIC,        0, 
>>> icuCaseFunc16},
>>>    {"lower",  2, SQLITE_UTF16|SQLITE_DETERMINISTIC,        0, 
>>> icuCaseFunc16},
>>>    {"upper",  1, SQLITE_UTF16|SQLITE_DETERMINISTIC, (void*)1, 
>>> icuCaseFunc16},
>>>    {"upper",  2, SQLITE_UTF16|SQLITE_DETERMINISTIC, (void*)1, 
>>> icuCaseFunc16},
>>>
>>>    {"lower",  1, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, 
>>> icuCaseFunc16},
>>>    {"lower",  2, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, 
>>> icuCaseFunc16},
>>>    {"upper",  1, SQLITE_UTF8|SQLITE_DETERMINISTIC,  (void*)1, 
>>> icuCaseFunc16},
>>>    {"upper",  2, SQLITE_UTF8|SQLITE_DETERMINISTIC,  (void*)1, 
>>> icuCaseFunc16},
>>>
>>>    {"like",   2, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, icuLikeFunc},
>>>    {"like",   3, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, icuLikeFunc},
>>>
>>>    {"icu_load_collation",  2, SQLITE_UTF8, (void*)db, icuLoadCollation},
>>>  };
>>>
>>>  int rc = SQLITE_OK;
>>>  int i;
>>>
>>>should read
>>>
>>>       struct IcuScalar {
>>>              const char *zName;                        /* Function name */
>>>              int nArg;                                 /* Number of 
>>> arguments */
>>>              int enc;                                  /* Optimal text 
>>> encoding */
>>>              void *pContext;                           /* 
>>> sqlite3_user_data() context */
>>>              void(*xFunc)(sqlite3_context*, int, sqlite3_value**);
>>>       } scalars[] = {
>>>              { "regexp", 2, SQLITE_ANY | SQLITE_DETERMINISTIC,          0, 
>>> icuRegexpFunc },
>>>
>>>              { "lower",  1, SQLITE_UTF16 | SQLITE_DETERMINISTIC,        0, 
>>> icuCaseFunc16 },
>>>              { "lower",  2, SQLITE_UTF16 | SQLITE_DETERMINISTIC,        0, 
>>> icuCaseFunc16 },
>>>              { "upper",  1, SQLITE_UTF16 | SQLITE_DETERMINISTIC, (void*)1, 
>>> icuCaseFunc16 },
>>>              { "upper",  2, SQLITE_UTF16 | SQLITE_DETERMINISTIC, (void*)1, 
>>> icuCaseFunc16 },
>>>
>>>              { "lower",  1, SQLITE_UTF8 | SQLITE_DETERMINISTIC,         0, 
>>> icuCaseFunc16 },
>>>              { "lower",  2, SQLITE_UTF8 | SQLITE_DETERMINISTIC,         0, 
>>> icuCaseFunc16 },
>>>              { "upper",  1, SQLITE_UTF8 | SQLITE_DETERMINISTIC,  (void*)1, 
>>> icuCaseFunc16 },
>>>              { "upper",  2, SQLITE_UTF8 | SQLITE_DETERMINISTIC,  (void*)1, 
>>> icuCaseFunc16 },
>>>
>>>              { "like",   2, SQLITE_UTF8 | SQLITE_DETERMINISTIC,         0, 
>>> icuLikeFunc },
>>>              { "like",   3, SQLITE_UTF8 | SQLITE_DETERMINISTIC,         0, 
>>> icuLikeFunc },
>>>
>>>              { "icu_load_collation",  2, SQLITE_UTF8, 0, icuLoadCollation }
>>>       };
>>>
>>>       int rc = SQLITE_OK;
>>>       int i;
>>>
>>>       scalars[11].pContext = (void*)db;
>>>

Why would you say that? What error message are you getting on what compiler, 
and why would that change produce any different result? What type is 'db'?

Can you quote some specified reference to the C standard document in support of 
your contention?

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org





_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to