Commit d25dd073 authored by unknown's avatar unknown
Browse files

Fixed error found by valgrind in numerical date handling

Fixed comments to say MYSQL_TIME instead of old typedef TIME

parent e2a3fdd1
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,


/*
 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 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
  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 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,


/*
  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.
*/