diff --git a/include/date.cpp b/include/date.cpp index 951eb57d1..15e94be8e 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -27,14 +27,14 @@ TDate::TDate(long l) : _val(l) { if (_val == TODAY) { + _val = NULLDATE; time_t lt; - if (time(<) == -1) - return; - struct tm * timeloc = localtime(<); - if (timeloc != NULL) - _val = makedata(timeloc->tm_mday, timeloc->tm_mon+1, timeloc->tm_year + 1900); - else - _val = NULLDATE; + if (time(<) != -1) + { + struct tm * timeloc = localtime(<); + if (timeloc != NULL) + _val = makedata(timeloc->tm_mday, timeloc->tm_mon+1, timeloc->tm_year + 1900); + } } else { @@ -102,7 +102,7 @@ TDate::TDate(const char* s) } #ifdef DBG - if (d < 1 || d > 31 || m < 1 || m > 12 && y < 0) + if (d < 1 || d > 31 || m < 1 || m > 12 || y < 0) yesnofatal_box("Lamentati con Guy se la data %s non viene accettata!", s); #endif _val = makedata(d, m, y); @@ -190,17 +190,9 @@ TDate& TDate::operator =(const char* s) TDate& TDate::operator =(long val) { if (val < 0L) - { - long lt; - val = 0L; - if (time(<) != -1) - { - struct tm *timeloc = localtime(<); - if (timeloc != NULL) - val = makedata(timeloc->tm_mday, timeloc->tm_mon+1, timeloc->tm_year + 1900); - } - } - _val = val; + *this = TDate(val); + else + _val = val; return *this; } diff --git a/include/msksheet.cpp b/include/msksheet.cpp index dc761f71f..926073268 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -53,7 +53,8 @@ public: }; TRow_property::TRow_property() - : _back(NORMAL_BACK_COLOR), _fore(NORMAL_COLOR), _cell_prop(NULL) + // : _back(NORMAL_BACK_COLOR), _fore(NORMAL_COLOR), _cell_prop(NULL) + : _back(0), _fore(0), _cell_prop(NULL) { } @@ -92,7 +93,7 @@ void TRow_property::get(int col, COLOR & back, COLOR & fore) const { if (col > 0) { - if (!_cell_prop) + if (_cell_prop == NULL) { back = _back; fore = _fore; @@ -1986,7 +1987,7 @@ void TSpreadsheet::set_back_and_fore_color(COLOR back, COLOR fore, int row, int void TSpreadsheet::get_back_and_fore_color(COLOR& back, COLOR& fore, int row, int col) { TRow_property* prop = get_property(row, FALSE); - if (prop) + if (prop != NULL) prop->get(col, back, fore); }