1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Changed my_strntoxxx functions to clear error number on start

Allow one to change ANSI_QUOTES mode per thread and on the fly
This commit is contained in:
monty@mashka.mysql.fi
2003-01-17 16:33:54 +02:00
parent eb22615ec7
commit 762cb225c9
6 changed files with 88 additions and 60 deletions

View File

@ -214,6 +214,7 @@ long my_strntol_8bit(CHARSET_INFO *cs,
const char *save, *e;
int overflow;
*err= 0; /* Initialize error indicator */
if (base < 0 || base == 1 || base > 36)
base = 10;
@ -330,6 +331,7 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
const char *save, *e;
int overflow;
*err= 0; /* Initialize error indicator */
if (base < 0 || base == 1 || base > 36)
base = 10;
@ -437,6 +439,7 @@ longlong my_strntoll_8bit(CHARSET_INFO *cs __attribute__((unused)),
const char *save;
int overflow;
*err= 0; /* Initialize error indicator */
if (base < 0 || base == 1 || base > 36)
base = 10;
@ -553,6 +556,7 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs,
const char *save;
int overflow;
*err= 0; /* Initialize error indicator */
if (base < 0 || base == 1 || base > 36)
base = 10;
@ -655,7 +659,8 @@ noconv:
cs Character set information
str String to convert to double
length Optional length for string.
end pointer to end of converted string
end result pointer to end of converted string
err Error number if failed conversion
NOTES:
If length is not INT_MAX32 or str[length] != 0 then the given str must
@ -665,23 +670,28 @@ noconv:
It's implemented this way to save a buffer allocation and a memory copy.
RETURN
value of number in string
Value of number in string
*/
double my_strntod_8bit(CHARSET_INFO *cs __attribute__((unused)),
char *str, uint length,
char **end, int *err __attribute__ ((unused)))
char **end, int *err)
{
char end_char;
double result;
errno= 0; /* Safety */
if (length == INT_MAX32 || str[length] == 0)
return strtod(str, end);
end_char= str[length];
str[length]= 0;
result= strtod(str, end);
str[length]= end_char; /* Restore end char */
result= strtod(str, end);
else
{
end_char= str[length];
str[length]= 0;
result= strtod(str, end);
str[length]= end_char; /* Restore end char */
}
*err= errno;
return result;
}