diff options
author | Tony Vroon <chainsaw@gentoo.org> | 2005-07-24 00:32:22 +0000 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2005-07-24 00:32:22 +0000 |
commit | 838e989dc08102fb4b662bfdc185130d4cb0fe9a (patch) | |
tree | 20a885a7c5c7e4a27876b4948d940d7bc3c382d1 | |
parent | version bump (diff) | |
download | gentoo-2-838e989dc08102fb4b662bfdc185130d4cb0fe9a.tar.gz gentoo-2-838e989dc08102fb4b662bfdc185130d4cb0fe9a.tar.bz2 gentoo-2-838e989dc08102fb4b662bfdc185130d4cb0fe9a.zip |
Revision bump, closes bug #94493 and #99882. -r5 ebuild cleaned.
(Portage version: 2.0.51.22-r2)
-rw-r--r-- | media-sound/beep-media-player/ChangeLog | 11 | ||||
-rw-r--r-- | media-sound/beep-media-player/Manifest | 36 | ||||
-rw-r--r-- | media-sound/beep-media-player/beep-media-player-0.9.7-r7.ebuild (renamed from media-sound/beep-media-player/beep-media-player-0.9.7-r5.ebuild) | 8 | ||||
-rw-r--r-- | media-sound/beep-media-player/files/0.9.7-ipv6.patch | 324 | ||||
-rw-r--r-- | media-sound/beep-media-player/files/0.9.7-unicode.patch | 588 | ||||
-rw-r--r-- | media-sound/beep-media-player/files/digest-beep-media-player-0.9.7-r7 (renamed from media-sound/beep-media-player/files/digest-beep-media-player-0.9.7-r5) | 0 |
6 files changed, 941 insertions, 26 deletions
diff --git a/media-sound/beep-media-player/ChangeLog b/media-sound/beep-media-player/ChangeLog index d7e04f9aa967..14a3aeff6d7e 100644 --- a/media-sound/beep-media-player/ChangeLog +++ b/media-sound/beep-media-player/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for media-sound/beep-media-player # Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-sound/beep-media-player/ChangeLog,v 1.60 2005/07/21 03:48:59 josejx Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-sound/beep-media-player/ChangeLog,v 1.61 2005/07/24 00:32:22 chainsaw Exp $ + +*beep-media-player-0.9.7-r7 (24 Jul 2005) + + 24 Jul 2005; Tony Vroon <chainsaw@gentoo.org> +files/0.9.7-ipv6.patch, + +files/0.9.7-unicode.patch, -beep-media-player-0.9.7-r5.ebuild, + +beep-media-player-0.9.7-r7.ebuild: + Revision bump. Proper IPv6 support in HTTP streams, closes bug #94493 (BMP + bug #293), patch by Christophe Saout. UTF16 support for ID3v2 tags, closes + bug #99882 (BMP bug #101). -r5 ebuild removed. 21 Jul 2005; Joseph Jezak <josejx@gentoo.org> beep-media-player-0.9.7-r6.ebuild: diff --git a/media-sound/beep-media-player/Manifest b/media-sound/beep-media-player/Manifest index 21d08f2aac4e..889b68c4dfad 100644 --- a/media-sound/beep-media-player/Manifest +++ b/media-sound/beep-media-player/Manifest @@ -1,27 +1,19 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -MD5 8a5f955ebad19283213a43024ab7b491 ChangeLog 10770 -MD5 658f1534562afc021618ff41dd2ee737 beep-media-player-0.9.7-r6.ebuild 2770 -MD5 319fe8f45b51a2d31f8d4e9a4071ca10 metadata.xml 248 MD5 ce8c0101520de38dfa531388e8e249bc beep-media-player-0.9.7-r4.ebuild 2657 -MD5 0ba359507ccc5af98b25adff15bd1249 beep-media-player-0.9.7-r5.ebuild 2771 -MD5 4fe36295e02a77ccc81d9f710ebcc9fb files/0.9.7-bogus-songinfo.patch 517 -MD5 8b9a3f5a01668b72272dc2f8b2969659 files/digest-beep-media-player-0.9.7-r5 62 +MD5 319fe8f45b51a2d31f8d4e9a4071ca10 metadata.xml 248 +MD5 8fe21958ecceee24edac5ed9a5877e49 ChangeLog 11194 +MD5 658f1534562afc021618ff41dd2ee737 beep-media-player-0.9.7-r6.ebuild 2770 +MD5 fbba3789cf517c2d94517d7de16e8567 beep-media-player-0.9.7-r7.ebuild 2851 MD5 d14dde91067c784f210c19e1e4024650 files/0.9.7-desktop-icon.patch 535 -MD5 e0224d7dcc5a2cb1af6ea6b18a6daea8 files/beep-config 3347 -MD5 8b9a3f5a01668b72272dc2f8b2969659 files/digest-beep-media-player-0.9.7-r4 62 +MD5 bea6e241ce4dae7a01125836fda25fcc files/0.9.7-bigendian.patch 315 +MD5 8b9a3f5a01668b72272dc2f8b2969659 files/digest-beep-media-player-0.9.7-r6 62 +MD5 0999b12310fd645562d8e5c26a7588d6 files/0.9.7-unicode.patch 16841 MD5 07dd84987f30f2cbb9ca16ec80cb6962 files/0.9.7-playlist-deadfile-delete.patch 540 -MD5 539d031b4930b4ce080fbe0804edfc28 files/0.9.7-window-focus.patch 850 +MD5 4fe36295e02a77ccc81d9f710ebcc9fb files/0.9.7-bogus-songinfo.patch 517 +MD5 8b9a3f5a01668b72272dc2f8b2969659 files/digest-beep-media-player-0.9.7-r4 62 +MD5 3f601435320f38af453b506ced22e342 files/0.9.7-ipv6.patch 10063 +MD5 8b9a3f5a01668b72272dc2f8b2969659 files/digest-beep-media-player-0.9.7-r7 62 +MD5 533bcd69c3357e3b6dd5b3a49afbb6bf files/0.9.7-noclick-resize.patch 974 MD5 893b0d5bce79831b0f71aae51af7440d files/0.9.7-vorbis-date.patch 637 MD5 32c2097467512370b951158b88abbeda files/0.9.7-hidden-window.patch 658 -MD5 533bcd69c3357e3b6dd5b3a49afbb6bf files/0.9.7-noclick-resize.patch 974 -MD5 bea6e241ce4dae7a01125836fda25fcc files/0.9.7-bigendian.patch 315 -MD5 8b9a3f5a01668b72272dc2f8b2969659 files/digest-beep-media-player-0.9.7-r6 62 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.1 (GNU/Linux) - -iD8DBQFC3xubcsIHjyDViGQRAt4WAJ46WIWhFV1dgOkB793HeB/W3c0n3gCgw7ln -49xq3QGDOwvJAo/C3uTgruE= -=yRbS ------END PGP SIGNATURE----- +MD5 e0224d7dcc5a2cb1af6ea6b18a6daea8 files/beep-config 3347 +MD5 539d031b4930b4ce080fbe0804edfc28 files/0.9.7-window-focus.patch 850 diff --git a/media-sound/beep-media-player/beep-media-player-0.9.7-r5.ebuild b/media-sound/beep-media-player/beep-media-player-0.9.7-r7.ebuild index bc2677690bc2..4ec991675cb8 100644 --- a/media-sound/beep-media-player/beep-media-player-0.9.7-r5.ebuild +++ b/media-sound/beep-media-player/beep-media-player-0.9.7-r7.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/media-sound/beep-media-player/beep-media-player-0.9.7-r5.ebuild,v 1.2 2005/06/13 19:58:10 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-sound/beep-media-player/beep-media-player-0.9.7-r7.ebuild,v 1.1 2005/07/24 00:32:22 chainsaw Exp $ IUSE="nls gnome mp3 oggvorbis alsa oss esd mmx old-eq" @@ -17,7 +17,7 @@ SRC_URI="mirror://sourceforge/beepmp/${MY_P}.tar.gz" LICENSE="GPL-2" SLOT="0" -KEYWORDS="~amd64 ~ppc ~sparc ~x86 ~hppa ~mips ~ppc64 ~alpha ~ia64" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" # beep-config has a runtime depend on pkg-config RDEPEND="app-arch/unzip @@ -43,12 +43,14 @@ src_unpack() { cd ${S} epatch ${FILESDIR}/${PV}-noclick-resize.patch - epatch ${FILESDIR}/${PV}-bigendian.patch epatch ${FILESDIR}/${PV}-desktop-icon.patch epatch ${FILESDIR}/${PV}-vorbis-date.patch epatch ${FILESDIR}/${PV}-hidden-window.patch epatch ${FILESDIR}/${PV}-playlist-deadfile-delete.patch epatch ${FILESDIR}/${PV}-window-focus.patch + epatch ${FILESDIR}/${PV}-bogus-songinfo.patch + epatch ${FILESDIR}/${PV}-ipv6.patch + epatch ${FILESDIR}/${PV}-unicode.patch elibtoolize } diff --git a/media-sound/beep-media-player/files/0.9.7-ipv6.patch b/media-sound/beep-media-player/files/0.9.7-ipv6.patch new file mode 100644 index 000000000000..12511bcd5460 --- /dev/null +++ b/media-sound/beep-media-player/files/0.9.7-ipv6.patch @@ -0,0 +1,324 @@ +diff -Nur bmp-0.9.7.orig/configure.ac bmp-0.9.7/configure.ac +--- bmp-0.9.7.orig/configure.ac 2004-12-02 22:12:54.000000000 +0100 ++++ bmp-0.9.7/configure.ac 2005-05-20 16:57:02.000000000 +0200 +@@ -191,6 +191,17 @@ + AM_CONDITIONAL(USE_SIMD, test "$USE_SIMD" = "yes") + AC_SUBST(USE_SIMD_TRUE) + ++dnl IPv6 support ++dnl ======================== ++AC_ARG_ENABLE(ipv6, ++ [ --enable-ipv6 enable IPv6 support (default=no)], ++ enable_ipv6=$enableval, enable_ipv6=no) ++if test "x$enable_ipv6" = xyes; then ++ AC_DEFINE(USE_IPV6,, [Define if building with IPv6 support] ) ++fi ++AM_CONDITIONAL(USE_IPV6,test "x$enable_ipv6" = xyes) ++AC_SUBST(USE_IPV6) ++ + + # Check if socklen_t is defined + +diff -Nur bmp-0.9.7.orig/Input/cdaudio/http.c bmp-0.9.7/Input/cdaudio/http.c +--- bmp-0.9.7.orig/Input/cdaudio/http.c 2004-06-20 20:48:50.000000000 +0200 ++++ bmp-0.9.7/Input/cdaudio/http.c 2005-05-20 17:01:59.000000000 +0200 +@@ -26,9 +26,45 @@ + http_open_connection(const gchar * server, gint port) + { + gint sock; ++#ifdef USE_IPV6 ++ struct addrinfo hints, *res, *res0; ++ char service[6]; ++#else + struct hostent *host; + struct sockaddr_in address; ++#endif + ++#ifdef USE_IPV6 ++ snprintf(service, 6, "%d", port); ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_socktype = SOCK_STREAM; ++ ++ if (getaddrinfo(server, service, &hints, &res0)) ++ return 0; ++ ++ for (res = res0; res; res = res->ai_next) { ++ sock = socket (res->ai_family, res->ai_socktype, res->ai_protocol); ++ if (sock < 0) { ++ if (res->ai_next) ++ continue; ++ else { ++ freeaddrinfo(res0); ++ return 0; ++ } ++ } ++ if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { ++ if (res->ai_next) { ++ close(sock); ++ continue; ++ } else { ++ freeaddrinfo(res0); ++ return 0; ++ } ++ } ++ freeaddrinfo(res0); ++ return sock; ++ } ++#else + sock = socket(AF_INET, SOCK_STREAM, 0); + address.sin_family = AF_INET; + +@@ -43,6 +79,7 @@ + (sock, (struct sockaddr *) &address, + sizeof(struct sockaddr_in)) == -1) + return 0; ++#endif + + return sock; + } +diff -Nur bmp-0.9.7.orig/Input/mpg123/http.c bmp-0.9.7/Input/mpg123/http.c +--- bmp-0.9.7.orig/Input/mpg123/http.c 2004-12-04 10:29:05.000000000 +0100 ++++ bmp-0.9.7/Input/mpg123/http.c 2005-05-20 17:20:43.000000000 +0200 +@@ -345,8 +345,13 @@ + gboolean redirect; + gint udp_sock = 0; + fd_set set; ++#ifdef USE_IPV6 ++ struct addrinfo hints, *res, *res0; ++ char service[6]; ++#else + struct hostent *hp; + struct sockaddr_in address; ++#endif + struct timeval tv; + + url = (gchar *) arg; +@@ -367,6 +372,45 @@ + chost = mpg123_cfg.use_proxy ? mpg123_cfg.proxy_host : host; + cport = mpg123_cfg.use_proxy ? mpg123_cfg.proxy_port : port; + ++#ifdef USE_IPV6 ++ snprintf(service, 6, "%d", cport); ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_socktype = SOCK_STREAM; ++ if (! getaddrinfo(chost, service, &hints, &res0)) { ++ eof = TRUE; ++ for (res = res0; res; res = res->ai_next) { ++ if ((sock = socket (res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) ++ continue; ++ fcntl(sock, F_SETFL, O_NONBLOCK); ++ status = g_strdup_printf(_("CONNECTING TO %s:%d"), chost, cport); ++ mpg123_ip.set_info_text(status); ++ g_free(status); ++ ((struct sockaddr_in6 *)res->ai_addr)->sin6_port = htons(cport); ++ if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { ++ if (errno != EINPROGRESS) { ++ close(sock); ++ continue; ++ } ++ } ++ eof = FALSE; ++ break; ++ } ++ freeaddrinfo(res0); ++ if (eof) { ++ status = g_strdup_printf(_("Couldn't connect to host %s:%d"), chost, cport); ++ show_error_message(status); ++ g_free(status); ++ mpg123_ip.set_info_text(NULL); ++ } ++ } else { ++ status = g_strdup_printf(_("Couldn't look up host %s"), chost); ++ show_error_message(status); ++ g_free(status); ++ ++ mpg123_ip.set_info_text(NULL); ++ eof = TRUE; ++ } ++#else + sock = socket(AF_INET, SOCK_STREAM, 0); + fcntl(sock, F_SETFL, O_NONBLOCK); + address.sin_family = AF_INET; +@@ -383,8 +427,10 @@ + mpg123_ip.set_info_text(NULL); + eof = TRUE; + } ++#endif + + if (!eof) { ++#ifndef USE_IPV6 + memcpy(&address.sin_addr.s_addr, *(hp->h_addr_list), + sizeof(address.sin_addr.s_addr)); + address.sin_port = g_htons(cport); +@@ -406,6 +452,7 @@ + eof = TRUE; + } + } ++#endif + while (going) { + tv.tv_sec = 0; + tv.tv_usec = 10000; +@@ -710,22 +757,35 @@ + static gint + udp_establish_listener(gint * sock) + { ++#ifdef USE_IPV6 ++ struct sockaddr_in6 sin; ++ socklen_t sinlen = sizeof(struct sockaddr_in6); ++#else + struct sockaddr_in sin; + socklen_t sinlen = sizeof(struct sockaddr_in); ++#endif + + #ifdef DEBUG_UDP + fprintf(stderr, "Establishing udp listener\n"); + #endif + ++#ifdef USE_IPV6 ++ if ((*sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { ++#else + if ((*sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { ++#endif + g_log(NULL, G_LOG_LEVEL_CRITICAL, + "udp_establish_listener(): unable to create socket"); + return -1; + } + + memset(&sin, 0, sinlen); ++#ifdef USE_IPV6 ++ sin.sin6_family = AF_INET6; ++#else + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = g_htonl(INADDR_ANY); ++#endif + + if (bind(*sock, (struct sockaddr *) &sin, sinlen) < 0) { + g_log(NULL, G_LOG_LEVEL_CRITICAL, +@@ -755,7 +815,11 @@ + g_ntohs(sin.sin_port)); + #endif + ++#ifdef USE_IPV6 ++ return g_ntohs(sin.sin6_port); ++#else + return g_ntohs(sin.sin_port); ++#endif + } + + static int +@@ -765,10 +829,14 @@ + char *valptr; + gchar *title; + gint len, i; ++#ifdef USE_IPV6 ++ struct sockaddr_in6 from; ++#else + struct sockaddr_in from; ++#endif + socklen_t fromlen; + +- fromlen = sizeof(struct sockaddr_in); ++ fromlen = sizeof from; + + if ((len = + recvfrom(sock, buf, 1024, 0, (struct sockaddr *) &from, +@@ -850,9 +918,18 @@ + #ifdef DEBUG_UDP + else + fprintf(stderr, "Sent ack: %s", obuf); ++#ifdef USE_IPV6 ++ { ++ char adr[INET6_ADDRSTRLEN]; ++ inet_ntop(AF_INET6, &from.sin6_addr, adr, INET6_ADDRSTRLEN); ++ fprintf(stderr, "Remote: [%s]:%d\n", adr, ++ g_ntohs(from.sin6_port)); ++ } ++#else + fprintf(stderr, "Remote: %s:%d\n", inet_ntoa(from.sin_addr), + g_ntohs(from.sin_port)); + #endif ++#endif + } + } + g_strfreev(lines); +diff -Nur bmp-0.9.7.orig/Input/vorbis/http.c bmp-0.9.7/Input/vorbis/http.c +--- bmp-0.9.7.orig/Input/vorbis/http.c 2004-12-04 10:29:06.000000000 +0100 ++++ bmp-0.9.7/Input/vorbis/http.c 2005-05-20 17:16:39.000000000 +0200 +@@ -297,8 +297,13 @@ + gint cnt, written, error, err_len, port, cport; + gboolean redirect; + fd_set set; ++#ifdef USE_IPV6 ++ struct addrinfo hints, *res, *res0; ++ char service[6]; ++#else + struct hostent *hp; + struct sockaddr_in address; ++#endif + struct timeval tv; + + url = (gchar *) arg; +@@ -319,6 +324,44 @@ + chost = vorbis_cfg.use_proxy ? vorbis_cfg.proxy_host : host; + cport = vorbis_cfg.use_proxy ? vorbis_cfg.proxy_port : port; + ++#ifdef USE_IPV6 ++ snprintf(service, 6, "%d", cport); ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_socktype = SOCK_STREAM; ++ if (! getaddrinfo(chost, service, &hints, &res0)) { ++ eof = TRUE; ++ for (res = res0; res; res = res->ai_next) { ++ if ((sock = socket (res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) ++ continue; ++ fcntl(sock, F_SETFL, O_NONBLOCK); ++ status = g_strdup_printf(_("CONNECTING TO %s:%d"), chost, cport); ++ vorbis_ip.set_info_text(status); ++ g_free(status); ++ ((struct sockaddr_in6 *)res->ai_addr)->sin6_port = htons(cport); ++ if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { ++ if (errno != EINPROGRESS) { ++ close(sock); ++ continue; ++ } ++ } ++ eof = FALSE; ++ break; ++ } ++ freeaddrinfo(res0); ++ if (eof) { ++ status = g_strdup_printf(_("Couldn't connect to host %s:%d"), chost, cport); ++ vorbis_ip.set_info_text(status); ++ g_free(status); ++ eof = TRUE; ++ break; ++ } ++ } else { ++ status = g_strdup_printf(_("Couldn't look up host %s"), chost); ++ vorbis_ip.set_info_text(status); ++ g_free(status); ++ eof = TRUE; ++ } ++#else + sock = socket(AF_INET, SOCK_STREAM, 0); + fcntl(sock, F_SETFL, O_NONBLOCK); + address.sin_family = AF_INET; +@@ -335,8 +378,10 @@ + vorbis_ip.set_info_text(NULL); + eof = TRUE; + } ++#endif + + if (!eof) { ++#ifndef USE_IPV6 + memcpy(&address.sin_addr.s_addr, *(hp->h_addr_list), + sizeof(address.sin_addr.s_addr)); + address.sin_port = g_htons(cport); +@@ -358,6 +403,7 @@ + eof = TRUE; + } + } ++#endif + while (going) { + tv.tv_sec = 0; + tv.tv_usec = 10000; diff --git a/media-sound/beep-media-player/files/0.9.7-unicode.patch b/media-sound/beep-media-player/files/0.9.7-unicode.patch new file mode 100644 index 000000000000..b77447efa066 --- /dev/null +++ b/media-sound/beep-media-player/files/0.9.7-unicode.patch @@ -0,0 +1,588 @@ +diff -r -U3 bmp-0.9.7.orig/Input/mpg123/id3_frame_content.c bmp-0.9.7/Input/mpg123/id3_frame_content.c +--- bmp-0.9.7.orig/Input/mpg123/id3_frame_content.c 2005-02-25 21:45:03.000000000 -0500 ++++ bmp-0.9.7/Input/mpg123/id3_frame_content.c 2005-02-25 21:56:14.000000000 -0500 +@@ -44,9 +44,7 @@ + char * + id3_get_content(struct id3_frame *frame) + { +- char *text, *text_beg, *ptr; +- char buffer[256]; +- int spc = sizeof(buffer) - 1; ++ gchar *text, *text_it; + + /* Type check */ + if (frame->fr_desc->fd_id != ID3_TCON) +@@ -56,83 +54,82 @@ + if (id3_decompress_frame(frame) == -1) + return NULL; + +- if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1) +- text_beg = text = g_strdup((char *) frame->fr_data + 1); +- else +- text_beg = text = id3_utf16_to_ascii((char *) frame->fr_data + 1); +- +- /* +- * If content is just plain text, return it. +- */ +- if (text[0] != '(') { +- return text; +- } +- ++ ID3_FRAME_DEFINE_CURSOR(frame); ++ ++ guint8 encoding; ++ ID3_FRAME_READ_OR_RETVAL(encoding, NULL); ++ ++ text = text_it = id3_string_decode(encoding, cursor, length); ++ ++ if (text == NULL) ++ return NULL; ++ + /* + * Expand ID3v1 genre numbers. + */ +- ptr = buffer; +- while (text[0] == '(' && text[1] != '(' && spc > 0) { +- const char *genre; +- int num = 0; +- +- if (text[1] == 'R' && text[2] == 'X') { +- text += 4; +- genre = _(" (Remix)"); +- if (ptr == buffer) +- genre++; +- ++ while ((text_it = strstr(text_it, "(")) != NULL) ++ { ++ gchar* replace = NULL; ++ gchar* ref_start = text_it + 1; ++ ++ if (*ref_start == ')') ++ { ++ /* False alarm */ ++ ++text_it; ++ continue; + } +- else if (text[1] == 'C' && text[2] == 'R') { +- text += 4; +- genre = _(" (Cover)"); +- if (ptr == buffer) +- genre++; +- ++ ++ gsize ref_size = strstr(ref_start, ")") - ref_start; ++ ++ if (strncmp(ref_start, "RX", ref_size) == 0) ++ { ++ replace = _("Remix"); + } +- else { +- /* Get ID3v1 genre number */ +- text++; +- while (*text != ')') { +- num *= 10; +- num += *text++ - '0'; ++ else if (strncmp(ref_start, "CR", ref_size) == 0) ++ { ++ replace = _("Cover"); ++ } ++ else ++ { ++ /* Maybe an ID3v1 genre? */ ++ int genre_number; ++ gchar* genre_number_str = g_strndup(ref_start, ref_size); ++ if (sscanf(genre_number_str, "%d", &genre_number) > 0) ++ { ++ /* Boundary check */ ++ if (genre_number >= sizeof(mpg123_id3_genres) / sizeof(char *)) ++ continue; ++ replace = gettext(mpg123_id3_genres[genre_number]); + } +- text++; +- +- /* Boundary check */ +- if (num >= sizeof(mpg123_id3_genres) / sizeof(char *)) +- continue; +- +- genre = gettext(mpg123_id3_genres[num]); +- +- if (ptr != buffer && spc-- > 0) +- *ptr++ = '/'; + } + +- /* Expand string into buffer */ +- while (*genre != '\0' && spc > 0) { +- *ptr++ = *genre++; +- spc--; ++ if (replace != NULL) ++ { ++ /* Amazingly hairy code to replace a part of the original genre string ++ with 'replace'. */ ++ gchar* copy = g_malloc(strlen(text) - ref_size + strlen(replace) + 1); ++ gsize pos = 0; ++ gsize copy_size; ++ ++ /* Copy the part before the replaced part */ ++ copy_size = ref_start - text; ++ memcpy(copy + pos, text, copy_size); ++ pos += copy_size; ++ /* Copy the replacement instead of the original reference */ ++ copy_size = strlen(replace); ++ memcpy(copy + pos, replace, copy_size); ++ pos += copy_size; ++ /* Copy the rest, including the null */ ++ memcpy(copy + pos, ref_start + ref_size, strlen(ref_start + ref_size)+1); ++ ++ /* Put into original variables */ ++ gsize offset = text_it - text; ++ g_free(text); ++ text = copy; ++ text_it = text + offset; + } ++ ++ ++text_it; + } +- +- /* +- * Add plaintext refinement. +- */ +- if (*text == '(') +- text++; +- if (*text != '\0' && ptr != buffer && spc-- > 0) +- *ptr++ = ' '; +- while (*text != '\0' && spc > 0) { +- *ptr++ = *text++; +- spc--; +- } +- *ptr = '\0'; +- +- g_free(text_beg); +- +- /* +- * Return the expanded content string. +- */ +- return g_strdup(buffer); ++ return text; + } +diff -r -U3 bmp-0.9.7.orig/Input/mpg123/id3_frame_text.c bmp-0.9.7/Input/mpg123/id3_frame_text.c +--- bmp-0.9.7.orig/Input/mpg123/id3_frame_text.c 2005-02-25 21:45:03.000000000 -0500 ++++ bmp-0.9.7/Input/mpg123/id3_frame_text.c 2005-02-26 01:25:45.613011872 -0500 +@@ -35,21 +35,6 @@ + #include "id3_header.h" + + +-char * +-id3_utf16_to_ascii(void *utf16) +-{ +- char ascii[256]; +- char *uc = (char *) utf16 + 2; +- int i; +- +- for (i = 0; *uc != 0 && i < sizeof(ascii); i++, uc += 2) +- ascii[i] = *uc; +- +- ascii[i] = 0; +- return g_strdup(ascii); +-} +- +- + /* + * Function id3_get_encoding (frame) + * +@@ -78,7 +63,12 @@ + if (id3_decompress_frame(frame) == -1) + return -1; + +- return *(gint8 *) frame->fr_data; ++ ID3_FRAME_DEFINE_CURSOR(frame); ++ ++ guint8 encoding; ++ ID3_FRAME_READ_OR_RETVAL(encoding, -1); ++ ++ return encoding; + } + + +@@ -119,6 +109,108 @@ + return 0; + } + ++/* Get size of string in bytes including null. */ ++gsize id3_string_size(guint8 encoding, const void* text, gsize max_size) ++{ ++ switch ( encoding ) { ++ case ID3_ENCODING_ISO_8859_1: ++ case ID3_ENCODING_UTF8: ++ { ++ const guint8* text8 = text; ++ while ( (max_size >= sizeof(*text8)) && (*text8 != 0) ) ++ { ++ ++text8; ++ max_size -= sizeof(*text8); ++ } ++ ++ if (max_size >= sizeof(*text8)) ++ { ++ ++text8; ++ max_size -= sizeof(*text8); ++ } ++ ++ return text8 - (guint8*)text; ++ } ++ case ID3_ENCODING_UTF16: ++ case ID3_ENCODING_UTF16BE: ++ { ++ const guint16* text16 = (guint16*)text; ++ while ( (max_size > 0) && (*text16 != 0) ) ++ { ++ ++text16; ++ max_size -= sizeof(*text16); ++ } ++ ++ if (max_size > 0) ++ { ++ ++text16; ++ max_size -= sizeof(*text16); ++ } ++ ++ return (guint8*)text16 - (guint8*)text; ++ } ++ default: ++ return 0; ++ } ++} ++ ++/* ++ * Returns a newly-allocated UTF-8 string in the locale's encoding. ++ * max_size specifies the maximum size of 'text', including terminating nulls. ++ */ ++gchar* id3_string_decode(guint8 encoding, const void* text, gsize max_size) ++{ ++ /* Otherwise, we'll end up passing -1 to functions, eliminating safety benefits. */ ++ if (max_size <= 0) ++ return NULL; ++ ++ switch( encoding ) ++ { ++ case ID3_ENCODING_ISO_8859_1: ++ { ++ return g_locale_to_utf8((const gchar*)text, max_size, NULL, NULL, NULL); ++ } ++ case ID3_ENCODING_UTF8: ++ { ++ gchar* end_text = (gchar*)text; ++ if (g_utf8_validate((const gchar*)text, max_size, &end_text)) ++ return g_strndup((const gchar*)text, max_size); ++ else ++ { ++ /* g_utf8_validate() with second argument positive ++ will return 0 if the string contains nulls. Frequently ++ someone will pass us a valid null-terminated utf8 ++ string, with max_size overestimated a bit; so we need ++ to run another test to truly check validity */ ++ if((end_text != text) && (*end_text == NULL) && ++ g_utf8_validate((const gchar*)text, NULL, NULL)) ++ return g_strndup((const gchar*)text, max_size); ++ ++ return NULL; ++ } ++ } ++ case ID3_ENCODING_UTF16: ++ { ++ gsize size_bytes = id3_string_size(encoding, text, max_size); ++ gchar* utf8 = g_convert((const gchar*)text, size_bytes, "UTF-8", "UTF-16", NULL, NULL, NULL); ++ /* If conversion passes on the BOM as-is, we strip it. */ ++ if (g_utf8_get_char(utf8) == 0xfeff) ++ { ++ gchar* new_utf8 = g_strdup(utf8+3); ++ g_free(utf8); ++ utf8 = new_utf8; ++ } ++ return utf8; ++ } ++ case ID3_ENCODING_UTF16BE: ++ { ++ gsize size_bytes = id3_string_size(encoding, text, max_size); ++ return g_convert((const gchar*)text, size_bytes, "UTF-8", "UTF-16BE", NULL, NULL, NULL); ++ } ++ default: ++ return NULL; ++ } ++} + + /* + * Function id3_get_text (frame) +@@ -137,38 +229,21 @@ + if (id3_decompress_frame(frame) == -1) + return NULL; + ++ ID3_FRAME_DEFINE_CURSOR(frame); ++ ++ guint8 encoding; ++ ID3_FRAME_READ_OR_RETVAL(encoding, NULL); ++ + if (frame->fr_desc->fd_id == ID3_TXXX || frame->fr_desc->fd_id == ID3_COMM) { + /* + * This is a user defined text frame. Skip the description. + */ +- switch (*(guint8 *) frame->fr_data) { +- case ID3_ENCODING_ISO_8859_1: +- { +- char *text = (char *) frame->fr_data + 1; +- +- while (*text != 0) +- text++; +- +- return g_strdup(++text); +- } +- case ID3_ENCODING_UTF16: +- { +- char *text16 = (char *) frame->fr_data + 1; +- +- while (*text16 != 0 || *(text16 + 1) != 0) +- text16 += 2; +- +- return id3_utf16_to_ascii(text16 + 2); +- } +- default: +- return NULL; +- } ++ gsize bytes = id3_string_size(encoding, cursor, length); ++ cursor += bytes; ++ length -= bytes; + } + +- if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1) +- return g_strdup((char *) frame->fr_data + 1); +- else +- return id3_utf16_to_ascii(((char *) frame->fr_data + 1)); ++ return id3_string_decode(encoding, cursor, length); + } + + +@@ -193,10 +268,12 @@ + if (id3_decompress_frame(frame) == -1) + return NULL; + +- if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1) +- return g_strdup((char *) frame->fr_data + 1); +- else +- return id3_utf16_to_ascii((char *) frame->fr_data + 1); ++ ID3_FRAME_DEFINE_CURSOR(frame); ++ ++ guint8 encoding; ++ ID3_FRAME_READ_OR_RETVAL(encoding, NULL); ++ ++ return id3_string_decode(encoding, cursor, length); + } + + +@@ -216,41 +293,19 @@ + if (id3_decompress_frame(frame) == -1) + return -1; + +- /* +- * Generate integer according to encoding. +- */ +- switch (*(guint8 *) frame->fr_data) { +- case ID3_ENCODING_ISO_8859_1: +- { +- char *text = ((char *) frame->fr_data) + 1; +- +- while (*text >= '0' && *text <= '9') { +- number *= 10; +- number += *text - '0'; +- text++; +- } +- +- return number; +- } +- case ID3_ENCODING_UTF16: +- { +- char *text = ((char *) frame->fr_data) + 3; +- +-/* if (*(gint16 *) frame->fr_data == 0xfeff) */ +-/* text++; */ +- +- while (*text >= '0' && *text <= '9') { +- number *= 10; +- number += *text - '0'; +- text++; +- } +- +- return number; +- } +- +- default: +- return -1; +- } ++ ID3_FRAME_DEFINE_CURSOR(frame); ++ ++ guint8 encoding; ++ ID3_FRAME_READ_OR_RETVAL(encoding, number); ++ ++ gchar* number_str = id3_string_decode(encoding, cursor, length); ++ if (number_str != NULL) ++ { ++ sscanf(number_str, "%d", &number); ++ g_free(number_str); ++ } ++ ++ return number; + } + + +@@ -306,7 +361,6 @@ + id3_set_text_number(struct id3_frame *frame, int number) + { + char buf[64]; +- int pos; + char *text; + + /* Type check */ +@@ -321,20 +375,12 @@ + /* + * Create a string with a reversed number. + */ +- pos = 0; +- while (number > 0 && pos < 64) { +- buf[pos++] = (number % 10) + '0'; +- number /= 10; +- } +- if (pos == 64) +- return -1; +- if (pos == 0) +- buf[pos++] = '0'; ++ snprintf(buf, sizeof(buf), "%d", number); + + /* + * Allocate memory for new data. + */ +- frame->fr_raw_size = pos + 1; ++ frame->fr_raw_size = strlen(buf) + 1; + frame->fr_raw_data = g_malloc(frame->fr_raw_size + 1); + + /* +@@ -342,9 +388,7 @@ + */ + *(gint8 *) frame->fr_raw_data = ID3_ENCODING_ISO_8859_1; + text = (char *) frame->fr_raw_data + 1; +- while (--pos >= 0) +- *text++ = buf[pos]; +- *text = '\0'; ++ strcpy(text, buf); + + frame->fr_altered = 1; + frame->fr_owner->id3_altered = 1; +diff -r -U3 bmp-0.9.7.orig/Input/mpg123/id3_frame_url.c bmp-0.9.7/Input/mpg123/id3_frame_url.c +--- bmp-0.9.7.orig/Input/mpg123/id3_frame_url.c 2005-02-25 21:45:03.000000000 -0500 ++++ bmp-0.9.7/Input/mpg123/id3_frame_url.c 2005-02-25 22:15:28.000000000 -0500 +@@ -48,36 +48,26 @@ + /* Check if frame is compressed */ + if (id3_decompress_frame(frame) == -1) + return NULL; +- +- if (frame->fr_desc->fd_id == ID3_WXXX) { ++ ++ ID3_FRAME_DEFINE_CURSOR(frame); ++ ++ if ( frame->fr_desc->fd_id == ID3_WXXX ) { + /* + * This is a user defined link frame. Skip the description. + */ +- switch (*(guint8 *) frame->fr_data) { +- case ID3_ENCODING_ISO_8859_1: +- { +- char *text = (char *) frame->fr_data + 1; +- +- while (*text != 0) +- text++; +- +- return g_strdup(++text); +- } +- case ID3_ENCODING_UTF16: +- { +- gint16 *text16 = (gint16 *) ((glong) frame->fr_data + 1); +- +- while (*text16 != 0) +- text16++; +- +- return g_strdup((char *) (++text16)); +- } +- default: ++ guint8 encoding; ++ gsize description_size; ++ ++ ID3_FRAME_READ_OR_RETVAL(encoding, NULL); ++ ++ description_size = id3_string_size(encoding, cursor, length); ++ if (description_size == 0) + return NULL; +- } ++ cursor += description_size; ++ length -= description_size; + } + +- return g_strdup((char *) frame->fr_data); ++ return id3_string_decode(ID3_ENCODING_ISO_8859_1, cursor, length); + } + + +@@ -102,8 +92,10 @@ + if (id3_decompress_frame(frame) == -1) + return NULL; + +- if (*(guint8 *) frame->fr_data == ID3_ENCODING_ISO_8859_1) +- return g_strdup((char *) frame->fr_data + 1); +- else +- return id3_utf16_to_ascii((gint16 *) ((glong) frame->fr_data + 1)); ++ ID3_FRAME_DEFINE_CURSOR(frame); ++ ++ guint8 encoding; ++ ID3_FRAME_READ_OR_RETVAL(encoding, NULL); ++ ++ return id3_string_decode(encoding, cursor, length); + } +diff -r -U3 bmp-0.9.7.orig/Input/mpg123/xmms-id3.h bmp-0.9.7/Input/mpg123/xmms-id3.h +--- bmp-0.9.7.orig/Input/mpg123/xmms-id3.h 2005-02-25 21:45:03.000000000 -0500 ++++ bmp-0.9.7/Input/mpg123/xmms-id3.h 2005-02-25 21:49:22.000000000 -0500 +@@ -29,6 +29,7 @@ + #define ID3_H + + #include <glib.h> ++#include <string.h> + #include <libbeep/vfs.h> + + /* +@@ -318,6 +319,21 @@ + #define ID3_WPB ID3_FRAME_ID_22('W', 'P', 'B') + #define ID3_WXX ID3_FRAME_ID_22('W', 'X', 'X') + ++/* ++ * Handy macros which help us writing more secure length-aware code ++ * which involves reading the frame's data buffer. ++ */ ++ ++#define ID3_FRAME_DEFINE_CURSOR(frame) \ ++ gsize length = frame->fr_size; \ ++ guint8* cursor = frame->fr_data; ++ ++#define ID3_FRAME_READ_OR_RETVAL(variable, retval) \ ++ if (length < sizeof(variable)) \ ++ return retval; \ ++ memcpy((void*)&variable, (void*)cursor, sizeof(variable)); \ ++ cursor += sizeof(variable); \ ++ length -= sizeof(variable); + + /* + * Prototypes. +@@ -343,7 +359,8 @@ + void id3_frame_clear_data(struct id3_frame *frame); + + /* From id3_frame_text.c */ +-char *id3_utf16_to_ascii(void *); ++gsize id3_string_size(guint8 encoding, const void* text, gsize max_size); ++gchar* id3_string_decode(guint8 encoding, const void* text, gsize max_size); + gint8 id3_get_encoding(struct id3_frame *); + int id3_set_encoding(struct id3_frame *, gint8); + char *id3_get_text(struct id3_frame *); diff --git a/media-sound/beep-media-player/files/digest-beep-media-player-0.9.7-r5 b/media-sound/beep-media-player/files/digest-beep-media-player-0.9.7-r7 index c8dccff861f8..c8dccff861f8 100644 --- a/media-sound/beep-media-player/files/digest-beep-media-player-0.9.7-r5 +++ b/media-sound/beep-media-player/files/digest-beep-media-player-0.9.7-r7 |