mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-23 11:32:34 -05:00
-Wall fixes
This commit is contained in:
parent
76bdffec53
commit
9289f526db
@ -15,7 +15,7 @@ AC_CANONICAL_HOST
|
||||
|
||||
AM_CONDITIONAL(COND_REND_OSX,false)
|
||||
|
||||
AC_ARG_ENABLE(debug,Enable debugging features,CPPFLAGS="$CPPFLAGS -DDEBUG -g")
|
||||
AC_ARG_ENABLE(debug,Enable debugging features,CPPFLAGS="$CPPFLAGS -DDEBUG_MEMORY -g -Wall")
|
||||
AC_ARG_ENABLE(efence,Enable electric fence,LDFLAGS="$LDFLAGS -lefence")
|
||||
|
||||
AC_ARG_ENABLE(howl,[ --enable-howl Use the howl mDNS library],
|
||||
|
@ -27,12 +27,15 @@
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <rend.h>
|
||||
#include <restart.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
@ -81,6 +84,7 @@ CONFIGELEMENT config_elements[] = {
|
||||
{ 1,1,0,CONFIG_TYPE_INT,"port",(void*)&config.port,config_emit_int },
|
||||
{ 1,1,0,CONFIG_TYPE_STRING,"admin_pw",(void*)&config.adminpassword,config_emit_string },
|
||||
{ 1,1,0,CONFIG_TYPE_STRING,"mp3_dir",(void*)&config.mp3dir,config_emit_string },
|
||||
{ 1,1,0,CONFIG_TYPE_STRING,"db_dir",(void*)&config.dbdir,config_emit_string },
|
||||
{ 1,1,0,CONFIG_TYPE_STRING,"servername",(void*)&config.servername,config_emit_string },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"playlist",(void*)&config.playlist,config_emit_string },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"password",(void*)&config.readpassword, config_emit_string },
|
||||
@ -358,9 +362,8 @@ void config_handler(WS_CONNINFO *pwsc) {
|
||||
int file_fd;
|
||||
struct stat sb;
|
||||
char *pw;
|
||||
int status;
|
||||
|
||||
DPRINTF(ERR_DEBUG,"Entereing config_handler\n");
|
||||
DPRINTF(ERR_DEBUG,"Entering config_handler\n");
|
||||
|
||||
config_set_status(pwsc,0,"Serving admin pages");
|
||||
|
||||
@ -493,8 +496,6 @@ void config_emit_int(WS_CONNINFO *pwsc, void *value, char *arg) {
|
||||
*/
|
||||
void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) {
|
||||
int mdns_running;
|
||||
int status;
|
||||
int err;
|
||||
char *html;
|
||||
|
||||
ws_writefd(pwsc,"<TABLE><TR><TH ALIGN=LEFT>Service</TH>");
|
||||
@ -695,12 +696,6 @@ void config_emit_include(WS_CONNINFO *pwsc, void *value, char *arg) {
|
||||
char path[PATH_MAX];
|
||||
int file_fd;
|
||||
struct stat sb;
|
||||
char argbuffer[30];
|
||||
int in_arg;
|
||||
char *argptr;
|
||||
char next;
|
||||
CONFIGELEMENT *pce;
|
||||
char *first, *last;
|
||||
|
||||
DPRINTF(ERR_DEBUG,"Preparing to include %s\n",arg);
|
||||
|
||||
@ -819,7 +814,7 @@ void config_set_status(WS_CONNINFO *pwsc, int session, char *fmt, ...) {
|
||||
int config_mutex_lock(void) {
|
||||
int err;
|
||||
|
||||
if(err=pthread_mutex_lock(&scan_mutex)) {
|
||||
if((err=pthread_mutex_lock(&scan_mutex))) {
|
||||
errno=err;
|
||||
return - 1;
|
||||
}
|
||||
@ -835,7 +830,7 @@ int config_mutex_lock(void) {
|
||||
int config_mutex_unlock(void) {
|
||||
int err;
|
||||
|
||||
if(err=pthread_mutex_unlock(&scan_mutex)) {
|
||||
if((err=pthread_mutex_unlock(&scan_mutex))) {
|
||||
errno=err;
|
||||
return -1;
|
||||
}
|
||||
|
@ -237,12 +237,10 @@ DAAP_BLOCK *daap_add_empty(DAAP_BLOCK *parent, char *tag) {
|
||||
* Serialize a daap tree to a fd;
|
||||
*/
|
||||
int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) {
|
||||
DAAP_BLOCK *current;
|
||||
char size[4];
|
||||
|
||||
if(!root)
|
||||
return 0;
|
||||
|
||||
|
||||
r_write(fd,root->tag,4);
|
||||
|
||||
@ -276,7 +274,7 @@ int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) {
|
||||
*
|
||||
* Free an entire daap formatted block
|
||||
*/
|
||||
int daap_free(DAAP_BLOCK *root) {
|
||||
void daap_free(DAAP_BLOCK *root) {
|
||||
if(!root)
|
||||
return;
|
||||
|
||||
@ -289,5 +287,5 @@ int daap_free(DAAP_BLOCK *root) {
|
||||
daap_free(root->children);
|
||||
daap_free(root->next);
|
||||
free(root);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ DAAP_BLOCK *daap_add_char(DAAP_BLOCK *parent, char *tag, char value);
|
||||
DAAP_BLOCK *daap_add_short(DAAP_BLOCK *parent, char *tag, short int value);
|
||||
DAAP_BLOCK *daap_add_long(DAAP_BLOCK *parent, char *tag, int v1, int v2);
|
||||
int daap_serialize(DAAP_BLOCK *root, int fd, int gzip);
|
||||
int daap_free(DAAP_BLOCK *root);
|
||||
void daap_free(DAAP_BLOCK *root);
|
||||
|
||||
#endif
|
||||
|
||||
|
17
src/daap.c
17
src/daap.c
@ -28,6 +28,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "configfile.h"
|
||||
#include "db-memory.h"
|
||||
#include "daap-proto.h"
|
||||
#include "daap.h"
|
||||
@ -239,7 +240,7 @@ DAAP_BLOCK *daap_response_songlist(void) {
|
||||
mlcl=daap_add_empty(root,"mlcl");
|
||||
|
||||
if(mlcl) {
|
||||
while(current=db_enum(&henum)) {
|
||||
while((current=db_enum(&henum))) {
|
||||
DPRINTF(ERR_DEBUG,"Got entry for %s\n",current->fname);
|
||||
mlit=daap_add_empty(mlcl,"mlit");
|
||||
if(mlit) {
|
||||
@ -379,9 +380,9 @@ DAAP_BLOCK *daap_response_update(int fd, int clientver) {
|
||||
* handle the daap block for the /databases/containers URI
|
||||
*/
|
||||
DAAP_BLOCK *daap_response_playlists(char *name) {
|
||||
DAAP_BLOCK *root;
|
||||
DAAP_BLOCK *mlcl;
|
||||
DAAP_BLOCK *mlit;
|
||||
DAAP_BLOCK *root=NULL;
|
||||
DAAP_BLOCK *mlcl=NULL;
|
||||
DAAP_BLOCK *mlit=NULL;
|
||||
int g=1;
|
||||
int playlistid;
|
||||
ENUMHANDLE henum;
|
||||
@ -442,9 +443,9 @@ DAAP_BLOCK *daap_response_playlists(char *name) {
|
||||
*/
|
||||
|
||||
DAAP_BLOCK *daap_response_dbinfo(char *name) {
|
||||
DAAP_BLOCK *root;
|
||||
DAAP_BLOCK *mlcl;
|
||||
DAAP_BLOCK *mlit;
|
||||
DAAP_BLOCK *root=NULL;
|
||||
DAAP_BLOCK *mlcl=NULL;
|
||||
DAAP_BLOCK *mlit=NULL;
|
||||
int g=1;
|
||||
|
||||
DPRINTF(ERR_DEBUG,"Preparing to send db info\n");
|
||||
@ -555,7 +556,7 @@ DAAP_BLOCK *daap_response_playlist_items(unsigned int playlist) {
|
||||
|
||||
if(mlcl) {
|
||||
if(playlist == 1) {
|
||||
while(current=db_enum(&henum)) {
|
||||
while((current=db_enum(&henum))) {
|
||||
mlit=daap_add_empty(mlcl,"mlit");
|
||||
if(mlit) {
|
||||
g = g && daap_add_char(mlit,"mikd",2);
|
||||
|
@ -41,6 +41,7 @@ typedef struct tag_config {
|
||||
char *servername;
|
||||
char *playlist;
|
||||
char *runas;
|
||||
char *dbdir;
|
||||
|
||||
SONGENTRY songlist;
|
||||
} CONFIG;
|
||||
@ -48,6 +49,6 @@ typedef struct tag_config {
|
||||
extern CONFIG config;
|
||||
|
||||
/* Forwards */
|
||||
extern drop_privs(char *user);
|
||||
extern int drop_privs(char *user);
|
||||
|
||||
#endif /* _DAAPD_H_ */
|
||||
|
@ -221,7 +221,7 @@ int db_add_playlist(unsigned int playlistid, char *name) {
|
||||
|
||||
DPRINTF(ERR_DEBUG,"Adding new playlist %s\n",name);
|
||||
|
||||
if(err=pthread_rwlock_wrlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_wrlock(&db_rwlock))) {
|
||||
DPRINTF(ERR_WARN,"cannot lock wrlock in db_add\n");
|
||||
free(pnew->name);
|
||||
free(pnew);
|
||||
@ -262,7 +262,7 @@ int db_add_playlist_song(unsigned int playlistid, unsigned int itemid) {
|
||||
|
||||
DPRINTF(ERR_DEBUG,"Adding new playlist item\n");
|
||||
|
||||
if(err=pthread_rwlock_wrlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_wrlock(&db_rwlock))) {
|
||||
DPRINTF(ERR_WARN,"cannot lock wrlock in db_add\n");
|
||||
free(pnew);
|
||||
errno=err;
|
||||
@ -344,7 +344,7 @@ int db_add(MP3FILE *mp3file) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(err=pthread_rwlock_wrlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_wrlock(&db_rwlock))) {
|
||||
DPRINTF(ERR_WARN,"cannot lock wrlock in db_add\n");
|
||||
db_freerecord(pnew);
|
||||
errno=err;
|
||||
@ -393,7 +393,7 @@ void db_freerecord(MP3RECORD *mp3record) {
|
||||
MP3RECORD *db_enum_begin(void) {
|
||||
int err;
|
||||
|
||||
if(err=pthread_rwlock_rdlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_rdlock(&db_rwlock))) {
|
||||
log_err(0,"Cannot lock rwlock\n");
|
||||
errno=err;
|
||||
return NULL;
|
||||
@ -411,7 +411,7 @@ DB_PLAYLIST *db_playlist_enum_begin(void) {
|
||||
int err;
|
||||
DB_PLAYLIST *current;
|
||||
|
||||
if(err=pthread_rwlock_rdlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_rdlock(&db_rwlock))) {
|
||||
log_err(0,"Cannot lock rwlock\n");
|
||||
errno=err;
|
||||
return NULL;
|
||||
@ -432,10 +432,9 @@ DB_PLAYLIST *db_playlist_enum_begin(void) {
|
||||
*/
|
||||
DB_PLAYLISTENTRY *db_playlist_items_enum_begin(int playlistid) {
|
||||
DB_PLAYLIST *current;
|
||||
DB_PLAYLISTENTRY *retval;
|
||||
int err;
|
||||
|
||||
if(err=pthread_rwlock_rdlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_rdlock(&db_rwlock))) {
|
||||
log_err(0,"Cannot lock rwlock\n");
|
||||
errno=err;
|
||||
return NULL;
|
||||
@ -580,7 +579,7 @@ int db_get_playlist_entry_count(int playlistid) {
|
||||
DB_PLAYLIST *current;
|
||||
int err;
|
||||
|
||||
if(err=pthread_rwlock_rdlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_rdlock(&db_rwlock))) {
|
||||
log_err(0,"Cannot lock rwlock\n");
|
||||
errno=err;
|
||||
return -1;
|
||||
@ -612,7 +611,7 @@ char *db_get_playlist_name(int playlistid) {
|
||||
DB_PLAYLIST *current;
|
||||
int err;
|
||||
|
||||
if(err=pthread_rwlock_rdlock(&db_rwlock)) {
|
||||
if((err=pthread_rwlock_rdlock(&db_rwlock))) {
|
||||
log_err(0,"Cannot lock rwlock\n");
|
||||
errno=err;
|
||||
return NULL;
|
||||
|
21
src/err.c
21
src/err.c
@ -23,13 +23,20 @@
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <syslog.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
|
||||
|
||||
#define __IN_ERR__
|
||||
#include "err.h"
|
||||
|
||||
|
||||
int err_debuglevel=0;
|
||||
int err_logdestination=LOGDEST_STDERR;
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
|
||||
typedef struct tag_err_leak {
|
||||
void *ptr;
|
||||
char *file;
|
||||
@ -38,10 +45,6 @@ typedef struct tag_err_leak {
|
||||
struct tag_err_leak *next;
|
||||
} ERR_LEAK;
|
||||
|
||||
int err_debuglevel=0;
|
||||
int err_logdestination=LOGDEST_STDERR;
|
||||
|
||||
#ifdef DEBUG
|
||||
pthread_mutex_t err_mutex=PTHREAD_MUTEX_INITIALIZER;
|
||||
ERR_LEAK err_leak = { NULL, NULL, 0, 0, NULL };
|
||||
#endif
|
||||
@ -99,7 +102,7 @@ void log_setdest(char *app, int destination) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_MEMORY
|
||||
|
||||
/*
|
||||
* err_lock
|
||||
@ -109,7 +112,7 @@ void log_setdest(char *app, int destination) {
|
||||
int err_lock_mutex(void) {
|
||||
int err;
|
||||
|
||||
if(err=pthread_mutex_lock(&err_mutex)) {
|
||||
if((err=pthread_mutex_lock(&err_mutex))) {
|
||||
errno=err;
|
||||
return -1;
|
||||
}
|
||||
@ -128,7 +131,7 @@ int err_lock_mutex(void) {
|
||||
int err_unlock_mutex(void) {
|
||||
int err;
|
||||
|
||||
if(err=pthread_mutex_unlock(&err_mutex)) {
|
||||
if((err=pthread_mutex_unlock(&err_mutex))) {
|
||||
errno=err;
|
||||
return -1;
|
||||
}
|
||||
@ -249,7 +252,7 @@ void err_leakcheck(void) {
|
||||
|
||||
current=err_leak.next;
|
||||
while(current) {
|
||||
printf("%s: %d - %d bytes at %x\n",current->file, current->line, current->size,
|
||||
printf("%s: %d - %d bytes at %p\n",current->file, current->line, current->size,
|
||||
current->ptr);
|
||||
current=current->next;
|
||||
}
|
||||
|
13
src/err.h
13
src/err.h
@ -36,14 +36,11 @@ extern int err_logdestination;
|
||||
extern void log_err(int quit, char *fmt, ...);
|
||||
extern void log_setdest(char *app, int destination);
|
||||
|
||||
#ifdef DEBUG
|
||||
# define DPRINTF(level, fmt, arg...) \
|
||||
{ if((level) <= err_debuglevel) { log_err(0,"%s: ",__FILE__); log_err(0,fmt,##arg); }}
|
||||
#else
|
||||
# define DPRINTF(level, fmt, arg...)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef DEBUG
|
||||
# define DPRINTF(level, fmt, arg...) \
|
||||
{ if((level) <= err_debuglevel) { log_err(0,"%s, %d: ",__FILE__,__LINE__); log_err(0,fmt,##arg); }}
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
# ifndef __IN_ERR__
|
||||
# define malloc(x) err_malloc(__FILE__,__LINE__,x)
|
||||
# define strdup(x) err_strdup(__FILE__,__LINE__,x)
|
||||
@ -60,5 +57,5 @@ extern void err_leakcheck(void);
|
||||
|
||||
#else
|
||||
# define MEMNOTIFY(x)
|
||||
#endif /* DEBUG */
|
||||
#endif /* DEBUG_MEMORY */
|
||||
#endif /* __ERR_H__ */
|
||||
|
30
src/main.c
30
src/main.c
@ -28,6 +28,7 @@
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <pwd.h>
|
||||
#include <restart.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -36,6 +37,7 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "configfile.h"
|
||||
#include "db-memory.h"
|
||||
@ -86,17 +88,15 @@ int daap_auth(char *username, char *password) {
|
||||
* Handle daap-related web pages
|
||||
*/
|
||||
void daap_handler(WS_CONNINFO *pwsc) {
|
||||
int len;
|
||||
int close;
|
||||
DAAP_BLOCK *root,*error;
|
||||
int compress=0;
|
||||
DAAP_BLOCK *root;
|
||||
int clientrev;
|
||||
|
||||
/* for the /databases URI */
|
||||
char *uri;
|
||||
int db_index;
|
||||
int playlist_index;
|
||||
int item;
|
||||
int item=0;
|
||||
char *first, *last;
|
||||
int streaming=0;
|
||||
|
||||
@ -364,9 +364,7 @@ int daemon_start(int reap_children)
|
||||
void usage(char *program) {
|
||||
printf("Usage: %s [options]\n\n",program);
|
||||
printf("Options:\n");
|
||||
#ifdef DEBUG
|
||||
printf(" -d <number> Debuglevel (0-9)\n");
|
||||
#endif
|
||||
printf(" -m Disable mDNS\n");
|
||||
printf(" -c <file> Use configfile specified");
|
||||
printf(" -p Parse playlist file\n");
|
||||
@ -412,24 +410,15 @@ int main(int argc, char *argv[]) {
|
||||
char *configfile=DEFAULT_CONFIGFILE;
|
||||
WSCONFIG ws_config;
|
||||
WSHANDLE server;
|
||||
ENUMHANDLE handle;
|
||||
MP3FILE *pmp3;
|
||||
int status;
|
||||
int parseonly=0;
|
||||
int foreground=0;
|
||||
config.use_mdns=1;
|
||||
|
||||
#ifdef DEBUG
|
||||
char *optval="d:c:mpf";
|
||||
#else
|
||||
char *optval="c:mpf";
|
||||
#endif /* DEBUG */
|
||||
|
||||
fprintf(stderr,"mt-daapd: version %s\n",VERSION);
|
||||
fprintf(stderr,"Copyright (c) 2003 Ron Pedde. All rights reserved\n");
|
||||
fprintf(stderr,"Portions Copyright (c) 1999-2001 Apple Computer, Inc. All rights Reserved.\n\n");
|
||||
|
||||
while((option=getopt(argc,argv,optval)) != -1) {
|
||||
while((option=getopt(argc,argv,"d:c:mpf")) != -1) {
|
||||
switch(option) {
|
||||
#ifdef DEBUG
|
||||
case 'd':
|
||||
@ -459,13 +448,6 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if(!foreground) {
|
||||
fprintf(stderr,"WARNING: Debug mode: not detaching\n");
|
||||
foreground=1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* read the configfile, if specified, otherwise
|
||||
* try defaults */
|
||||
|
||||
@ -561,7 +543,7 @@ int main(int argc, char *argv[]) {
|
||||
if(foreground) fprintf(stderr,"Closing database\n");
|
||||
db_deinit();
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_MEMORY
|
||||
fprintf(stderr,"Leaked memory:\n");
|
||||
err_leakcheck();
|
||||
#endif
|
||||
|
@ -20,11 +20,13 @@
|
||||
*/
|
||||
|
||||
#define _POSIX_PTHREAD_SEMANTICS
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <id3tag.h>
|
||||
#include <limits.h>
|
||||
#include <restart.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -399,7 +401,7 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
|
||||
int index;
|
||||
int used;
|
||||
unsigned char *utf8_text;
|
||||
int genre;
|
||||
int genre=WINAMP_GENRE_UNKNOWN;
|
||||
int have_utf8;
|
||||
int have_text;
|
||||
id3_ucs4_t const *native_text;
|
||||
|
@ -20,12 +20,18 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "db-memory.h"
|
||||
#include "err.h"
|
||||
#include "mp3-scanner.h"
|
||||
#include "playlist.h"
|
||||
#include "parser.h"
|
||||
|
||||
/* Externs */
|
||||
extern int yyparse(void *);
|
||||
|
||||
/* Globals */
|
||||
SMART_PLAYLIST pl_smart = { NULL, 0, NULL, NULL };
|
||||
int pl_error=0;
|
||||
@ -158,7 +164,7 @@ int pl_load(char *file) {
|
||||
}
|
||||
|
||||
yyin=fin;
|
||||
result=yyparse();
|
||||
result=yyparse(NULL);
|
||||
fclose(fin);
|
||||
|
||||
if(pl_error) {
|
||||
@ -204,13 +210,14 @@ void pl_eval(MP3FILE *pmp3) {
|
||||
*/
|
||||
int pl_eval_node(MP3FILE *pmp3, PL_NODE *pnode) {
|
||||
int r_arg,r_arg2;
|
||||
int argtypec;
|
||||
char *cval;
|
||||
int ival;
|
||||
char *cval=NULL;
|
||||
int ival=0;
|
||||
int boolarg;
|
||||
int not=0;
|
||||
int retval=0;
|
||||
|
||||
r_arg=r_arg2=0;
|
||||
|
||||
if((pnode->op == AND) || (pnode->op == OR)) {
|
||||
r_arg=pl_eval_node(pmp3,pnode->arg1.plval);
|
||||
if((pnode->op == AND) && !r_arg)
|
||||
@ -257,7 +264,7 @@ int pl_eval_node(MP3FILE *pmp3, PL_NODE *pnode) {
|
||||
retval = not ? r_arg : !r_arg;
|
||||
break;
|
||||
case INCLUDES:
|
||||
r_arg=strcasestr(cval,pnode->arg2.cval);
|
||||
r_arg=(int)strcasestr(cval,pnode->arg2.cval);
|
||||
retval = not ? !r_arg : r_arg;
|
||||
break;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <libc.h>
|
||||
@ -106,7 +107,6 @@ static void rend_reply(DNSServiceRegistrationReplyErrorType errorCode, void *con
|
||||
*/
|
||||
void *rend_pipe_monitor(void* arg) {
|
||||
fd_set rset;
|
||||
struct timeval tv;
|
||||
int result;
|
||||
|
||||
|
||||
|
@ -24,7 +24,10 @@
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <restart.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "daapd.h"
|
||||
|
@ -23,16 +23,19 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <regex.h>
|
||||
#include <restart.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <uici.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
@ -88,7 +91,6 @@ int ws_getpostvars(WS_CONNINFO *pwsc);
|
||||
int ws_getgetvars(WS_CONNINFO *pwsc, char *string);
|
||||
char *ws_getarg(ARGLIST *root, char *key);
|
||||
int ws_testarg(ARGLIST *root, char *key, char *value);
|
||||
void ws_emitheaders(WS_CONNINFO *pwsc);
|
||||
int ws_findhandler(WS_PRIVATE *pwsp, WS_CONNINFO *pwsc,
|
||||
void(**preq)(WS_CONNINFO*),
|
||||
int(**pauth)(char *, char *),
|
||||
@ -121,7 +123,7 @@ char *ws_moy[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
|
||||
int ws_lock_unsafe(void) {
|
||||
int err;
|
||||
|
||||
if(err=pthread_mutex_lock(&ws_unsafe)) {
|
||||
if((err=pthread_mutex_lock(&ws_unsafe))) {
|
||||
errno=err;
|
||||
return -1;
|
||||
}
|
||||
@ -140,7 +142,7 @@ int ws_lock_unsafe(void) {
|
||||
int ws_unlock_unsafe(void) {
|
||||
int err;
|
||||
|
||||
if(err=pthread_mutex_unlock(&ws_unsafe)) {
|
||||
if((err=pthread_mutex_unlock(&ws_unsafe))) {
|
||||
errno=err;
|
||||
return -1;
|
||||
}
|
||||
@ -176,12 +178,12 @@ WSHANDLE ws_start(WSCONFIG *config) {
|
||||
pwsp->dispatch_threads=0;
|
||||
pwsp->handlers.next=NULL;
|
||||
|
||||
if(err=pthread_cond_init(&pwsp->exit_cond, NULL)) {
|
||||
if((err=pthread_cond_init(&pwsp->exit_cond, NULL))) {
|
||||
errno=err;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(err=pthread_mutex_init(&pwsp->exit_mutex,NULL)) {
|
||||
if((err=pthread_mutex_init(&pwsp->exit_mutex,NULL))) {
|
||||
errno=err;
|
||||
return NULL;
|
||||
}
|
||||
@ -196,7 +198,7 @@ WSHANDLE ws_start(WSCONFIG *config) {
|
||||
}
|
||||
|
||||
DPRINTF(ERR_INFO,"Starting server thread\n");
|
||||
if(err=pthread_create(&pwsp->server_tid,NULL,ws_mainthread,(void*)pwsp)) {
|
||||
if((err=pthread_create(&pwsp->server_tid,NULL,ws_mainthread,(void*)pwsp))) {
|
||||
DPRINTF(ERR_WARN,"Could not spawn thread: %s\n",strerror(err));
|
||||
r_close(pwsp->server_fd);
|
||||
errno=err;
|
||||
@ -326,7 +328,7 @@ void *ws_mainthread(void *arg) {
|
||||
if(pthread_mutex_lock(&pwsp->exit_mutex))
|
||||
log_err(1,"Cannot lock condition mutex\n");
|
||||
|
||||
if(err=pthread_create(&tid,NULL,ws_dispatcher,(void*)pwsc)) {
|
||||
if((err=pthread_create(&tid,NULL,ws_dispatcher,(void*)pwsc))) {
|
||||
pwsc->error=err;
|
||||
DPRINTF(ERR_WARN,"Could not spawn thread: %s\n",strerror(err));
|
||||
pthread_mutex_unlock(&pwsp->exit_mutex);
|
||||
@ -427,7 +429,6 @@ void ws_emitheaders(WS_CONNINFO *pwsc) {
|
||||
* get headers
|
||||
*/
|
||||
int ws_getpostvars(WS_CONNINFO *pwsc) {
|
||||
char *first, *last;
|
||||
char *content_length;
|
||||
int length;
|
||||
char *buffer;
|
||||
@ -592,9 +593,7 @@ void *ws_dispatcher(void *arg) {
|
||||
WS_CONNINFO *pwsc=(WS_CONNINFO*)arg;
|
||||
WS_PRIVATE *pwsp=pwsc->pwsp;
|
||||
char buffer[MAX_LINEBUFFER];
|
||||
char *buffp;
|
||||
char *first,*last;
|
||||
int done;
|
||||
int connection_done=0;
|
||||
int can_dispatch;
|
||||
char *auth, *username, *password;
|
||||
@ -1029,7 +1028,7 @@ int ws_addarg(ARGLIST *root, char *key, char *fmt, ...) {
|
||||
char *ws_urldecode(char *string) {
|
||||
char *pnew;
|
||||
char *src,*dst;
|
||||
int val;
|
||||
int val=0;
|
||||
|
||||
pnew=(char*)malloc(strlen(string)+1);
|
||||
if(!pnew)
|
||||
@ -1201,7 +1200,7 @@ int ws_decodepassword(char *header, char **username, char **password) {
|
||||
|
||||
decodebuffer=(unsigned char *)malloc(strlen(header));
|
||||
if(!decodebuffer)
|
||||
return;
|
||||
return -1;
|
||||
|
||||
DPRINTF(ERR_DEBUG,"Preparing to decode %s\n",header);
|
||||
|
||||
|
@ -84,5 +84,6 @@ extern int ws_writefd(WS_CONNINFO *pwsc, char *fmt, ...);
|
||||
extern char *ws_getvar(WS_CONNINFO *pwsc, char *var);
|
||||
extern char *ws_getrequestheader(WS_CONNINFO *pwsc, char *header);
|
||||
extern int ws_testrequestheader(WS_CONNINFO *pwsc, char *header, char *value);
|
||||
extern void ws_emitheaders(WS_CONNINFO *pwsc);
|
||||
|
||||
#endif /* _WEBSERVER_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user