diff --git a/admin-root/config.xml b/admin-root/config.xml index 93f311f9..abc940c8 100644 --- a/admin-root/config.xml +++ b/admin-root/config.xml @@ -65,7 +65,7 @@ Should the logfile get truncated on startup? - select + select diff --git a/src/conf.c b/src/conf.c index aff2572a..0ff8dddb 100644 --- a/src/conf.c +++ b/src/conf.c @@ -126,6 +126,7 @@ static CONF_ELEMENTS conf_elements[] = { { 0, 0, CONF_T_STRING,"general","never_transcode" }, { 0, 0, CONF_T_MULTICOMMA,"general","compdirs" }, { 0, 0, CONF_T_STRING,"general","logfile" }, + { 0, 0, CONF_T_INT,"general","truncate" }, { 0, 0, CONF_T_EXISTPATH,"plugins","plugin_dir" }, { 0, 0, CONF_T_MULTICOMMA,"plugins","plugins" }, { 0, 0, CONF_T_INT,"daap","empty_strings" }, @@ -349,7 +350,7 @@ int _conf_verify_element(char *section, char *key, char *value) { return CONF_E_SUCCESS; return CONF_E_INTEXPECTED; break; - + case CONF_T_MULTIPATH: if(_conf_split(value,",",&valuearray) >= 0) { index = 0; @@ -537,7 +538,7 @@ void _conf_apply(LL_HANDLE pll) { /** * reload the existing config file. - * + * * @returns CONF_E_SUCCESS on success */ int conf_reload(void) { @@ -1370,7 +1371,7 @@ int _conf_split(char *s, char *delimiters, char ***argvp) { if(strchr(delimiters,*tmp) && (*(tmp+1) != *tmp)) break; if(strchr(delimiters,*tmp)) { - tmp += 2; + tmp += 2; } else { tmp++; } @@ -1378,7 +1379,7 @@ int _conf_split(char *s, char *delimiters, char ***argvp) { *tmp = '\0'; tmp++; (*argvp)[i] = tokptr; - + fix_src = fix_dst = tokptr; while(*fix_src) { if(strchr(delimiters,*fix_src) && (*(fix_src+1) == *fix_src)) { @@ -1634,7 +1635,7 @@ char *conf_get_filename(void) { /** * this is an ugly block of crap to carry around every - * time one wants the servername. + * time one wants the servername. */ char *conf_get_servername(void) { char *retval; @@ -1709,7 +1710,7 @@ char *conf_get_servername(void) { } else { *dst++ = *src++; } - + } return retval; diff --git a/src/db-sql-sqlite2.c b/src/db-sql-sqlite2.c index 71f40037..f9449e6f 100644 --- a/src/db-sql-sqlite2.c +++ b/src/db-sql-sqlite2.c @@ -69,7 +69,7 @@ static char *db_sqlite2_enum_query; static char db_sqlite2_path[PATH_MAX + 1]; -#define DB_SQLITE2_VERSION 12 +#define DB_SQLITE2_VERSION 13 /* Forwards */ @@ -157,7 +157,8 @@ int db_sqlite2_open(char **pe, char *dsn) { DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n"); } else if(ver != DB_SQLITE2_VERSION) { /* we'll deal with this in the db handler */ - DPRINTF(E_LOG,L_DB,"Old database version.\n"); + DPRINTF(E_LOG,L_DB,"Old database version: %d, expecting %d\n", + ver, DB_SQLITE2_VERSION); db_get_error(pe,DB_E_WRONGVERSION); return DB_E_WRONGVERSION; } @@ -328,13 +329,13 @@ int db_sqlite2_event(int event_type) { if(!conf_get_int("database","quick_startup",0)) db_sqlite2_exec(NULL,E_FATAL,"vacuum"); - /* make sure our indexes exist */ - db_sqlite2_exec(NULL,E_DBG,"create index idx_path on " - "songs(path,idx)"); - db_sqlite2_exec(NULL,E_DBG,"create index idx_songid on " - "playlistitems(songid)"); - db_sqlite2_exec(NULL,E_DBG,"create index idx_playlistid on " - "playlistitems(playlistid,songid)"); + /* make sure our indexes exist */ + db_sqlite2_exec(NULL,E_DBG,"create index idx_path on " + "songs(path,idx)"); + db_sqlite2_exec(NULL,E_DBG,"create index idx_songid on " + "playlistitems(songid)"); + db_sqlite2_exec(NULL,E_DBG,"create index idx_playlistid on " + "playlistitems(playlistid,songid)"); db_sqlite2_reload=0; break; diff --git a/src/db-sql-sqlite3.c b/src/db-sql-sqlite3.c index fb1acda6..aa99074e 100644 --- a/src/db-sql-sqlite3.c +++ b/src/db-sql-sqlite3.c @@ -152,7 +152,8 @@ int db_sqlite3_open(char **pe, char *dsn) { /* we'll catch this on the init */ DPRINTF(E_LOG,L_DB,"Can't get db version. New database?\n"); } else if(ver != DB_SQLITE3_VERSION) { - DPRINTF(E_LOG,L_DB,"Old database version.\n"); + DPRINTF(E_LOG,L_DB,"Old database version: %d, expecting %d\n", + ver,DB_SQLITE3_VERSION); db_get_error(pe,DB_E_WRONGVERSION); return DB_E_WRONGVERSION; } @@ -234,8 +235,8 @@ int db_sqlite3_enum_begin_helper(char **pe) { if(!db_sqlite3_enum_query) *((int*)NULL) = 1; - - + + DPRINTF(E_DBG,L_DB,"Executing: %s\n",db_sqlite3_enum_query); err=sqlite3_prepare(db_sqlite3_songs,db_sqlite3_enum_query,-1, &db_sqlite3_stmt,&ptail); @@ -258,7 +259,7 @@ int db_sqlite3_enum_begin_helper(char **pe) { } /** - * fetch the next row. This will return DB_E_SUCCESS if it got a + * fetch the next row. This will return DB_E_SUCCESS if it got a * row, or it's done. If it's done, the row will be empty, otherwise * it will be full of data. Either way, if fetch fails, you must close. * @@ -362,12 +363,12 @@ int db_sqlite3_event(int event_type) { if(!conf_get_int("database","quick_startup",0)) db_sqlite3_exec(NULL,E_FATAL,"vacuum"); - db_sqlite3_exec(NULL,E_DBG,"create index idx_path on " - "songs(path,idx)"); - db_sqlite3_exec(NULL,E_DBG,"create index idx_songid on " - "playlistitems(songid)"); - db_sqlite3_exec(NULL,E_DBG,"create index idx_playlistid on " - "playlistitems(playlistid,songid)"); + db_sqlite3_exec(NULL,E_DBG,"create index idx_path on " + "songs(path,idx)"); + db_sqlite3_exec(NULL,E_DBG,"create index idx_songid on " + "playlistitems(songid)"); + db_sqlite3_exec(NULL,E_DBG,"create index idx_playlistid on " + "playlistitems(playlistid,songid)"); db_sqlite3_reload=0; break; @@ -455,11 +456,11 @@ int db_sqlite3_event(int event_type) { int db_sqlite3_insert_id(void) { int result; - + db_sqlite3_lock(); result = (int)sqlite3_last_insert_rowid(db_sqlite3_songs); db_sqlite3_unlock(); - + return result; }