Index: driver/connect.c =================================================================== --- driver/connect.c (revision 999) +++ driver/connect.c (working copy) @@ -144,7 +144,7 @@ /* Use 'int' and fill all bits to avoid alignment Bug#25920 */ unsigned int opt_ssl_verify_server_cert = ~0; - options= sqlwchartoul(ds->option); + options= sqlwchartoul(ds->option, NULL); #ifdef WIN32 /* @@ -486,7 +486,7 @@ /* If FLAG_NO_PROMPT is no set, force prompting off. */ if (ds->option) { - options= sqlwchartoul(ds->option); + options= sqlwchartoul(ds->option, NULL); if (options & FLAG_NO_PROMPT) fDriverCompletion= SQL_DRIVER_NOPROMPT; } Index: setupgui/utils.c =================================================================== --- setupgui/utils.c (revision 999) +++ setupgui/utils.c (working copy) @@ -31,7 +31,7 @@ void DecompileOptions(DataSource *params) { - ulong nOptions= sqlwchartoul(params->option); + ulong nOptions= sqlwchartoul(params->option, NULL); params->dont_optimize_column_width= (nOptions & FLAG_FIELD_LENGTH) > 0; params->return_matching_rows= (nOptions & FLAG_FOUND_ROWS) > 0; /* 2 */ Index: util/stringutil.c =================================================================== --- util/stringutil.c (revision 999) +++ util/stringutil.c (working copy) @@ -570,21 +570,26 @@ * @return The integer result of the conversion or 0 if the * string could not be parsed. */ -unsigned long sqlwchartoul(const SQLWCHAR *wstr) +unsigned long sqlwchartoul(const SQLWCHAR *wstr, SQLWCHAR **endptr) { - const SQLWCHAR *end= wstr + sqlwcharlen(wstr) - 1; + unsigned long res= 0; SQLWCHAR c; - int pten= 1; - unsigned long res= 0; + if (!wstr) return 0; - for (; end >= wstr; pten *= 10, end--) + + while (c= *wstr++) { - c= *end; if (c < '0' || c > '9') - return 0; - res += (c - '0') * pten; + { + if (endptr) + *endptr= wstr; + break; + } + res*= 10; + res+= c - '0'; } + return res; } Index: util/stringutil.h =================================================================== --- util/stringutil.h (revision 999) +++ util/stringutil.h (working copy) @@ -94,7 +94,7 @@ const SQLWCHAR *sqlwcharchr(const SQLWCHAR *wstr, SQLWCHAR wchr); size_t sqlwcharlen(const SQLWCHAR *wstr); SQLWCHAR *sqlwchardup(const SQLWCHAR *wstr, size_t charlen); -unsigned long sqlwchartoul(const SQLWCHAR *wstr); +unsigned long sqlwchartoul(const SQLWCHAR *wstr, SQLWCHAR **endptr); void sqlwcharfromul(SQLWCHAR *wstr, unsigned long v); size_t sqlwcharncat2(SQLWCHAR *dest, const SQLWCHAR *src, size_t *n); SQLWCHAR *sqlwcharncpy(SQLWCHAR *dest, const SQLWCHAR *src, size_t n); Index: util/installer.c =================================================================== --- util/installer.c (revision 999) +++ util/installer.c (working copy) @@ -641,7 +641,7 @@ else if (dest && !*dest) ds_set_strattr(dest, val); else if (intdest) - *intdest= sqlwchartoul(val); + *intdest= sqlwchartoul(val, NULL); entries += sqlwcharlen(entries) + 1; } @@ -695,7 +695,7 @@ else if (intdest) { /* we know we have a ; or NULL at the end so we just let it go */ - *intdest= sqlwchartoul(split); + *intdest= sqlwchartoul(split, NULL); } attrs= end;