diff options
author | unknown <monty@narttu.mysql.fi> | 2003-11-04 14:09:03 +0200 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-11-04 14:09:03 +0200 |
commit | 0712ce9ec5d3b84acfcb33ebe8b653ed6e0f084c (patch) | |
tree | 07ce6a4f792ac489b079759afb3cc65847ca0cb0 /sql/time.cc | |
parent | f97f48acaf26aebc3f79de34b21607e11e1b91fa (diff) | |
download | mariadb-git-0712ce9ec5d3b84acfcb33ebe8b653ed6e0f084c.tar.gz |
Removed some warnings reported by valgrind
After merge fixes.
Now code compiles, but there is still some valgrind warnings that needs to be fixed
myisam/mi_rnext_same.c:
handle case where rtree_find_next() returns an error
(assume this means that there was no more keys)
myisam/rt_index.c:
Code cleanup
mysql-test/r/func_crypt.result:
Update results
mysql-test/r/func_group.result:
Update results
mysql-test/r/null_key.result:
Update results
mysql-test/r/order_by.result:
Update results
mysql-test/r/query_cache.result:
Update results
mysql-test/r/range.result:
Update results
mysql-test/r/rpl_trunc_binlog.result:
Update results
mysql-test/t/fulltext.test:
Fix error numbers
mysql-test/t/func_crypt.test:
Fixed test for 4.1
mysql-test/t/range.test:
Moved tests to be in sync with 4.0
mysys/test_charset.c:
Removed acccess to non existing functions
sql-common/client.c:
Merge fix
sql/item_strfunc.cc:
Simple code cleanup
Don't call ->c_ptr() when you don't need a 0 terminated string
(Causes warnings from valgrind)
sql/log_event.cc:
After merge fixes
sql/protocol.cc:
Change default catalog name to 'def'
sql/spatial.cc:
Code cleanup
sql/sql_class.cc:
After merge fixes
sql/time.cc:
Ensure that time object is cleared on error
sql/unireg.cc:
Removed warning reported by valgrind
Diffstat (limited to 'sql/time.cc')
-rw-r--r-- | sql/time.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/time.cc b/sql/time.cc index 4f2a2a23910..3fa00fc683b 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -335,10 +335,12 @@ static char time_separator=':'; RETURN VALUES TIMESTAMP_NONE String wasn't a timestamp, like - [DD [HH:[MM:[SS]]]].fraction + [DD [HH:[MM:[SS]]]].fraction. + l_time is not changed. TIMESTAMP_DATE DATE string (YY MM and DD parts ok) - TIMESTAMP_DATETIME Full timestamp - TIMESTAMP_DATETIME_ERROR Timestamp with wrong values + TIMESTAMP_DATETIME Full timestamp + TIMESTAMP_DATETIME_ERROR Timestamp with wrong values. + All elements in l_time is set to 0 */ #define MAX_DATE_PARTS 8 @@ -409,9 +411,9 @@ str_to_TIME(const char *str, uint length, TIME *l_time, uint flags) if (pos == end) { if (flags & TIME_DATETIME_ONLY) - return TIMESTAMP_NONE; // Can't be a full datetime + DBUG_RETURN(TIMESTAMP_NONE); // Can't be a full datetime /* Date field. Set hour, minutes and seconds to 0 */ - date[0]= date[1]= date[2]= date[3]= 0; + date[0]= date[1]= date[2]= date[3]= date[4]= 0; start_loop= 5; // Start with first date part } } @@ -535,7 +537,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time, uint flags) if (format_position[7] != (uchar) 255) { if (l_time->hour > 12) - DBUG_RETURN(TIMESTAMP_DATETIME_ERROR); + goto err; l_time->hour= l_time->hour%12 + add_hours; } } @@ -574,7 +576,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time, uint flags) } if (not_zero_date) current_thd->cuted_fields++; - DBUG_RETURN(TIMESTAMP_DATETIME_ERROR); + goto err; } if (str != end && current_thd->count_cuted_fields) { @@ -590,6 +592,10 @@ str_to_TIME(const char *str, uint length, TIME *l_time, uint flags) DBUG_RETURN(l_time->time_type= (number_of_fields <= 3 ? TIMESTAMP_DATE : TIMESTAMP_DATETIME)); + +err: + bzero((char*) l_time, sizeof(*l_time)); + DBUG_RETURN(TIMESTAMP_DATETIME_ERROR); } |