X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fplugin_xmms%2Fplugin.c;h=0346d30a1322c36b7c42fedc95fae479bd44c75c;hb=3c84f9e86b40b64bb42af6dff8c61521c5439ecd;hp=322947854647fb0d942a7f06e5d3c35890bae448;hpb=fb84f25bc196f60954a9999bab40382e31d4a9de;p=platform%2Fupstream%2Fflac.git diff --git a/src/plugin_xmms/plugin.c b/src/plugin_xmms/plugin.c index 3229478..0346d30 100644 --- a/src/plugin_xmms/plugin.c +++ b/src/plugin_xmms/plugin.c @@ -1,5 +1,5 @@ /* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson + * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,14 +11,12 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H -# include -#endif +#include "plugin.h" #include #include @@ -75,14 +73,14 @@ typedef struct { DitherContext dither_context; } stream_data_struct; -static void FLAC_XMMS__init(); +static void FLAC_XMMS__init(void); static int FLAC_XMMS__is_our_file(char *filename); static void FLAC_XMMS__play_file(char *filename); -static void FLAC_XMMS__stop(); +static void FLAC_XMMS__stop(void); static void FLAC_XMMS__pause(short p); static void FLAC_XMMS__seek(int time); -static int FLAC_XMMS__get_time(); -static void FLAC_XMMS__cleanup(); +static int FLAC_XMMS__get_time(void); +static void FLAC_XMMS__cleanup(void); static void FLAC_XMMS__get_song_info(char *filename, char **title, int *length); static void *play_loop_(void *arg); @@ -141,7 +139,7 @@ static FLAC__bool is_big_endian_host_; static unsigned bitrate_history_[BITRATE_HIST_SIZE]; -InputPlugin *get_iplugin_info() +InputPlugin *get_iplugin_info(void) { flac_ip.description = g_strdup_printf("Reference FLAC Player v%s", FLAC__VERSION_STRING); return &flac_ip; @@ -154,7 +152,7 @@ void set_track_info(const char* title, int length_in_msec) } } -static gchar* homedir() +static gchar* homedir(void) { gchar *result; char *env_home = getenv("HOME"); @@ -177,7 +175,7 @@ static FLAC__bool is_http_source(const char *source) return 0 == strncasecmp(source, "http://", 7); } -void FLAC_XMMS__init() +void FLAC_XMMS__init(void) { ConfigFile *cfg; FLAC__uint32 test = 1; @@ -343,7 +341,7 @@ void FLAC_XMMS__play_file(char *filename) pthread_create(&decode_thread_, NULL, play_loop_, NULL); } -void FLAC_XMMS__stop() +void FLAC_XMMS__stop(void) { if(stream_data_.is_playing) { stream_data_.is_playing = false; @@ -372,7 +370,7 @@ void FLAC_XMMS__seek(int time) } } -int FLAC_XMMS__get_time() +int FLAC_XMMS__get_time(void) { if(audio_error_) return -2; @@ -382,7 +380,7 @@ int FLAC_XMMS__get_time() return flac_ip.output->output_time(); } -void FLAC_XMMS__cleanup() +void FLAC_XMMS__cleanup(void) { safe_decoder_delete_(decoder_); decoder_ = 0; @@ -400,8 +398,14 @@ void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec) if(title) { if (!is_http_source(filename)) { static const char *errtitle = "Invalid FLAC File: "; - *title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1); - sprintf(*title, "%s\"%s\"", errtitle, filename); + if(strlen(errtitle) + 1 + strlen(filename) + 1 + 1 < strlen(filename)) { /* overflow check */ + *title = NULL; + } + else { + size_t len = strlen(errtitle) + 1 + strlen(filename) + 1 + 1; + *title = g_malloc(len); + flac_snprintf(*title, len, "%s\"%s\"", errtitle, filename); + } } else { *title = NULL; }