Fix tab expansion

This commit is contained in:
Ron Pedde 2006-07-12 22:52:50 +00:00
parent 0d4bd16789
commit b1a5f93987
9 changed files with 72 additions and 72 deletions

View File

@ -192,7 +192,7 @@ int db_sql_fetch_row(char **pe, SQL_ROW *row, char *fmt, ...) {
} }
if(!(*row)) { if(!(*row)) {
db_sql_need_dispose=0; db_sql_need_dispose=0;
db_sql_enum_end_fn(NULL); db_sql_enum_end_fn(NULL);
db_get_error(pe,DB_E_NOROWS); db_get_error(pe,DB_E_NOROWS);
return DB_E_NOROWS; return DB_E_NOROWS;
@ -1216,31 +1216,31 @@ int db_sql_enum_start(char **pe, DBQUERYINFO *pinfo) {
/* disable empty */ /* disable empty */
if(browse) { if(browse) {
if((have_clause) || (pinfo->pt)) { if((have_clause) || (pinfo->pt)) {
strcat(query_rest," and ("); strcat(query_rest," and (");
} else { } else {
strcpy(query_rest," where ("); strcpy(query_rest," where (");
have_clause = 1; have_clause = 1;
} }
switch(pinfo->query_type) { switch(pinfo->query_type) {
case queryTypeBrowseAlbums: case queryTypeBrowseAlbums:
strcat(query_rest,"album"); strcat(query_rest,"album");
break; break;
case queryTypeBrowseArtists: case queryTypeBrowseArtists:
strcat(query_rest,"artist"); strcat(query_rest,"artist");
break; break;
case queryTypeBrowseGenres: case queryTypeBrowseGenres:
strcat(query_rest,"genre"); strcat(query_rest,"genre");
break; break;
case queryTypeBrowseComposers: case queryTypeBrowseComposers:
strcat(query_rest,"composer"); strcat(query_rest,"composer");
break; break;
default: /* ?? */ default: /* ?? */
strcat(query_rest,"album"); strcat(query_rest,"album");
break; break;
} }
strcat(query_rest, " !='')"); strcat(query_rest, " !='')");
} }
if((pinfo->index_type != indexTypeNone) || (pinfo->want_count)) { if((pinfo->index_type != indexTypeNone) || (pinfo->want_count)) {

View File

@ -88,9 +88,9 @@ uint32_t _err_get_threadid(void) {
tid = pthread_self(); tid = pthread_self();
if(sizeof(pthread_t) == sizeof(int)) { if(sizeof(pthread_t) == sizeof(int)) {
thread_id = (int)tid; thread_id = (int)tid;
} else { } else {
thread_id = util_djb_hash_block((unsigned char *)&tid,sizeof(pthread_t)); thread_id = util_djb_hash_block((unsigned char *)&tid,sizeof(pthread_t));
} }
return thread_id; return thread_id;
@ -338,7 +338,7 @@ extern int err_setdebugmask(char *list) {
} }
if(!err_categorylist[index]) { if(!err_categorylist[index]) {
_err_unlock(); _err_unlock();
DPRINTF(E_LOG,L_MISC,"Unknown module: %s\n",token); DPRINTF(E_LOG,L_MISC,"Unknown module: %s\n",token);
free(tmpstr); free(tmpstr);
return 1; return 1;

View File

@ -485,7 +485,7 @@ int main(int argc, char *argv[]) {
} }
DPRINTF(E_LOG,L_MAIN,"Serving %d songs. Startup complete in %d seconds\n", DPRINTF(E_LOG,L_MAIN,"Serving %d songs. Startup complete in %d seconds\n",
song_count,end_time-start_time); song_count,end_time-start_time);
if(conf_get_int("general","rescan_interval",0)) if(conf_get_int("general","rescan_interval",0))
config.reload = 1; /* force a reload on start */ config.reload = 1; /* force a reload on start */

View File

@ -221,7 +221,7 @@ int _os_sock_to_fd(SOCKET sock) {
if(fd == MAXDESC) { if(fd == MAXDESC) {
_os_unlock(); _os_unlock();
_os_phandle_dump(); _os_phandle_dump();
DPRINTF(E_FATAL,L_MISC,"Out of pseudo file handles. See ya\n"); DPRINTF(E_FATAL,L_MISC,"Out of pseudo file handles. See ya\n");
} }

View File

@ -713,8 +713,8 @@ int pi_db_enum_start(char **pe, DB_QUERY *pinfo) {
pqi->query_type = queryTypeBrowseComposers; pqi->query_type = queryTypeBrowseComposers;
} else { } else {
if(pe) *pe = strdup("Unsupported browse type"); if(pe) *pe = strdup("Unsupported browse type");
if(pqi->pt) if(pqi->pt)
sp_dispose(pqi->pt); sp_dispose(pqi->pt);
pqi->pt = NULL; pqi->pt = NULL;
return -1; /* not really a db error for this */ return -1; /* not really a db error for this */
} }

View File

@ -758,14 +758,14 @@ int scan_xml_tracks_section(int action, char *info) {
db_dispose_item(pmp3); db_dispose_item(pmp3);
} }
/* cleanup what's left */ /* cleanup what's left */
MAYBEFREE(mp3.title); MAYBEFREE(mp3.title);
MAYBEFREE(mp3.artist); MAYBEFREE(mp3.artist);
MAYBEFREE(mp3.album); MAYBEFREE(mp3.album);
MAYBEFREE(mp3.genre); MAYBEFREE(mp3.genre);
MAYBEFREE(mp3.comment); MAYBEFREE(mp3.comment);
MAYBEFREE(song_path); MAYBEFREE(song_path);
memset((void*)&mp3,0,sizeof(MP3FILE)); memset((void*)&mp3,0,sizeof(MP3FILE));
} else { } else {
return XML_STATE_ERROR; return XML_STATE_ERROR;
} }

View File

@ -2,4 +2,4 @@
XX=' ' XX=' '
echo "Searching for ${XX}." echo "Searching for ${XX}."
egrep "${XX}" *.[ch] egrep -l "${XX}" *.[ch]

View File

@ -19,8 +19,8 @@ uint32_t util_djb_hash_block(unsigned char *data, uint32_t len) {
unsigned char *pstr = data; unsigned char *pstr = data;
while(len--) { while(len--) {
hash = ((hash << 5) + hash) + *pstr; hash = ((hash << 5) + hash) + *pstr;
pstr++; pstr++;
} }
return hash; return hash;
} }

View File

@ -367,8 +367,8 @@ void xml_handle(WS_CONNINFO *pwsc) {
} }
if(strcasecmp(method,"browse_path") == 0) { if(strcasecmp(method,"browse_path") == 0) {
xml_browse_path(pwsc); xml_browse_path(pwsc);
return; return;
} }
if(strcasecmp(method,"rescan") == 0) { if(strcasecmp(method,"rescan") == 0) {
@ -407,19 +407,19 @@ void xml_browse_path(WS_CONNINFO *pwsc) {
base_path = ws_getvar(pwsc, "path"); base_path = ws_getvar(pwsc, "path");
if(!base_path) if(!base_path)
base_path = PATHSEP_STR; base_path = PATHSEP_STR;
if(ws_getvar(pwsc,"show_dotfiles")) if(ws_getvar(pwsc,"show_dotfiles"))
ignore_dotfiles = 0; ignore_dotfiles = 0;
if(ws_getvar(pwsc,"show_files")) if(ws_getvar(pwsc,"show_files"))
ignore_files = 0; ignore_files = 0;
pd = opendir(base_path); pd = opendir(base_path);
if(!pd) { if(!pd) {
xml_return_error(pwsc,500,"Bad path"); xml_return_error(pwsc,500,"Bad path");
return; return;
} }
pxml=xml_init(pwsc,1); pxml=xml_init(pwsc,1);
@ -427,35 +427,35 @@ void xml_browse_path(WS_CONNINFO *pwsc) {
/* get rid of trailing slash */ /* get rid of trailing slash */
while(1) { while(1) {
pde = (struct dirent *)&de; pde = (struct dirent *)&de;
err = readdir_r(pd,(struct dirent *)de, &pde); err = readdir_r(pd,(struct dirent *)de, &pde);
if(err == -1) { if(err == -1) {
DPRINTF(E_LOG,L_SCAN,"Error in readdir_r: %s\n", DPRINTF(E_LOG,L_SCAN,"Error in readdir_r: %s\n",
strerror(errno)); strerror(errno));
break; break;
} }
if(!pde) if(!pde)
break; break;
if((!strcmp(pde->d_name,".")) || (!strcmp(pde->d_name,".."))) if((!strcmp(pde->d_name,".")) || (!strcmp(pde->d_name,"..")))
continue; continue;
if((pde->d_type & DT_REG) && (ignore_files)) if((pde->d_type & DT_REG) && (ignore_files))
continue; continue;
if((!(pde->d_type & DT_DIR)) && if((!(pde->d_type & DT_DIR)) &&
(!(pde->d_type & DT_REG))) (!(pde->d_type & DT_REG)))
continue; continue;
if((ignore_dotfiles) && (pde->d_name) && (pde->d_name[0] == '.')) if((ignore_dotfiles) && (pde->d_name) && (pde->d_name[0] == '.'))
continue; continue;
snprintf(full_path,PATH_MAX,"%s%c%s",base_path,PATHSEP,pde->d_name); snprintf(full_path,PATH_MAX,"%s%c%s",base_path,PATHSEP,pde->d_name);
realpath(full_path,resolved_path); realpath(full_path,resolved_path);
readable = !access(resolved_path,R_OK); readable = !access(resolved_path,R_OK);
writable = !access(resolved_path,W_OK); writable = !access(resolved_path,W_OK);
if(pde->d_type & DT_DIR) { if(pde->d_type & DT_DIR) {
xml_push(pxml,"directory"); xml_push(pxml,"directory");
@ -464,12 +464,12 @@ void xml_browse_path(WS_CONNINFO *pwsc) {
} else { } else {
xml_push(pxml,"file"); xml_push(pxml,"file");
} }
xml_output(pxml,"name",pde->d_name); xml_output(pxml,"name",pde->d_name);
xml_output(pxml,"full_path",resolved_path); xml_output(pxml,"full_path",resolved_path);
xml_output(pxml,"readable","%d",readable); xml_output(pxml,"readable","%d",readable);
xml_output(pxml,"writable","%d",writable); xml_output(pxml,"writable","%d",writable);
xml_pop(pxml); /* directory */ xml_pop(pxml); /* directory */
} }