From b1a5f93987adc074f3b11fa6d67755e953fbd6ef Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Wed, 12 Jul 2006 22:52:50 +0000 Subject: [PATCH] Fix tab expansion --- src/db-sql.c | 48 ++++++++++++++++++++-------------------- src/err.c | 6 ++--- src/main.c | 2 +- src/os-win32.c | 2 +- src/plugin.c | 4 ++-- src/scan-xml.c | 16 +++++++------- src/tabs.sh | 2 +- src/util.c | 4 ++-- src/xml-rpc.c | 60 +++++++++++++++++++++++++------------------------- 9 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/db-sql.c b/src/db-sql.c index 134b27aa..b806b81f 100644 --- a/src/db-sql.c +++ b/src/db-sql.c @@ -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)) { diff --git a/src/err.c b/src/err.c index 3fef7a1a..6dce5232 100644 --- a/src/err.c +++ b/src/err.c @@ -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; diff --git a/src/main.c b/src/main.c index 30e1bda4..577f70e2 100644 --- a/src/main.c +++ b/src/main.c @@ -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 */ diff --git a/src/os-win32.c b/src/os-win32.c index eab60ada..f1c2d375 100644 --- a/src/os-win32.c +++ b/src/os-win32.c @@ -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"); } diff --git a/src/plugin.c b/src/plugin.c index 3ac1324f..19d46401 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -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 */ } diff --git a/src/scan-xml.c b/src/scan-xml.c index a081dbef..32f70106 100644 --- a/src/scan-xml.c +++ b/src/scan-xml.c @@ -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; } diff --git a/src/tabs.sh b/src/tabs.sh index 9623eca5..874e7139 100755 --- a/src/tabs.sh +++ b/src/tabs.sh @@ -2,4 +2,4 @@ XX=' ' echo "Searching for ${XX}." -egrep "${XX}" *.[ch] +egrep -l "${XX}" *.[ch] diff --git a/src/util.c b/src/util.c index 242991c6..efa56d35 100644 --- a/src/util.c +++ b/src/util.c @@ -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; } diff --git a/src/xml-rpc.c b/src/xml-rpc.c index c22985da..e91456f2 100644 --- a/src/xml-rpc.c +++ b/src/xml-rpc.c @@ -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 */ }