Ticket #15198: 0001-removes-1970-and-2037-date-check-in-ui-for-x86-arch.patch

File 0001-removes-1970-and-2037-date-check-in-ui-for-x86-arch.patch, 2.0 KB (added by nephele, 2 years ago)
  • src/preferences/time/BaseView.cpp

    From 677793bf8ce6bb4fa9b89dbfdbe9917f9c20b54f Mon Sep 17 00:00:00 2001
    From: Pascal Abresch <nep@packageloss.eu>
    Date: Tue, 23 Jul 2019 00:11:39 +0200
    Subject: [PATCH] removes 1970 and 2037 date check in ui for !x86 arch
    
    ---
     src/preferences/time/BaseView.cpp     |  7 ++++++-
     src/preferences/time/DateTimeEdit.cpp | 18 ++++++++++++------
     2 files changed, 18 insertions(+), 7 deletions(-)
    
    diff --git a/src/preferences/time/BaseView.cpp b/src/preferences/time/BaseView.cpp
    index 3e096a3045..b38ce4bd26 100644
    a b TTimeBaseView::ChangeTime(BMessage* message)  
    8585        if (message->FindInt32("month", &month) != B_OK)
    8686            month = date.Month();
    8787
    88         if (year >= 1970 && year <= 2037) {
     88        if (sizeof(time_t) == 4) {
     89            if (year >= 1970 && year <= 2037) {
     90                date.SetDate(year, month, day);
     91                dateTime.SetDate(date);
     92            }
     93        } else {
    8994            date.SetDate(year, month, day);
    9095            dateTime.SetDate(date);
    9196        }
  • src/preferences/time/DateTimeEdit.cpp

    diff --git a/src/preferences/time/DateTimeEdit.cpp b/src/preferences/time/DateTimeEdit.cpp
    index 24fb1c4d2f..b7e655594c 100644
    a b TDateEdit::_CheckRange()  
    670670
    671671        case B_DATE_ELEMENT_YEAR:
    672672            // 2037 is the end of 32-bit UNIX time
    673             if (value > 2037)
    674                 value = 2037;
    675             else if (value < 1970)
    676                 value = 1970;
    677 
     673            // this check should compile this in on x86
     674            if (sizeof(time_t) == 4) {
     675                if (value > 2037)
     676                    value = 2037;
     677                else if (value < 1970)
     678                    value = 1970;
     679            }
    678680            fDate.SetDate(value, fDate.Month(), fDate.Day());
    679681            break;
    680682
    TDateEdit::_IsValidDoubleDigit(int32 value)  
    713715        case B_DATE_ELEMENT_YEAR:
    714716        {
    715717            int32 year = int32(fHoldValue / 100) * 100 + value;
    716             if (year <= 2037 && year >= 1970)
     718
     719            if (sizeof(time_t) == 4) {
     720                if (year <= 2037 && year >= 1970)
     721                    isInRange = true;
     722            } else
    717723                isInRange = true;
    718724            break;
    719725        }