Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: hcl: apps database.c, 1.5, 1.6 database.h, 1.4, 1.5 main.c

Re: hcl: apps database.c, 1.5, 1.6 database.h, 1.4, 1.5 main.c

From: Daniel Stenberg <daniel_at_rockbox.org>
Date: Fri, 1 Jul 2005 20:50:22 +0200 (CEST)

On Fri, 1 Jul 2005, cvs_at_labb.contactor.se wrote:

Nice work, HCl!

Is there some docs/notes anywhere on how to get going with this runtime db?

And some nits on the code:

> +void writetagdbheader(void) {

We normally put the brace in the first column on the next line when we write
functions in Rockbox.

> tagdb_shiftdown(FILERECORD2OFFSET(currentferecord),FILERECORD2OFFSET(restrecord),(tagdbheader.filecount-restrecord)*FILEENTRY_SIZE);

We write code that is less than 80 columns wide.

> + &rundbheader,
> + &rundb_fd,
> + &rundb_initialized,
> strncmp,

Always append new functions last in the struct. That way we don't break
existing plugins.

--- edittoken.h 27 Jun 2005 22:43:11 -0000 1.4
+++ edittoken.h 1 Jul 2005 17:29:44 -0000 1.5
_at__at_ -88,7 +88,7 _at__at_

  struct token {
      char kind;
- char spelling[SPELLING_LENGTH + 1];
+ char spelling[SPELLING_LENGTH + 3];
      long intvalue;
  };

Why the +3 ? AFAIU, the code fills in SPELLING_LENGTH bytes there and I
understand 1 extra for a terminating zero.

Could you perhaps add a comment explaining the 3?

[token.h]
  struct token {
- unsigned char kind;
- char spelling[255]; // 255 should make it aligned again..
- long intvalue;
+ char kind;
+ char spelling[SPELLING_LENGTH + 3];
+ long intvalue;
  };

This is the same struct declared again. Isn't it nicer to have it in just one
header file?

-- 
  Daniel Stenberg -- http://www.rockbox.org/ -- http://daniel.haxx.se/
_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox
Received on 2005-07-01

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy