FS#10087 - Improvements to rocklife: file loading; code readability

Attached to Project: Rockbox
Opened by Alexander Levin (fml2) - Wednesday, 01 April 2009, 21:52 GMT
Last edited by Alexander Levin (fml2) - Friday, 03 April 2009, 20:26 GMT
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Version 3.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The patch does the following:

1. Reading of the file is now done char by char. This makes it not dangerous if the file is big
2. Code readability is improved via introducing of get_cell
3. Slight speed improvement in calculating the next generation (n[4] is taken from the previous generation)
4. A first step is made in decoupling of the grid size from the LCD size
This task depends upon

Closed by  Alexander Levin (fml2)
Friday, 03 April 2009, 20:26 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed in r20610
Comment by Thomas Martitz (kugel.) - Wednesday, 01 April 2009, 22:17 GMT
char is unsigned by default on ARM, so checking buf <= 0 (implicating signed) might be problematic. Shouldn't it be checking for EOF anyway?
Comment by Justin Hannigan (Chronon) - Thursday, 02 April 2009, 17:53 GMT
Yes, that sounds right. I am trying to teach myself C on-the-fly, so please make whatever changes seem appropriate and I will learn by example.
Comment by Alexander Levin (fml2) - Thursday, 02 April 2009, 21:24 GMT
@kugel: read returns the number of bytes read, or 0 on EOF, or a negative value on error. The return value is stored in an int and then tested. Where do you see a problem?
Comment by Alexander Levin (fml2) - Thursday, 02 April 2009, 21:56 GMT
Sync to r20608