From 5fb71694fe87e784a5985d790e3daac549cf40ad Mon Sep 17 00:00:00 2001 From: villa Date: Fri, 3 Nov 1995 11:40:09 +0000 Subject: [PATCH] Check in date.cpp Errore update in msksheet git-svn-id: svn://10.65.10.50/trunk@2082 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/date.cpp | 12 ++++++++++-- include/msksheet.cpp | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/date.cpp b/include/date.cpp index 0950f6801..754c53f78 100755 --- a/include/date.cpp +++ b/include/date.cpp @@ -191,8 +191,16 @@ int TDate::wday() const return ((d + 2*m + 3*(m+1)/5 + y + y/4 - y/100 + y/400) % 7) + 1; // Pure magic } -void TDate::set_day(int n) { _val = makedata(n, month(), year()); } -void TDate::set_month(int n) { _val = makedata(day(), n, year()); } +void TDate::set_day(int n) +{ + CHECK(n > 0 && n < 32, "TDate::set_day: giorno insensato"); + _val = makedata(n, month(), year()); +} +void TDate::set_month(int n) +{ + CHECK(n > 0 && n < 13, "TDate::set_month: mese impossibile"); + _val = makedata(day(), n, year()); +} void TDate::set_year(int n) { _val = makedata(day(), month(), n); } TDate::operator const char*() const diff --git a/include/msksheet.cpp b/include/msksheet.cpp index fdefd5cf3..c873c591a 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -1335,7 +1335,8 @@ void TSpreadsheet::on_idle() { if (_needs_update >= 0) { - update_rec(_needs_update); + if (_needs_update < items()) + update_rec(_needs_update); _needs_update = -1; } }