Ticket #5693: programs_mythfilldatabase-uninit.patch

File programs_mythfilldatabase-uninit.patch, 1.1 KB (added by Erik Hovland <erik@…>, 12 years ago)

init some more struct member vars in toTime_t

  • mythtv/programs/mythfilldatabase/filldata.cpp

    Defects where a variable might be used uninitialized.
    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     mythtv/programs/mythfilldatabase/filldata.cpp |    8 ++++++++
     1 files changed, 8 insertions(+), 0 deletions(-)
    
    diff --git a/mythtv/programs/mythfilldatabase/filldata.cpp b/mythtv/programs/mythfilldatabase/filldata.cpp
    index 638a2b7..3795c74 100644
    a b time_t toTime_t(QDateTime &dt) 
    308308    brokenDown.tm_mday = dt.date().day();
    309309    brokenDown.tm_mon = dt.date().month() - 1;
    310310    brokenDown.tm_year = dt.date().year() - 1900;
     311    brokenDown.tm_wday = dt.date().dayOfWeek() - 1;
     312    brokenDown.tm_yday = dt.date().dayOfYear() - 1;
    311313    brokenDown.tm_isdst = -1;
     314#if defined(__GLIBC__)
     315    // glibc has a couple of extra additional fields
     316    ::tzset();
     317    brokenDown.tm_gmtoff = -::timezone;
     318    brokenDown.tm_zone = ::tzname[0];
     319#endif
    312320    int secsSince1Jan1970UTC = (int) mktime( &brokenDown );
    313321    if ( secsSince1Jan1970UTC < -1 )
    314322        secsSince1Jan1970UTC = -1;