So, looking at the properties code, I'm not sure I know the whole story,
but it looks like traditionally the props.count would hold one more than
the number of properties stored. I can't quite puzzle out why exactly,
esp. since we start with props.count=0. So, I just went ahead and made
props.count store exactly the number of songs everywhere.
Please review and test, and if you know that this patch is absolutely
wrong, feel free to explain how it is supposed to work :)
# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1168732064 18000
# Node ID bee08234de15faa60b34512ccacef4fa03718ff5
# Parent 2cc655062ebfd05f6efa20e684571f3a1bc2384a
More counting errors, I think
diff -r 2cc655062ebf -r bee08234de15 src/properties.c
--- a/src/properties.c Fri Jan 12 08:22:39 2007 -0500
+++ b/src/properties.c Sat Jan 13 18:47:44 2007 -0500
@@ -344,7 +344,7 @@ int lk_properties_save(void)
return -1;
}
- for(i=0,j=16; i<=props.count-1; j++) {
+ for(i=0,j=16; i<props.count; j++) {
if(props.fidTable[j]){
buf=lk_properties_export(j*16);
write(fd, buf, strlen(buf));
@@ -424,7 +424,7 @@ uint32_t *lk_properties_andOrSearch(int
if(and) /* AND merge with zero elements */
return NULL;
hash=hash_string((const unsigned char *)key, HASHSIZE);
- while(count <= props.count){
+ while(count < props.count){
if(props.fidTable[fid]){
++count;
val = (char *)hash_find_hash(props.fidTable[fid], hash, key);
@@ -455,7 +455,7 @@ uint32_t *lk_properties_andOrSearch(int
memcpy(result, search_in, (i) * sizeof(uint32_t));
hash=hash_string((const unsigned char *)key, HASHSIZE);
- while(count <= props.count){
+ while(count < props.count){
if(props.fidTable[fid]){
++count;
val=(char *)hash_find_hash(props.fidTable[fid], hash, key);
@@ -695,7 +695,7 @@ static int smalldb_init(karma_db_t *db)
int lk_properties_write_smalldb(char *usbMountPoint, karma_db_t *db)
{
- uint32_t i, len, arrsz, nfiles = props.count-1;
+ uint32_t i, len, arrsz, nfiles = props.count;
uint32_t ret = 0;
uint32_t *offset = NULL;
table_t *table = NULL;
--
Bob Copeland %% www.bobcopeland.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-karma-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-karma-devel