changeset 982:7b0d16a9a92f trunk

[svn] fixed all the warnings
author majeru
date Fri, 27 Apr 2007 12:44:37 -0700
parents d801d8ce24fb
children cc0c5c9ad2b9
files ChangeLog src/lastfm/Makefile src/lastfm/lastfm.c src/lastfm/lastfm.h
diffstat 4 files changed, 75 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 27 02:29:33 2007 -0700
+++ b/ChangeLog	Fri Apr 27 12:44:37 2007 -0700
@@ -1,3 +1,13 @@
+2007-04-27 09:29:33 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [2102]
+  - replace almost all of outlame_write() with standard code from disk_writer in hope of fixing endianness problem.
+  - make use of audacious vfs functions.
+  
+  trunk/src/lame/Makefile   |    2 
+  trunk/src/lame/out_lame.c |  120 +++++++++++++++++++++++++++++++++++++++-------
+  2 files changed, 103 insertions(+), 19 deletions(-)
+
+
 2007-04-26 09:06:12 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [2100]
   - fix overflow when calculates bitrate with non-fast scan on a huge sized file.
--- a/src/lastfm/Makefile	Fri Apr 27 02:29:33 2007 -0700
+++ b/src/lastfm/Makefile	Fri Apr 27 12:44:37 2007 -0700
@@ -13,6 +13,7 @@
 
 CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(BEEP_DEFINES) $(CURL_CFLAGS) -I../../intl -I../..
 
+CFLAGS += -Wall  -pedantic -std=c99
 #CFLAGS += -Wpointer-arith -Wimplicit -Wnested-externs -Wcast-align \
 #-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes \
 #-Wmissing-declarations -W -Wno-unused -Wshadow -Wmissing-noreturn \
--- a/src/lastfm/lastfm.c	Fri Apr 27 02:29:33 2007 -0700
+++ b/src/lastfm/lastfm.c	Fri Apr 27 12:44:37 2007 -0700
@@ -22,32 +22,13 @@
 
 #include <curl/curl.h>
 #include <glib.h>
-
-
-#define LASTFM_HANDSHAKE_URL "http://ws.audioscrobbler.com/radio/handshake.php?version=1.1.1&platform=linux&username=%s&passwordmd5=%s&debug=0&language=jp"
-#define LASTFM_ADJUST_URL "http://ws.audioscrobbler.com/radio/adjust.php?session=%s&url=%s&debug=0"
-#define LASTFM_METADATA_URL "http://ws.audioscrobbler.com/radio/np.php?session=%s&debug=0"
-#define LASTFM_CURL_TIMEOUT 10
+#include "lastfm.h"
 
 
-typedef struct
-{
-	VFSFile *proxy_fd;
-	gchar *lastfm_session_id;
-	gchar *lastfm_mp3_stream_url;
-	gchar *lastfm_station_name;
-	gchar *lastfm_artist;
-	gchar *lastfm_title;
-	gchar *lastfm_album;
-	gchar *lastfm_cover;
-	int lastfm_duration;
-	int login_count;
-} LastFM;
-
 LastFM *LastFMGlobalData;
-       /*this keeps the login data in a global place
-          since we cannot login on every fopen call
-          if anyone has a better solution to this any help is welcome */
+        /*this keeps the login data in a global place since 
+         * we cannot login on every fopen call* if anyone 
+         * has a better solution to this any hint is welcome */
 
 static size_t lastfm_store_res(void *ptr, size_t size, size_t nmemb, void *udata)
 {
@@ -57,7 +38,7 @@
 }
 
 
-static gboolean lastfm_login()
+static gboolean lastfm_login(void)
 {
 	/*gets the session ID in lastfm_session_id and returns the URL to be played
 	 * read http://gabistapler.de/blog/index.php?/archives/268-Play-last.fm-streams-without-the-player.html for more info
@@ -126,7 +107,7 @@
 
 static gboolean lastfm_adjust(const gchar * url)
 {
-	LastFM *LastFMData = g_new0(LastFM, 1);
+        //LastFM *LastFMData = g_new0(LastFM, 1);
 
 	int status, i;
 	gchar tmp[4096], **split = NULL;
@@ -185,7 +166,7 @@
 
 	gint status, i;
 	gchar tmp[4096], **split = NULL;
-	gboolean ret = FALSE;
+//	gboolean ret = FALSE;
 	GString *res = g_string_new(NULL);
 	CURL *curl;
 	if (handle->lastfm_session_id == NULL)
@@ -224,7 +205,7 @@
 			if (g_str_has_prefix(split[i], "albumcover_medium="))
 				handle->lastfm_cover = g_strdup(split[i] + 18);
 			if (g_str_has_prefix(split[i], "trackduration="))
-				handle->lastfm_duration = atoi(g_strdup(split[i] + 14));
+				handle->lastfm_duration = g_ascii_strtoull(g_strdup(split[i] + 14),NULL,10);
 			if (g_str_has_prefix(split[i], "station="))
 			{
 				handle->lastfm_station_name = g_strdup(split[i] + 8);
@@ -381,12 +362,12 @@
 	if (handle->lastfm_title != NULL)
 		puts(handle->lastfm_title);
 
-	printf("%d\n\n", handle->lastfm_duration);
+	printf("%ul\n\n", handle->lastfm_duration);
 #endif
 
-	if (!strcmp(field, "stream-name") && (handle->lastfm_station_name != NULL))
+	if (!g_ascii_strncasecmp(field, "stream-name",12) && (handle->lastfm_station_name != NULL))
 		return g_strdup(handle->lastfm_station_name);
-	if (!strcmp(field, "track-name") && (handle->lastfm_title != NULL) && (handle->lastfm_artist != NULL))
+	if (!g_ascii_strncasecmp(field, "track-name",11) && (handle->lastfm_title != NULL) && (handle->lastfm_artist != NULL))
 		return g_strdup_printf("%s - %s", handle->lastfm_artist, handle->lastfm_title);
 
 	return NULL;
@@ -418,10 +399,6 @@
 static void cleanup(void)
 {
 	g_free(LastFMGlobalData);
-#ifdef DEBUG
-	vfs_unregister_transport(&default_const);
-	vfs_unregister_transport(&file_const);
-#endif
 }
 
 LowlevelPlugin llp_lastfm = {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lastfm/lastfm.h	Fri Apr 27 12:44:37 2007 -0700
@@ -0,0 +1,53 @@
+#define LASTFM_HANDSHAKE_URL "http://ws.audioscrobbler.com/radio/handshake.php?version=1.1.1&platform=linux&username=%s&passwordmd5=%s&debug=0&language=jp"
+#define LASTFM_ADJUST_URL "http://ws.audioscrobbler.com/radio/adjust.php?session=%s&url=%s&debug=0"
+#define LASTFM_METADATA_URL "http://ws.audioscrobbler.com/radio/np.php?session=%s&debug=0"
+
+#define LASTFM_CURL_TIMEOUT 10
+#define DEBUG 1
+
+typedef struct
+{
+	VFSFile *proxy_fd;
+	gchar *lastfm_session_id;
+	gchar *lastfm_mp3_stream_url;
+	gchar *lastfm_station_name;
+	gchar *lastfm_artist;
+	gchar *lastfm_title;
+	gchar *lastfm_album;
+	gchar *lastfm_cover;
+	unsigned lastfm_duration;
+	int login_count;
+} LastFM;
+
+VFSFile *lastfm_vfs_fopen_impl(const gchar * path, const gchar * mode);
+
+size_t lastfm_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile * file);
+
+size_t lastfm_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile * file);
+
+gint lastfm_vfs_getc_impl(VFSFile * stream);
+
+gint lastfm_vfs_ungetc_impl(gint c, VFSFile * stream);
+
+gint lastfm_vfs_fseek_impl(VFSFile * file, glong offset, gint whence);
+
+void lastfm_vfs_rewind_impl(VFSFile * file);
+
+glong lastfm_vfs_ftell_impl(VFSFile * file);
+
+gboolean lastfm_vfs_feof_impl(VFSFile * file);
+
+gint lastfm_vfs_truncate_impl(VFSFile * file, glong size);
+
+off_t lastfm_vfs_fsize_impl(VFSFile * file);
+
+gint lastfm_vfs_fclose_impl(VFSFile * file);
+
+gchar *lastfm_vfs_metadata_impl(VFSFile * file, const gchar * field);
+
+static gboolean lastfm_get_metadata(LastFM * handle);
+
+static gboolean lastfm_login(void);
+
+LowlevelPlugin *get_lplugin_info(void);
+