summaryrefslogtreecommitdiff
path: root/apps/plugins/searchengine/dbinterface.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/searchengine/dbinterface.c')
-rw-r--r--apps/plugins/searchengine/dbinterface.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/apps/plugins/searchengine/dbinterface.c b/apps/plugins/searchengine/dbinterface.c
index c9bbc12c02..7cded01642 100644
--- a/apps/plugins/searchengine/dbinterface.c
+++ b/apps/plugins/searchengine/dbinterface.c
@@ -44,7 +44,7 @@ int database_init() {
44 p=(char *)entryarray; 44 p=(char *)entryarray;
45 // zero all entries. 45 // zero all entries.
46 for(i=0;i<sizeof(struct entry)*rb->tagdbheader->filecount;i++) 46 for(i=0;i<sizeof(struct entry)*rb->tagdbheader->filecount;i++)
47 *(p++)=0; 47 *(p++)=0;
48 if(*rb->tagdb_initialized!=1) { 48 if(*rb->tagdb_initialized!=1) {
49 if(!rb->tagdb_init()) { 49 if(!rb->tagdb_init()) {
50 // failed loading db 50 // failed loading db
@@ -55,21 +55,21 @@ int database_init() {
55} 55}
56 56
57long readlong(int fd) { 57long readlong(int fd) {
58 long num; 58 long num;
59 rb->read(fd,&num,4); 59 rb->read(fd,&num,4);
60#ifdef ROCKBOX_LITTLE_ENDIAN 60#ifdef ROCKBOX_LITTLE_ENDIAN
61 num=BE32(num); 61 num=BE32(num);
62#endif 62#endif
63 return num; 63 return num;
64} 64}
65 65
66short readshort(int fd) { 66short readshort(int fd) {
67 short num; 67 short num;
68 rb->read(fd,&num,2); 68 rb->read(fd,&num,2);
69#ifdef ROCKBOX_LITTLE_ENDIAN 69#ifdef ROCKBOX_LITTLE_ENDIAN
70 num=BE16(num); 70 num=BE16(num);
71#endif 71#endif
72 return num; 72 return num;
73} 73}
74 74
75 75
@@ -77,11 +77,11 @@ void loadentry(int filerecord) {
77 if(entryarray[filerecord].loadedfiledata==0) { 77 if(entryarray[filerecord].loadedfiledata==0) {
78 rb->lseek(*rb->tagdb_fd,FILERECORD2OFFSET(filerecord),SEEK_SET); 78 rb->lseek(*rb->tagdb_fd,FILERECORD2OFFSET(filerecord),SEEK_SET);
79 entryarray[filerecord].filename=(char *)my_malloc(rb->tagdbheader->filelen); 79 entryarray[filerecord].filename=(char *)my_malloc(rb->tagdbheader->filelen);
80 rb->read(*rb->tagdb_fd,entryarray[filerecord].filename,rb->tagdbheader->filelen); 80 rb->read(*rb->tagdb_fd,entryarray[filerecord].filename,rb->tagdbheader->filelen);
81 entryarray[filerecord].hash=readlong(*rb->tagdb_fd); 81 entryarray[filerecord].hash=readlong(*rb->tagdb_fd);
82 entryarray[filerecord].songentry=readlong(*rb->tagdb_fd); 82 entryarray[filerecord].songentry=readlong(*rb->tagdb_fd);
83 entryarray[filerecord].rundbentry=readlong(*rb->tagdb_fd); 83 entryarray[filerecord].rundbentry=readlong(*rb->tagdb_fd);
84 entryarray[filerecord].loadedfiledata=1; 84 entryarray[filerecord].loadedfiledata=1;
85 } 85 }
86 currententry=&entryarray[filerecord]; 86 currententry=&entryarray[filerecord];
87} 87}
@@ -103,7 +103,7 @@ void loadsongdata() {
103} 103}
104 104
105void loadrundbdata() { 105void loadrundbdata() {
106 // we don't do this yet. 106 // we don't do this yet.
107 currententry->loadedrundbdata=1; 107 currententry->loadedrundbdata=1;
108} 108}
109 109
@@ -112,7 +112,7 @@ void loadartistname() {
112 * write that pointer to the entrys using it. 112 * write that pointer to the entrys using it.
113 */ 113 */
114 if(currententry->loadedartistname) 114 if(currententry->loadedartistname)
115 return; 115 return;
116 loadsongdata(); 116 loadsongdata();
117 currententry->artistname=(char *)my_malloc(rb->tagdbheader->artistlen); 117 currententry->artistname=(char *)my_malloc(rb->tagdbheader->artistlen);
118 rb->lseek(*rb->tagdb_fd,currententry->artistoffset,SEEK_SET); 118 rb->lseek(*rb->tagdb_fd,currententry->artistoffset,SEEK_SET);
@@ -123,7 +123,7 @@ void loadartistname() {
123void loadalbumname() { 123void loadalbumname() {
124 /* see the note at loadartistname */ 124 /* see the note at loadartistname */
125 if(currententry->loadedalbumname) 125 if(currententry->loadedalbumname)
126 return; 126 return;
127 loadsongdata(); 127 loadsongdata();
128 currententry->albumname=(char *)my_malloc(rb->tagdbheader->albumlen); 128 currententry->albumname=(char *)my_malloc(rb->tagdbheader->albumlen);
129 rb->lseek(*rb->tagdb_fd,currententry->albumoffset,SEEK_SET); 129 rb->lseek(*rb->tagdb_fd,currententry->albumoffset,SEEK_SET);
@@ -133,7 +133,7 @@ void loadalbumname() {
133 133
134char *getfilename(int entry) { 134char *getfilename(int entry) {
135 if(entryarray[entry].loadedfiledata==0) 135 if(entryarray[entry].loadedfiledata==0)
136 return "error O.o;;;"; 136 return "error O.o;;;";
137 else 137 else
138 return entryarray[entry].filename; 138 return entryarray[entry].filename;
139} 139}