Mercurial > hg > xmms-sid
comparison src/xs_length.c @ 24:271be59be975
Lots of changes
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 07 Jun 2003 12:42:05 +0000 |
parents | ac2972a7ccd5 |
children | 85a7753e2a9a |
comparison
equal
deleted
inserted
replaced
23:469efc05e01e | 24:271be59be975 |
---|---|
113 iQNode = (iEndNode / 2); | 113 iQNode = (iEndNode / 2); |
114 iFound = 0; | 114 iFound = 0; |
115 | 115 |
116 while ((!iFound) && ((iEndNode - iStartNode) > 128)) | 116 while ((!iFound) && ((iEndNode - iStartNode) > 128)) |
117 { | 117 { |
118 fprintf(stderr, "["); | |
119 fprinth(stderr, xs_dbindex[iQNode]->md5Hash); | |
120 r = xs_db_cmphash(pHash, xs_dbindex[iQNode]->md5Hash); | 118 r = xs_db_cmphash(pHash, xs_dbindex[iQNode]->md5Hash); |
121 fprintf(stderr, "] = %i\n", r); | |
122 if (r < 0) | 119 if (r < 0) |
123 { | 120 { |
124 /* Hash was in the <- LEFT side */ | 121 /* Hash was in the <- LEFT side */ |
125 iEndNode = iQNode; | 122 iEndNode = iQNode; |
126 iQNode = iStartNode + ((iEndNode - iStartNode) / 2); | 123 iQNode = iStartNode + ((iEndNode - iStartNode) / 2); |
205 * Read database to memory | 202 * Read database to memory |
206 */ | 203 */ |
207 gint xs_db_read(gchar *dbFilename, t_xs_dbentry **dataBase) | 204 gint xs_db_read(gchar *dbFilename, t_xs_dbentry **dataBase) |
208 { | 205 { |
209 FILE *inFile; | 206 FILE *inFile; |
210 gchar inLine[XMMS_SID_BUFSIZE]; | 207 gchar inLine[XS_BUFSIZE]; |
211 gint lineNum, linePos, iOK; | 208 gint lineNum, linePos, iOK; |
212 t_xs_dbentry *tmpNode; | 209 t_xs_dbentry *tmpNode; |
213 | 210 |
214 /* Try to open the file */ | 211 /* Try to open the file */ |
215 if ((inFile = fopen(dbFilename, "ra")) == NULL) | 212 if ((inFile = fopen(dbFilename, "ra")) == NULL) |
556 | 553 |
557 | 554 |
558 /* | 555 /* |
559 * Get song length | 556 * Get song length |
560 */ | 557 */ |
561 gint32 xs_get_songlength(gchar *fileName, gint subTune) | 558 gint32 xs_songlen_get(gchar *fileName, gint subTune) |
562 { | 559 { |
563 t_xs_dbentry *dbEntry; | 560 t_xs_dbentry *dbEntry; |
564 t_xs_md5hash dbHash; | 561 t_xs_md5hash dbHash; |
565 gint32 iResult; | 562 gint32 iResult; |
566 | 563 |
570 | 567 |
571 case XMMS_SID_PMETHOD_DATABASE: | 568 case XMMS_SID_PMETHOD_DATABASE: |
572 /* Get the hash and then look up from db */ | 569 /* Get the hash and then look up from db */ |
573 if (xs_get_sid_hash(fileName, dbHash) == 0) | 570 if (xs_get_sid_hash(fileName, dbHash) == 0) |
574 { | 571 { |
575 fprinth(stderr, dbHash); | |
576 fprintf(stderr, "\n"); | |
577 dbEntry = xs_db_get(dbHash); | 572 dbEntry = xs_db_get(dbHash); |
578 | 573 |
579 if (dbEntry) | 574 if (dbEntry) |
580 { | 575 { |
581 if ((subTune >= 0) && (subTune < dbEntry->nLengths)) | 576 if ((subTune >= 0) && (subTune < dbEntry->nLengths)) |