Kouhei Sutou
null+****@clear*****
Wed Oct 24 23:30:17 JST 2012
Kouhei Sutou 2012-10-24 23:30:17 +0900 (Wed, 24 Oct 2012) New Revision: 502181f03f3f97f87d69a474291367a3097d81af https://github.com/mroonga/mroonga/commit/502181f03f3f97f87d69a474291367a3097d81af Log: Compute overflow check value before overflowed Modified files: ha_mroonga.cpp Modified: ha_mroonga.cpp (+3 -2) =================================================================== --- ha_mroonga.cpp 2012-10-24 23:26:40 +0900 (0eef48f) +++ ha_mroonga.cpp 2012-10-24 23:30:17 +0900 (1d0edc0) @@ -1507,11 +1507,12 @@ static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf, static long long int mrn_tm_to_grn_time(struct tm *time, int usec) { MRN_DBUG_ENTER_FUNCTION(); + bool before_epoch_time = + (time->tm_year >= (UNIX_EPOCH_TIME_YEAR - TM_YEAR_BASE)); long long int grn_time; long long int sec = mktime(time); bool failed = (sec == -1); - bool overflowed = (time->tm_year >= (UNIX_EPOCH_TIME_YEAR - TM_YEAR_BASE) && - sec < 0); + bool overflowed = (before_epoch_time && sec < 0); if (failed || overflowed) { grn_time = 0; } else { -------------- next part -------------- HTML����������������������������...Download