FS#9487 - calendar plugin fix

Attached to Project: Rockbox
Opened by Teruaki Kawashima (teru) - Monday, 13 October 2008, 13:45 GMT
Last edited by Nils Wallménius (nls) - Friday, 24 October 2008, 08:41 GMT
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Operating System Archos Recorder
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


this patch fixes these bugs.
1. curosr disappears when move to January from Dec.
curosr indicates 32, 33...
2. it shows empty memo when you select monday after memo is add.
this is because memos_in_memory is incremented improperly after memos are loaded.
3. weekly memos are also shown monthly.
e.g. add weekly memo to 1st September at first.
then, select 1st Octember, and it will show the memo you added to 1 September.

and I made some changes.
1. modify function save_memo to rename '~temp' to '.memo' instead of copying content.
2. look after array size.
3. modify some indent.
This task depends upon

Closed by  Nils Wallménius (nls)
Friday, 24 October 2008, 08:41 GMT
Reason for closing:  Accepted
Additional comments about closing:  committed, thanks!
Comment by Nils Wallménius (nls) - Monday, 20 October 2008, 20:32 GMT
Looks nice but we need your Real Name (tm) for the credits to commit this.
Also why is it necessary to have 13 months in the days_in_month array?
Comment by Teruaki Kawashima (teru) - Tuesday, 21 October 2008, 08:35 GMT
Maybe it is not necessary.
I just used days_in_month[][0] because it is not used.
days_in_month is used in the next_month to decrease shown->mday.
And it cause the curosr disappearance bug that shown->mday is not decreased propery.
to decrease shown->mday propery, i made change below

@@ -612,7 +610,7 @@
leap_year = is_leap_year(shown->year);
- else if (step > 0)
+ if (step > 0)
shown->mday = shown->mday - days_in_month[leap_year][shown->mon-1];
else if (shown->mday > days_in_month[leap_year][shown->mon])
shown->mday = days_in_month[leap_year][shown->mon];

and set 31 to days_in_month[][0] for the case shown->mon is 1.
I thought this is natural fix...

Another way is maybe like this.

@@ -612,4 +610,5 @@
leap_year = is_leap_year(shown->year);
+ if (step > 0) shown->mday -= 31;
else if (step > 0)

And my real name is "Teruaki Kawashima".