diff options
author | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-03-26 13:44:58 +0300 |
---|---|---|
committer | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-03-26 13:44:58 +0300 |
commit | d25dd07363cbe54d813c2d9cd9cc16ff32e9bde4 (patch) | |
tree | 92da129f19b0dd83d38cddb28e9691c1da7e45bf /sql-common | |
parent | e2a3fdd1fe463a58a733726973d59d247ad8853e (diff) | |
download | mariadb-git-d25dd07363cbe54d813c2d9cd9cc16ff32e9bde4.tar.gz |
Fixed error found by valgrind in numerical date handling
Fixed comments to say MYSQL_TIME instead of old typedef TIME
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/my_time.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 4aad97f8249..08c3c0f8adc 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -456,7 +456,7 @@ err: /* - Convert a time string to a TIME struct. + Convert a time string to a MYSQL_TIME struct. SYNOPSIS str_to_time() @@ -642,11 +642,11 @@ fractional: l_time->second_part= date[4]; l_time->time_type= MYSQL_TIMESTAMP_TIME; - /* Check if the value is valid and fits into TIME range */ + /* Check if the value is valid and fits into MYSQL_TIME range */ if (check_time_range(l_time, warning)) return 1; - /* Check if there is garbage at end of the TIME specification */ + /* Check if there is garbage at end of the MYSQL_TIME specification */ if (str != end) { do @@ -663,11 +663,11 @@ fractional: /* - Check 'time' value to lie in the TIME range + Check 'time' value to lie in the MYSQL_TIME range SYNOPSIS: check_time_range() - time pointer to TIME value + time pointer to MYSQL_TIME value warning set MYSQL_TIME_WARN_OUT_OF_RANGE flag if the value is out of range DESCRIPTION @@ -1008,7 +1008,7 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type) /* Functions to convert time/date/datetime value to a string, using default format. - This functions don't check that given TIME structure members are + This functions don't check that given MYSQL_TIME structure members are in valid range. If they are not, return value won't reflect any valid date either. Additionally, make_time doesn't take into account time->day member: it's assumed that days have been converted @@ -1094,7 +1094,7 @@ int my_TIME_to_str(const MYSQL_TIME *l_time, char *to) DESCRIPTION Convert a datetime value of formats YYMMDD, YYYYMMDD, YYMMDDHHMSS, - YYYYMMDDHHMMSS to broken-down TIME representation. Return value in + YYYYMMDDHHMMSS to broken-down MYSQL_TIME representation. Return value in YYYYMMDDHHMMSS format as side-effect. This function also checks if datetime value fits in DATETIME range. @@ -1150,6 +1150,7 @@ longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res, ok: part1=(long) (nr/LL(1000000)); part2=(long) (nr - (longlong) part1*LL(1000000)); + time_res->neg= 0; time_res->year= (int) (part1/10000L); part1%=10000L; time_res->month= (int) part1 / 100; time_res->day= (int) part1 % 100; @@ -1186,7 +1187,7 @@ ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time) } -/* Convert TIME value to integer in YYYYMMDD format */ +/* Convert MYSQL_TIME value to integer in YYYYMMDD format */ ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time) { @@ -1196,7 +1197,7 @@ ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *my_time) /* - Convert TIME value to integer in HHMMSS format. + Convert MYSQL_TIME value to integer in HHMMSS format. This function doesn't take into account time->day member: it's assumed that days have been converted to hours already. */ @@ -1210,7 +1211,7 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time) /* - Convert struct TIME (date and time split into year/month/day/hour/... + Convert struct MYSQL_TIME (date and time split into year/month/day/hour/... to a number in format YYYYMMDDHHMMSS (DATETIME), YYYYMMDD (DATE) or HHMMSS (TIME). @@ -1224,7 +1225,7 @@ ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *my_time) SELECT ?+1; NOTE - This function doesn't check that given TIME structure members are + This function doesn't check that given MYSQL_TIME structure members are in valid range. If they are not, return value won't reflect any valid date either. */ |