summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Akhtar <bilalakhtar@ubuntu.com>2011-03-18 14:02:53 +0300
committerBilal Akhtar <bilalakhtar@ubuntu.com>2011-03-18 14:02:53 +0300
commit2debbc92898682dfe0c81f1ce4999175887ec922 (patch)
tree0ab29ed4f9b5e44b8a1f96be64d4b77d86d55bea
parentb21ab567f7df082fe563bba6c7a83bd51ebe3af1 (diff)
Imported Upstream version 2.4.4
-rwxr-xr-xconfigure24
-rw-r--r--configure.ac4
-rw-r--r--src/audacious/compatibility.h11
-rw-r--r--src/audacious/credits.c10
-rw-r--r--src/audacious/drct.c1
-rw-r--r--src/audacious/equalizer_preset.c24
-rw-r--r--src/audacious/interface.c2
-rw-r--r--src/audacious/main.c1
-rw-r--r--src/audacious/misc-api.h4
-rw-r--r--src/audacious/output.c4
-rw-r--r--src/audacious/playlist-new.c22
-rw-r--r--src/audacious/playlist-utils.c2
-rw-r--r--src/audacious/ui_preferences.c4
-rw-r--r--src/audacious/vis_runner.c1
-rw-r--r--src/libaudcore/vfs.h2
-rw-r--r--src/libaudcore/vfs_buffered_file.c20
-rw-r--r--src/libaudgui/infopopup.c1
-rw-r--r--src/libaudtag/id3/id3v1.c86
-rw-r--r--src/libaudtag/id3/id3v24.c12
-rw-r--r--src/libaudtag/util.c42
-rw-r--r--src/libaudtag/util.h2
-rw-r--r--src/libaudtag/wma/wma.c1
22 files changed, 152 insertions, 128 deletions
diff --git a/configure b/configure
index 7766fd9..0658a40 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for audacious 2.4.3.
+# Generated by GNU Autoconf 2.68 for audacious 2.4.4.
#
# Report bugs to <bugs+audacious@atheme.org>.
#
@@ -13,7 +13,7 @@
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
#
-# (C) 2005-2010 Audacious Development Team
+# (C) 2005-2011 Audacious Development Team
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
@@ -562,8 +562,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='audacious'
PACKAGE_TARNAME='audacious'
-PACKAGE_VERSION='2.4.3'
-PACKAGE_STRING='audacious 2.4.3'
+PACKAGE_VERSION='2.4.4'
+PACKAGE_STRING='audacious 2.4.4'
PACKAGE_BUGREPORT='bugs+audacious@atheme.org'
PACKAGE_URL=''
@@ -1391,7 +1391,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures audacious 2.4.3 to adapt to many kinds of systems.
+\`configure' configures audacious 2.4.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1457,7 +1457,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of audacious 2.4.3:";;
+ short | recursive ) echo "Configuration of audacious 2.4.4:";;
esac
cat <<\_ACEOF
@@ -1605,14 +1605,14 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-audacious configure 2.4.3
+audacious configure 2.4.4
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
-(C) 2005-2010 Audacious Development Team
+(C) 2005-2011 Audacious Development Team
_ACEOF
exit
fi
@@ -2068,7 +2068,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by audacious $as_me 2.4.3, which was
+It was created by audacious $as_me 2.4.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3940,7 +3940,7 @@ fi
PACKAGE=audacious
-VERSION=2.4.3
+VERSION=2.4.4
cat >>confdefs.h <<_ACEOF
@@ -10912,7 +10912,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by audacious $as_me 2.4.3, which was
+This file was extended by audacious $as_me 2.4.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -10978,7 +10978,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-audacious config.status 2.4.3
+audacious config.status 2.4.4
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 8ebdb1b..d039052 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,8 +6,8 @@ dnl Require autoconf 2.59 or later
AC_PREREQ([2.59])
dnl Initialize
-AC_INIT([audacious], [2.4.3], [bugs+audacious@atheme.org])
-AC_COPYRIGHT([(C) 2005-2010 Audacious Development Team])
+AC_INIT([audacious], [2.4.4], [bugs+audacious@atheme.org])
+AC_COPYRIGHT([(C) 2005-2011 Audacious Development Team])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_GNU_SOURCE
diff --git a/src/audacious/compatibility.h b/src/audacious/compatibility.h
index c20016c..6ea287c 100644
--- a/src/audacious/compatibility.h
+++ b/src/audacious/compatibility.h
@@ -1,8 +1,11 @@
-#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 14
- #define g_timeout_add_seconds(seconds, func, data) g_timeout_add \
- (1000 * (seconds), func, data)
+#if ! GLIB_CHECK_VERSION (2, 14, 0)
+#define G_QUEUE_INIT {NULL, NULL, 0}
+#define g_queue_clear(q) do {g_list_free ((q)->head); (q)->head = NULL; (q)->tail = NULL; (q)->length = 0;} while (0)
+#define g_timeout_add_seconds(s, f, d) g_timeout_add (1000 * (s), (f), (d))
#endif
+#ifdef GTK_CHECK_VERSION /* GTK headers included? */
+
#if ! GTK_CHECK_VERSION (2, 10, 0)
#define GDK_WINDOW_TYPE_HINT_TOOLTIP GDK_WINDOW_TYPE_HINT_MENU
#endif
@@ -19,3 +22,5 @@
#define gtk_widget_set_can_default(w, t) do {if (t) GTK_WIDGET_SET_FLAGS ((w), GTK_CAN_DEFAULT); else GTK_WIDGET_UNSET_FLAGS ((w), GTK_CAN_DEFAULT);} while (0)
#define gtk_widget_set_can_focus(w, t) do {if (t) GTK_WIDGET_SET_FLAGS ((w), GTK_CAN_FOCUS); else GTK_WIDGET_UNSET_FLAGS ((w), GTK_CAN_FOCUS);} while (0)
#endif
+
+#endif
diff --git a/src/audacious/credits.c b/src/audacious/credits.c
index 65f3853..74fbe34 100644
--- a/src/audacious/credits.c
+++ b/src/audacious/credits.c
@@ -30,7 +30,7 @@
static const gchar *audacious_brief =
N_("<big><b>Audacious %s</b></big>\n"
"An audio player for many platforms.\n"
- "Copyright (C) 2005-2010 Audacious Development Team");
+ "Copyright (C) 2005-2011 Audacious Development Team");
static const gchar *credit_text[] = {
N_("Core developers:"),
@@ -94,15 +94,15 @@ static const gchar *credit_text[] = {
"Mike Frysinger",
"Mark Glines",
"Hans de Goede",
+ "Michael Hanselmann",
+ "Juho Heikkinen",
+ "Joseph Jezak",
+ "Henrik Johansson",
"Jussi Judin",
"Teru Kamogashira",
"Chris Kehler",
"Mark Loeser",
"Alex Maclean",
- "Michael Hanselmann",
- "Juho Heikkinen",
- "Joseph Jezak",
- "Henrik Johansson",
"Mikael Magnusson",
"Rodrigo Martins de Matos Ventura",
"Diego Pettenò",
diff --git a/src/audacious/drct.c b/src/audacious/drct.c
index 79b17dd..95ba3e3 100644
--- a/src/audacious/drct.c
+++ b/src/audacious/drct.c
@@ -24,6 +24,7 @@
#include <libaudcore/vfs.h>
#include "audconfig.h"
+#include "compatibility.h"
#include "config.h"
#include "drct.h"
#include "i18n.h"
diff --git a/src/audacious/equalizer_preset.c b/src/audacious/equalizer_preset.c
index 48846dc..52605b3 100644
--- a/src/audacious/equalizer_preset.c
+++ b/src/audacious/equalizer_preset.c
@@ -98,8 +98,7 @@ equalizer_read_presets(const gchar *basename)
return list;
}
-void
-equalizer_write_preset_file(GList * list, const gchar * basename)
+gboolean equalizer_write_preset_file (GList * list, const gchar * basename)
{
gchar *filename, *tmp;
gint i, p;
@@ -136,11 +135,12 @@ equalizer_write_preset_file(GList * list, const gchar * basename)
filename = g_build_filename(aud_paths[BMP_PATH_USER_DIR], basename, NULL);
data = g_key_file_to_data(rcfile, &len, &error);
- g_file_set_contents(filename, data, len, &error);
+ gboolean success = g_file_set_contents (filename, data, len, & error);
g_free(data);
g_key_file_free(rcfile);
g_free(filename);
+ return success;
}
GList *
@@ -154,8 +154,9 @@ import_winamp_eqf(VFSFile * file)
gchar *markup;
gchar preset_name[0xb4];
- vfs_fread(header, 1, 31, file);
- if (strncmp(header, "Winamp EQ library file v1.1", 27)) goto error;
+ if (vfs_fread (header, 1, sizeof header, file) != sizeof header || strncmp
+ (header, "Winamp EQ library file v1.1", 27))
+ goto error;
AUDDBG("The EQF header is OK\n");
@@ -163,7 +164,8 @@ import_winamp_eqf(VFSFile * file)
while (vfs_fread(preset_name, 1, 0xb4, file) == 0xb4) {
AUDDBG("The preset name is '%s'\n", preset_name);
- vfs_fseek(file, 0x4d, SEEK_CUR); /* unknown crap --asphyx */
+ if (vfs_fseek (file, 0x4d, SEEK_CUR)) /* unknown crap --asphyx */
+ break;
if (vfs_fread(bands, 1, 11, file) != 11) break;
preset = equalizer_preset_new(preset_name);
@@ -190,9 +192,7 @@ error:
return NULL;
}
-/* This should not return void, as that makes reporting errors impossible. */
-void
-save_preset_file(EqualizerPreset *preset, const gchar * filename)
+gboolean save_preset_file (EqualizerPreset * preset, const gchar * filename)
{
GKeyFile *rcfile;
gint i;
@@ -212,15 +212,19 @@ save_preset_file(EqualizerPreset *preset, const gchar * filename)
data = g_key_file_to_data(rcfile, &len, &error);
+ gboolean success = FALSE;
+
VFSFile * file = vfs_fopen (filename, "w");
if (file == NULL)
goto DONE;
- vfs_fwrite (data, 1, strlen (data), file);
+ if (vfs_fwrite (data, 1, strlen (data), file) == strlen (data))
+ success = TRUE;
vfs_fclose (file);
DONE:
g_free(data);
g_key_file_free(rcfile);
+ return success;
}
static EqualizerPreset * equalizer_read_aud_preset (const gchar * filename)
diff --git a/src/audacious/interface.c b/src/audacious/interface.c
index 5fcf3ab..65aca42 100644
--- a/src/audacious/interface.c
+++ b/src/audacious/interface.c
@@ -53,7 +53,7 @@ static gboolean interface_search_cb (PluginHandle * plugin, PluginHandle * *
PluginHandle * interface_get_default (void)
{
- PluginHandle * plugin;
+ PluginHandle * plugin = NULL;
if (cfg.iface_path == NULL || (plugin = plugin_by_path (cfg.iface_path,
PLUGIN_TYPE_IFACE, cfg.iface_number)) == NULL || ! plugin_get_enabled
diff --git a/src/audacious/main.c b/src/audacious/main.c
index 8f671f5..3ce7c91 100644
--- a/src/audacious/main.c
+++ b/src/audacious/main.c
@@ -49,6 +49,7 @@
#include "audconfig.h"
#include "chardet.h"
+#include "compatibility.h"
#include "configdb.h"
#include "debug.h"
#include "drct.h"
diff --git a/src/audacious/misc-api.h b/src/audacious/misc-api.h
index 1144559..ec045c5 100644
--- a/src/audacious/misc-api.h
+++ b/src/audacious/misc-api.h
@@ -29,10 +29,10 @@ AUD_FUNC3 (void, get_audacious_credits, const gchar * *, brief,
/* equalizer_preset.c */
AUD_FUNC1 (GList *, equalizer_read_presets, const gchar *, basename)
-AUD_FUNC2 (void, equalizer_write_preset_file, GList *, list, const gchar *,
+AUD_FUNC2 (gboolean, equalizer_write_preset_file, GList *, list, const gchar *,
basename)
AUD_FUNC1 (EqualizerPreset *, load_preset_file, const gchar *, filename)
-AUD_FUNC2 (void, save_preset_file, EqualizerPreset *, preset, const gchar *,
+AUD_FUNC2 (gboolean, save_preset_file, EqualizerPreset *, preset, const gchar *,
filename)
AUD_FUNC1 (GList *, import_winamp_eqf, VFSFile *, file)
diff --git a/src/audacious/output.c b/src/audacious/output.c
index ef2bbff..cfa8572 100644
--- a/src/audacious/output.c
+++ b/src/audacious/output.c
@@ -419,7 +419,9 @@ static void output_write_audio (void * data, gint size)
}
apply_replay_gain (data, samples);
- effect_process ((gfloat * *) & data, & samples);
+ gfloat * fdata = data;
+ effect_process (& fdata, & samples);
+ data = fdata;
if (data != allocated)
{
diff --git a/src/audacious/playlist-new.c b/src/audacious/playlist-new.c
index 857009c..56fd746 100644
--- a/src/audacious/playlist-new.c
+++ b/src/audacious/playlist-new.c
@@ -1385,7 +1385,12 @@ static gint filename_compare (const void * _a, const void * _b, void * _compare)
const struct entry * a = _a, * b = _b;
gint (* compare) (const gchar * a, const gchar * b) = _compare;
- return compare (a->filename, b->filename);
+ gint diff = compare (a->filename, b->filename);
+ if (diff)
+ return diff;
+
+ /* preserve order of "equal" entries */
+ return a->number - b->number;
}
static gint tuple_compare (const void * _a, const void * _b, void * _compare)
@@ -1398,7 +1403,12 @@ static gint tuple_compare (const void * _a, const void * _b, void * _compare)
if (b->tuple == NULL)
return 1;
- return compare (a->tuple, b->tuple);
+ gint diff = compare (a->tuple, b->tuple);
+ if (diff)
+ return diff;
+
+ /* preserve order of "equal" entries */
+ return a->number - b->number;
}
static void sort (struct playlist * playlist, gint (* compare) (const void * a,
@@ -1846,14 +1856,14 @@ gboolean playlist_next_song(gint playlist_num, gboolean repeat)
if (entries == 0)
return FALSE;
- if (playlist->position != NULL && playlist->position->queued)
+ /* If we have a song in queue, jump to it, _then_ remove it from queue */
+ if (playlist->queued != NULL)
{
+ set_position (playlist, playlist->queued->data);
+
playlist->queued = g_list_remove(playlist->queued, playlist->position);
playlist->position->queued = FALSE;
}
-
- if (playlist->queued != NULL)
- set_position (playlist, playlist->queued->data);
else if (cfg.shuffle)
{
if (! shuffle_next (playlist))
diff --git a/src/audacious/playlist-utils.c b/src/audacious/playlist-utils.c
index 4db1da4..0c795c7 100644
--- a/src/audacious/playlist-utils.c
+++ b/src/audacious/playlist-utils.c
@@ -101,7 +101,7 @@ static gint tuple_compare_artist (const Tuple * a, const Tuple * b)
static gint tuple_compare_date (const Tuple * a, const Tuple * b)
{
- return tuple_compare_int (a, b, FIELD_MTIME);
+ return tuple_compare_int (a, b, FIELD_YEAR);
}
static gint tuple_compare_track (const Tuple * a, const Tuple * b)
diff --git a/src/audacious/ui_preferences.c b/src/audacious/ui_preferences.c
index d92ccc6..4d69b0b 100644
--- a/src/audacious/ui_preferences.c
+++ b/src/audacious/ui_preferences.c
@@ -99,7 +99,7 @@ typedef struct {
gint y;
} MenuPos;
-static GtkWidget *prefswin = NULL;
+static /* GtkWidget * */ void * prefswin = NULL;
static GtkWidget *filepopup_settings = NULL;
static GtkWidget *category_treeview = NULL;
static GtkWidget *category_notebook = NULL;
@@ -2657,7 +2657,7 @@ void * * create_prefs_window (void)
g_free(aud_version_string);
gtk_widget_show_all(vbox);
- return (void * *) & prefswin;
+ return & prefswin;
}
void
diff --git a/src/audacious/vis_runner.c b/src/audacious/vis_runner.c
index c0be9d5..8e3505a 100644
--- a/src/audacious/vis_runner.c
+++ b/src/audacious/vis_runner.c
@@ -22,6 +22,7 @@
#include <glib.h>
#include <libaudcore/hook.h>
+#include "compatibility.h"
#include "misc.h"
#include "output.h"
#include "vis_runner.h"
diff --git a/src/libaudcore/vfs.h b/src/libaudcore/vfs.h
index 3792780..da39157 100644
--- a/src/libaudcore/vfs.h
+++ b/src/libaudcore/vfs.h
@@ -95,7 +95,7 @@ struct _VFSConstructor {
};
#ifdef __GNUC__
-#define WARN_RETURN /* __attribute__ ((warn_unused_result)) */
+#define WARN_RETURN __attribute__ ((warn_unused_result))
#else
#define WARN_RETURN
#endif
diff --git a/src/libaudcore/vfs_buffered_file.c b/src/libaudcore/vfs_buffered_file.c
index 963754f..2264e15 100644
--- a/src/libaudcore/vfs_buffered_file.c
+++ b/src/libaudcore/vfs_buffered_file.c
@@ -62,7 +62,8 @@ gint64 buffered_file_vfs_fread_impl (void * i_ptr, gint64 size, gint64 nmemb,
(vfs_ftell(handle->buffer)) + (size * nmemb) >
((VFSBuffer *) handle->buffer->handle)->size)
{
- vfs_fseek(handle->fd, vfs_ftell(handle->buffer), SEEK_SET);
+ if (vfs_fseek (handle->fd, vfs_ftell (handle->buffer), SEEK_SET))
+ return 0;
handle->which = TRUE;
}
@@ -88,7 +89,8 @@ buffered_file_vfs_getc_impl(VFSFile *stream)
if ((vfs_ftell(handle->buffer)) + 1 >
((VFSBuffer *) handle->buffer->handle)->size)
{
- vfs_fseek(handle->fd, vfs_ftell(handle->buffer), SEEK_SET);
+ if (vfs_fseek (handle->fd, vfs_ftell (handle->buffer), SEEK_SET))
+ return EOF;
handle->which = TRUE;
}
@@ -108,19 +110,19 @@ buffered_file_vfs_fseek_impl(VFSFile * file,
{
VFSBufferedFile *handle = (VFSBufferedFile *) file->handle;
- vfs_fseek(handle->buffer, offset, whence);
+ if (vfs_fseek (handle->buffer, offset, whence))
+ return -1;
switch(whence)
{
case SEEK_END:
handle->which = TRUE;
- vfs_fseek(handle->fd, offset, whence);
- break;
+ return vfs_fseek (handle->fd, offset, whence);
case SEEK_CUR:
if (vfs_ftell(handle->buffer) + offset >= ((VFSBuffer *) handle->buffer->handle)->size)
{
handle->which = TRUE;
- vfs_fseek(handle->fd, offset, whence);
+ return vfs_fseek (handle->fd, offset, whence);
}
else
{
@@ -128,7 +130,7 @@ buffered_file_vfs_fseek_impl(VFSFile * file,
handle->which = FALSE;
noff = ((VFSBuffer *) handle->buffer->handle)->size - (vfs_ftell(handle->buffer) + offset);
- vfs_fseek(handle->buffer, noff, whence);
+ return vfs_fseek (handle->buffer, noff, whence);
}
break;
case SEEK_SET:
@@ -136,12 +138,12 @@ buffered_file_vfs_fseek_impl(VFSFile * file,
if (offset > ((VFSBuffer *) handle->buffer->handle)->size)
{
handle->which = TRUE;
- vfs_fseek(handle->fd, offset, whence);
+ return vfs_fseek (handle->fd, offset, whence);
}
else
{
handle->which = FALSE;
- vfs_fseek(handle->buffer, offset, whence);
+ return vfs_fseek (handle->buffer, offset, whence);
}
break;
}
diff --git a/src/libaudgui/infopopup.c b/src/libaudgui/infopopup.c
index 8debc03..55110af 100644
--- a/src/libaudgui/infopopup.c
+++ b/src/libaudgui/infopopup.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <audacious/audconfig.h>
+#include <audacious/compatibility.h>
#include <audacious/drct.h>
#include <audacious/i18n.h>
#include <audacious/misc.h>
diff --git a/src/libaudtag/id3/id3v1.c b/src/libaudtag/id3/id3v1.c
index 10342ff..6897d3e 100644
--- a/src/libaudtag/id3/id3v1.c
+++ b/src/libaudtag/id3/id3v1.c
@@ -1,5 +1,6 @@
/*
* Copyright 2010 Tony Vroon
+ * Copyright 2011 Michał Lipski <tallica@o2.pl>
*
* This file is part of Audacious.
*
@@ -32,19 +33,24 @@ static gboolean has_id3v1_ext;
gboolean id3v1_can_handle_file(VFSFile *f)
{
- gchar *tag = g_new0(gchar, 4);
+ gchar *tag;
if (vfs_fseek(f, -355, SEEK_END))
return FALSE;
+
tag = read_char_data(f, 4);
+
if (!strncmp(tag, "TAG+", 4))
has_id3v1_ext = TRUE;
else
has_id3v1_ext = FALSE;
+ g_free(tag);
if (vfs_fseek(f, -128, SEEK_END))
return FALSE;
+
tag = read_char_data(f, 3);
+
if (!strncmp(tag, "TAG", 3))
{
g_free(tag);
@@ -57,32 +63,30 @@ gboolean id3v1_can_handle_file(VFSFile *f)
static gchar *convert_to_utf8(gchar *str)
{
- return g_strchomp(str_to_utf8(str));
+ gchar *tmp = str;
+ str = str_to_utf8(str);
+ g_free(tmp);
+
+ return g_strchomp(str);
}
gboolean id3v1_read_tag (Tuple * tuple, VFSFile * f)
{
- gchar *title = g_new0(gchar, 30);
- gchar *artist = g_new0(gchar, 30);
- gchar *album = g_new0(gchar, 30);
- gchar *year = g_new0(gchar, 4);
- gchar *comment = g_new0(gchar, 30);
- gchar *track = g_new0(gchar, 1);
- gchar *genre = g_new0(gchar, 1);
gboolean genre_set = FALSE;
+
if (vfs_fseek(f, -125, SEEK_END))
return FALSE;
- title = read_char_data(f, 30);
- artist = read_char_data(f, 30);
- album = read_char_data(f, 30);
- year = read_char_data(f, 4);
- comment = read_char_data(f, 30);
- genre = read_char_data(f, 1);
+
+ gchar *title = read_char_data(f, 30);
+ gchar *artist = read_char_data(f, 30);
+ gchar *album = read_char_data(f, 30);
+ gchar *year = read_char_data(f, 4);
+ gchar *comment = read_char_data(f, 30);
+ gchar *genre = read_char_data(f, 1);
+ gchar track = 0;
if (comment[28] == 0 && comment[29] != 0)
- {
- *track = comment[29];
- }
+ track = comment[29];
title = convert_to_utf8(title);
artist = convert_to_utf8(artist);
@@ -91,27 +95,37 @@ gboolean id3v1_read_tag (Tuple * tuple, VFSFile * f)
if (has_id3v1_ext)
{
- vfs_fseek(f, -351, SEEK_END);
- gchar *tmp_title = g_strconcat(title, convert_to_utf8(read_char_data(f, 60)), NULL);
- gchar *tmp_artist = g_strconcat(artist, convert_to_utf8(read_char_data(f, 60)), NULL);
- gchar *tmp_album = g_strconcat(album, convert_to_utf8(read_char_data(f, 60)), NULL);
- vfs_fseek(f, -170, SEEK_END);
- gchar *tmp_genre = g_new0(gchar, 30);
- tmp_genre = convert_to_utf8(read_char_data(f, 30));
+ if (vfs_fseek (f, -351, SEEK_END))
+ goto ERR;
+
+ gchar *ext_title = convert_to_utf8(read_char_data(f, 60));
+ gchar *ext_artist = convert_to_utf8(read_char_data(f, 60));
+ gchar *ext_album = convert_to_utf8(read_char_data(f, 60));
+ gchar *tmp_title = g_strconcat(title, ext_title, NULL);
+ gchar *tmp_artist = g_strconcat(artist, ext_artist, NULL);
+ gchar *tmp_album = g_strconcat(album, ext_album, NULL);
g_free(title);
g_free(artist);
g_free(album);
+ g_free(ext_title);
+ g_free(ext_artist);
+ g_free(ext_album);
title = tmp_title;
artist = tmp_artist;
album = tmp_album;
- if (g_strcmp0(tmp_genre, NULL) == 1)
+ if (vfs_fseek (f, -170, SEEK_END))
+ goto ERR;
+
+ gchar *ext_genre = convert_to_utf8(read_char_data(f, 30));
+
+ if (ext_genre != NULL)
{
- tuple_associate_string(tuple, FIELD_GENRE, NULL, tmp_genre);
+ tuple_associate_string(tuple, FIELD_GENRE, NULL, ext_genre);
genre_set = TRUE;
}
- g_free(tmp_genre);
+ g_free(ext_genre);
}
tuple_associate_string(tuple, FIELD_TITLE, NULL, title);
@@ -119,18 +133,28 @@ gboolean id3v1_read_tag (Tuple * tuple, VFSFile * f)
tuple_associate_string(tuple, FIELD_ALBUM, NULL, album);
tuple_associate_int(tuple, FIELD_YEAR, NULL, atoi(year));
tuple_associate_string(tuple, FIELD_COMMENT, NULL, comment);
- tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, *track);
- if (!genre_set) tuple_associate_string(tuple, FIELD_GENRE, NULL, convert_numericgenre_to_text(*genre));
+ tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, track);
+
+ if (!genre_set)
+ tuple_associate_string(tuple, FIELD_GENRE, NULL, convert_numericgenre_to_text(*genre));
g_free(title);
g_free(artist);
g_free(album);
g_free(year);
g_free(comment);
- g_free(track);
g_free(genre);
return TRUE;
+
+ERR:
+ g_free (title);
+ g_free (artist);
+ g_free (album);
+ g_free (year);
+ g_free (comment);
+ g_free (genre);
+ return FALSE;
}
static gboolean id3v1_write_tag (const Tuple * tuple, VFSFile * handle)
diff --git a/src/libaudtag/id3/id3v24.c b/src/libaudtag/id3/id3v24.c
index 9d9d482..da1de0a 100644
--- a/src/libaudtag/id3/id3v24.c
+++ b/src/libaudtag/id3/id3v24.c
@@ -907,20 +907,20 @@ static gboolean id3v24_read_tag (Tuple * tuple, VFSFile * handle)
return TRUE;
}
-static gboolean parse_apic (const guchar * data, gint size, gchar * * mime,
+static gboolean parse_apic (const guchar * _data, gint size, gchar * * mime,
gint * type, gchar * * desc, void * * image_data, gint * image_size)
{
- const guchar * sep;
- const guchar * after;
+ const gchar * data = (const gchar *) _data;
+ const gchar * sep, * after;
if (size < 2 || (sep = memchr (data + 1, 0, size - 2)) == NULL)
return FALSE;
- if ((* desc = convert_text ((const gchar *) sep + 2, data + size - sep - 2,
- data[0], TRUE, NULL, (const gchar * *) & after)) == NULL)
+ if ((* desc = convert_text (sep + 2, data + size - sep - 2, data[0], TRUE,
+ NULL, & after)) == NULL)
return FALSE;
- * mime = g_strdup ((const gchar *) data + 1);
+ * mime = g_strdup (data + 1);
* type = sep[1];
* image_data = g_memdup (after, data + size - after);
* image_size = data + size - after;
diff --git a/src/libaudtag/util.c b/src/libaudtag/util.c
index 0cd4a75..73b33c1 100644
--- a/src/libaudtag/util.c
+++ b/src/libaudtag/util.c
@@ -124,10 +124,15 @@ void print_tuple(Tuple * tuple)
#endif
}
-gchar *read_char_data(VFSFile * fd, int size)
+gchar * read_char_data (VFSFile * file, int size)
{
- gchar *value = g_new0(gchar, size + 1);
- vfs_fread(value, size, 1, fd);
+ gchar * value = g_malloc (size + 1);
+ if (vfs_fread (value, 1, size, file) < size)
+ {
+ g_free (value);
+ return NULL;
+ }
+ value[size] = 0;
return value;
}
@@ -254,37 +259,6 @@ gboolean write_LEuint64(VFSFile * fd, guint64 val)
return (vfs_fwrite(&le_val, 8, 1, fd) == 8);
}
-void copyAudioToFile(VFSFile * from, VFSFile * to, guint32 pos)
-{
- vfs_fseek(from, pos, SEEK_SET);
- while (vfs_feof(from) == 0)
- {
- gchar buf[4096];
- gint n = vfs_fread(buf, 1, 4096, from);
- vfs_fwrite(buf, n, 1, to);
- }
-}
-
-void copyAudioData(VFSFile * from, VFSFile * to, guint32 pos_from, guint32 pos_to)
-{
- vfs_fseek(from, pos_from, SEEK_SET);
- int bytes_read = pos_from;
- while (bytes_read < pos_to - 4096)
- {
- gchar buf[4096];
- guint32 n = vfs_fread(buf, 1, 4096, from);
- vfs_fwrite(buf, n, 1, to);
- bytes_read += n;
- }
- if (bytes_read < pos_to)
- {
- guint32 buf_size = pos_to - bytes_read;
- gchar buf2[buf_size];
- int nn = vfs_fread(buf2, 1, buf_size, from);
- vfs_fwrite(buf2, nn, 1, to);
- }
-}
-
gboolean cut_beginning_tag (VFSFile * handle, gsize tag_size)
{
guchar buffer[16384];
diff --git a/src/libaudtag/util.h b/src/libaudtag/util.h
index 00ef6a1..7d9acc0 100644
--- a/src/libaudtag/util.h
+++ b/src/libaudtag/util.h
@@ -195,8 +195,6 @@ gboolean write_BEuint64(VFSFile *fd, guint64 val);
gboolean write_LEuint64(VFSFile *fd, guint64 val);
guint64 read_LEint64(VFSFile *fd);
-void copyAudioToFile(VFSFile *from, VFSFile *to, guint32 pos);
-void copyAudioData(VFSFile* from, VFSFile *to, guint32 pos_from, guint32 pos_to);
gboolean cut_beginning_tag (VFSFile * handle, gsize tag_size);
gchar *convert_numericgenre_to_text(gint numericgenre);
diff --git a/src/libaudtag/wma/wma.c b/src/libaudtag/wma/wma.c
index 67d5752..c307a7c 100644
--- a/src/libaudtag/wma/wma.c
+++ b/src/libaudtag/wma/wma.c
@@ -236,6 +236,7 @@ static long ftell_object_by_guid(VFSFile * f, GUID * g)
}
AUDDBG("The object was not found\n");
+ g_free(h);
return -1;
}