From: Alexander Barkov Date: November 7 2011 6:01am Subject: bzr push into mysql-trunk branch (alexander.barkov:3548 to 3549) WL#946 List-Archive: http://lists.mysql.com/commits/141760 Message-Id: <201111070601.pA761D1t015564@bar.myoffice.izhnet.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3549 Alexander Barkov 2011-11-07 WL#946 Fixing crash on Windows on: DBUG_ASSERT(sizeof(time_t) == sizeof(when.tv_sec)); modified: sql/log_event.cc 3548 Alexander Barkov 2011-11-03 WL#946 clean-ups - Introducing new class MYSQL_TIME_cache. - minor other improvements modified: sql/field.cc sql/item_timefunc.cc sql/item_timefunc.h sql/sql_class.h sql/sql_time.cc sql/tztime.h === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2011-11-02 06:13:46 +0000 +++ b/sql/log_event.cc 2011-11-07 05:59:51 +0000 @@ -2365,23 +2365,19 @@ void Log_event::print_base64(IO_CACHE* f void Log_event::print_timestamp(IO_CACHE* file, time_t *ts) { struct tm *res; + /* + In some Windows versions timeval.tv_sec is defined as "long", + not as "time_t" and can be of a different size. + Let's use a temporary time_t variable to execute localtime() + with a correct argument type. + */ + time_t ts_tmp= ts ? *ts : when.tv_sec; DBUG_ENTER("Log_event::print_timestamp"); - if (!ts) - { - /* - In some Windows versions - timeval.tv_sec is defined as "long", not as "time_t". - Let's use explicit cast and make sure we don't cast - to a different integer size. - */ - DBUG_ASSERT(sizeof(time_t) == sizeof(when.tv_sec)); - ts= (time_t *) &when.tv_sec; - } #ifdef MYSQL_SERVER // This is always false struct tm tm_tmp; - localtime_r(ts,(res= &tm_tmp)); + localtime_r(&ts_tmp, (res= &tm_tmp)); #else - res=localtime(ts); + res= localtime(&ts_tmp); #endif my_b_printf(file,"%02d%02d%02d %2d:%02d:%02d", No bundle (reason: useless for push emails).