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

View File

@ -88,9 +88,9 @@ uint32_t _err_get_threadid(void) {
tid = pthread_self();
if(sizeof(pthread_t) == sizeof(int)) {
thread_id = (int)tid;
thread_id = (int)tid;
} 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;
@ -338,7 +338,7 @@ extern int err_setdebugmask(char *list) {
}
if(!err_categorylist[index]) {
_err_unlock();
_err_unlock();
DPRINTF(E_LOG,L_MISC,"Unknown module: %s\n",token);
free(tmpstr);
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",
song_count,end_time-start_time);
song_count,end_time-start_time);
if(conf_get_int("general","rescan_interval",0))
config.reload = 1; /* force a reload on start */

View File

@ -221,7 +221,7 @@ int _os_sock_to_fd(SOCKET sock) {
if(fd == MAXDESC) {
_os_unlock();
_os_phandle_dump();
_os_phandle_dump();
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;
} else {
if(pe) *pe = strdup("Unsupported browse type");
if(pqi->pt)
sp_dispose(pqi->pt);
if(pqi->pt)
sp_dispose(pqi->pt);
pqi->pt = NULL;
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);
}
/* cleanup what's left */
MAYBEFREE(mp3.title);
MAYBEFREE(mp3.artist);
MAYBEFREE(mp3.album);
MAYBEFREE(mp3.genre);
MAYBEFREE(mp3.comment);
MAYBEFREE(song_path);
memset((void*)&mp3,0,sizeof(MP3FILE));
/* cleanup what's left */
MAYBEFREE(mp3.title);
MAYBEFREE(mp3.artist);
MAYBEFREE(mp3.album);
MAYBEFREE(mp3.genre);
MAYBEFREE(mp3.comment);
MAYBEFREE(song_path);
memset((void*)&mp3,0,sizeof(MP3FILE));
} else {
return XML_STATE_ERROR;
}

View File

@ -2,4 +2,4 @@
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;
while(len--) {
hash = ((hash << 5) + hash) + *pstr;
pstr++;
hash = ((hash << 5) + hash) + *pstr;
pstr++;
}
return hash;
}

View File

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