From 0e84da16795d50839d4fffd7a4a02549437322da Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Tue, 25 Jul 2006 03:49:36 +0000 Subject: [PATCH] -Wall cleanups, fix correct_order flag --- src/db-sql.c | 3 ++- src/err.c | 3 +++ src/plugin.c | 3 +++ src/plugins/ssc-script.c | 2 -- src/util.c | 25 +++++++++++++------------ src/xml-rpc.c | 1 + 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/db-sql.c b/src/db-sql.c index b806b81f..dec73ddd 100644 --- a/src/db-sql.c +++ b/src/db-sql.c @@ -1116,7 +1116,8 @@ int db_sql_enum_start(char **pe, DBQUERYINFO *pinfo) { */ if(pinfo->correct_order) { - sprintf(query_rest," where (songs.id=playlistitems.songid and " + sprintf(query_rest,",playlistitems where " + "(songs.id=playlistitems.songid and " "playlistitems.playlistid=%d) order by " "playlistitems.id",pinfo->playlist_id); } else { diff --git a/src/err.c b/src/err.c index a6bd0144..0ae211d3 100644 --- a/src/err.c +++ b/src/err.c @@ -41,6 +41,9 @@ #include #include +#include +#include + #include "err.h" #ifndef ERR_LEAN # include "os.h" diff --git a/src/plugin.c b/src/plugin.c index 19d46401..30e4abaa 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -33,6 +33,9 @@ #include #include +#include +#include + #include "conf.h" #include "db-generic.h" #include "dispatch.h" diff --git a/src/plugins/ssc-script.c b/src/plugins/ssc-script.c index ac3ea94c..3e1666d5 100644 --- a/src/plugins/ssc-script.c +++ b/src/plugins/ssc-script.c @@ -103,8 +103,6 @@ void *ssc_script_init(void) { * FIXME: make register errors in the sschandle */ char *ssc_script_error(void *vp) { - SSCHANDLE *handle = (SSCHANDLE*)vp; - return "Unknown"; } diff --git a/src/util.c b/src/util.c index 426c147b..14e6d182 100644 --- a/src/util.c +++ b/src/util.c @@ -11,6 +11,7 @@ #endif #include +#include #include #include @@ -60,14 +61,14 @@ int util_must_exit(void) { * calculate how long a utf16le string will be once converted */ int util_utf16toutf8_len(unsigned char *utf16, int len) { - char *src = utf16; + unsigned char *src = utf16; int out_len = 0; - uint16_t temp_word; + uint32_t temp_dword; while(src+2 <= utf16 + len) { - temp_word = src[1] << 8 | src[0]; + temp_dword = src[1] << 8 | src[0]; - if((temp_word & 0xFC00) == 0xD800) { + if((temp_dword & 0xFC00) == 0xD800) { src += 2; if(src + 2 <= utf16 + len) { out_len += 4; @@ -75,11 +76,11 @@ int util_utf16toutf8_len(unsigned char *utf16, int len) { return -1; } } else { - if(temp_word <= 0x7F) + if(temp_dword <= 0x7F) out_len += 1; - else if(temp_word <= 0x7FF) + else if(temp_dword <= 0x7FF) out_len += 2; - else if(temp_word <= 0xFFFF) + else if(temp_dword <= 0xFFFF) out_len += 3; } @@ -106,7 +107,7 @@ int util_utf16toutf8_len(unsigned char *utf16, int len) { int util_utf16toutf8(unsigned char *utf8, int dlen, unsigned char *utf16, int len) { unsigned char *src=utf16; - char *dst; + unsigned char *dst; unsigned int w1, w2; int bytes; int new_len; @@ -177,7 +178,7 @@ int util_utf8toutf16_len(unsigned char *utf8) { int len,out_len,trailing_bytes; unsigned char *src = utf8; - len=(int)strlen(utf8); + len=(int)strlen((char *)utf8); out_len = 0; while(src < utf8 + len) { @@ -208,7 +209,7 @@ unsigned char *util_utf8toutf16_alloc(unsigned char *utf8) { return NULL; out = calloc(1,new_len + 2); - if(!util_utf8toutf16(out,new_len + 2,utf8,(int)strlen(utf8))) { + if(!util_utf8toutf16(out,new_len + 2,utf8,(int)strlen((char*)utf8))) { free(out); return NULL; } @@ -234,13 +235,13 @@ unsigned char *util_utf16touft8_alloc(unsigned char *utf16, int len) { int util_utf8toutf16(unsigned char *utf16, int dlen, unsigned char *utf8, int len) { unsigned char *src=utf8; - char *dst; + unsigned char *dst; int new_len; int trailing_bytes; uint32_t utf32; uint16_t temp_word; - len=(int)strlen(utf8); /* ignore passed length, might be wrong! */ + len=(int)strlen((char*)utf8); /* ignore passed length, might be wrong! */ if(!len) return FALSE; diff --git a/src/xml-rpc.c b/src/xml-rpc.c index e91456f2..4e999b3e 100644 --- a/src/xml-rpc.c +++ b/src/xml-rpc.c @@ -22,6 +22,7 @@ # include #endif +#include #include #include "configfile.h"