SHA256
1
0
forked from pool/libid3tag
OBS User unknown 2007-01-15 23:22:10 +00:00 committed by Git OBS Bridge
commit 8225bace8f
11 changed files with 471 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

212
libid3tag-0.15.1b-mb.diff Normal file
View File

@ -0,0 +1,212 @@
--- id3tag.h-dist 2004-02-26 12:40:29.000000000 +0100
+++ id3tag.h 2004-02-26 12:40:36.000000000 +0100
@@ -273,7 +273,7 @@
signed long id3_tag_query(id3_byte_t const *, id3_length_t);
struct id3_tag *id3_tag_parse(id3_byte_t const *, id3_length_t);
-id3_length_t id3_tag_render(struct id3_tag const *, id3_byte_t *);
+id3_length_t id3_tag_render(struct id3_tag *, id3_byte_t *);
/* frame interface */
--- tag.c-dist 2004-02-26 12:40:29.000000000 +0100
+++ tag.c 2004-02-26 12:40:36.000000000 +0100
@@ -45,6 +45,12 @@
# include "field.h"
# include "util.h"
+/* If a v2 tag is too small to fit and the file needs to be rewritten, add at least
+ * TAG_PADDING number of bytes to hopefully prevent having to rewrite the file
+ * in the future.
+ */
+#define TAG_PADDING 256
+
/*
* NAME: tag->new()
* DESCRIPTION: allocate and return a new, empty tag
@@ -765,7 +771,10 @@
* NAME: tag->render()
* DESCRIPTION: render a complete ID3 tag
*/
-id3_length_t id3_tag_render(struct id3_tag const *tag, id3_byte_t *buffer)
+/* RAK: Note: This file used to be const, but since the padding might be
+ * adjusted by this function, we can't do that anymore.
+ */
+id3_length_t id3_tag_render(struct id3_tag *tag, id3_byte_t *buffer)
{
id3_length_t size = 0;
id3_byte_t **ptr,
@@ -876,6 +885,9 @@
/* padding */
if (!(flags & ID3_TAG_FLAG_FOOTERPRESENT)) {
+ if (size > tag->paddedsize)
+ tag->paddedsize += TAG_PADDING + size;
+
if (size < tag->paddedsize)
size += id3_render_padding(ptr, 0, tag->paddedsize - size);
else if (tag->options & ID3_TAG_OPTION_UNSYNCHRONISATION) {
--- file.c-dist 2004-02-26 12:40:29.000000000 +0100
+++ file.c 2004-02-26 12:43:11.000000000 +0100
@@ -42,6 +42,10 @@
# include "tag.h"
# include "field.h"
+#define TMP_SUFFIX ".temp"
+#define OLD_SUFFIX ".old"
+#define COPY_BUFFER_SIZE 4096
+
struct filetag {
struct id3_tag *tag;
unsigned long location;
@@ -575,6 +579,11 @@
int v2_write(struct id3_file *file,
id3_byte_t const *data, id3_length_t length)
{
+ FILE *out;
+ char *newpath = NULL, *buffer = NULL, *oldpath = NULL;
+ int numread = 0, numwritten = 0;
+ struct id3_file *newfile = NULL;
+
assert(!data || length > 0);
if (data &&
@@ -592,8 +601,137 @@
}
/* hard general case: rewrite entire file */
+ newpath = malloc(strlen(file->path) + sizeof(TMP_SUFFIX) + 1);
+ if (! newpath)
+ return -1;
+ strcpy(newpath, file->path);
+ strcat(newpath, TMP_SUFFIX);
+ out = fopen(newpath, "wb");
+ if (out == NULL)
+ {
+ free(newpath);
+ return -1;
+ }
- /* ... */
+ /* Write the new tag out */
+ if (fwrite(data, length, 1, out) == 0)
+ {
+ fclose(out);
+ unlink(newpath);
+ free(newpath);
+
+ return -1;
+ }
+
+ if (fseek(file->iofile, (file->tags) ? file->tags[0].length : 0, SEEK_SET) == -1)
+ {
+ fclose(out);
+ unlink(newpath);
+ free(newpath);
+ return -1;
+ }
+
+ buffer = malloc(COPY_BUFFER_SIZE);
+ if (! buffer) {
+ fclose(out);
+ unlink(newpath);
+ free(newpath);
+ return -1;
+ }
+ for(;;)
+ {
+ numread = fread(buffer, sizeof(char), COPY_BUFFER_SIZE, file->iofile);
+ if (numread <= 0)
+ break;
+
+ numwritten = fwrite(buffer, sizeof(char), numread, out);
+ if (numwritten != numread)
+ {
+ fclose(out);
+ unlink(newpath);
+ free(newpath);
+ free(buffer);
+ return -1;
+ }
+ }
+ free(buffer);
+
+ fclose(out);
+ fclose(file->iofile);
+
+ /* Now rename the file. let's be more paranoid here than id3lib */
+ /* Move the old file to the same name with .old appended */
+ oldpath = malloc(strlen(file->path) + sizeof(OLD_SUFFIX) + 1);
+ if (! oldpath) {
+ unlink(newpath);
+ free(newpath);
+ return -1;
+ }
+ strcpy(oldpath, file->path);
+ strcat(oldpath, OLD_SUFFIX);
+
+ if (rename(file->path, oldpath))
+ {
+ unlink(newpath);
+ unlink(oldpath);
+ free(newpath);
+ free(oldpath);
+ return -1;
+ }
+
+ /* Now rename the new file to proper file */
+ if (rename(newpath, file->path))
+ {
+ /* Something failed, so let's try to put things back */
+ rename(oldpath, file->path);
+ unlink(newpath);
+ unlink(oldpath);
+ free(newpath);
+ free(oldpath);
+ return -1;
+ }
+
+ /* now that the rename succeeded, remove the old file */
+ unlink(oldpath);
+
+ free(oldpath);
+ free(newpath);
+
+ /* Now do the housekeeping to make sure we leave things as we found them */
+ newfile = id3_file_open(file->path, file->mode);
+ if (newfile)
+ {
+ int i;
+
+ /* Clean up the old data */
+ if (file->path)
+ free(file->path);
+
+ if (file->primary) {
+ id3_tag_delref(file->primary);
+ id3_tag_delete(file->primary);
+ }
+
+ for (i = 0; i < file->ntags; ++i) {
+ struct id3_tag *tag;
+
+ tag = file->tags[i].tag;
+ if (tag) {
+ id3_tag_delref(tag);
+ id3_tag_delete(tag);
+ }
+ }
+
+ if (file->tags)
+ free(file->tags);
+
+ memcpy(file, newfile, sizeof(struct id3_file));
+ }
+ else
+ {
+ /* Hmmm. Something is wrong. Let's zero out the current info */
+ memset(file, 0, sizeof(struct id3_file));
+ }
done:
return 0;

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a29c1edd6086f52bba55623075e7b9dacc614a80c864562a9bd36970cde6c76c
size 228252

View File

@ -0,0 +1,11 @@
--- Makefile.am-dist 2004-02-26 12:46:41.000000000 +0100
+++ Makefile.am 2004-02-26 12:47:43.000000000 +0100
@@ -21,6 +21,8 @@
## Process this file with automake to produce Makefile.in
+AUTOMAKE_OPTIONS = foreign
+
SUBDIRS =
DIST_SUBDIRS = msvc++

32
libid3tag-gperf.dif Normal file
View File

@ -0,0 +1,32 @@
--- compat.gperf
+++ compat.gperf
@@ -46,7 +46,11 @@
static id3_compat_func_t translate_TCON;
%}
-struct id3_compat;
+struct id3_compat {
+ char const *id;
+ char const *equiv;
+ id3_compat_func_t *translate;
+};
%%
#
# ID3v2.2 and ID3v2.3 frames
--- frametype.gperf
+++ frametype.gperf
@@ -269,7 +269,13 @@
FRAMETYPE(unknown, unknown, PRESERVE, "Unknown frame");
FRAMETYPE(obsolete, unknown, OBSOLETE, "Obsolete frame");
%}
-struct id3_frametype;
+struct id3_frametype {
+ char const *id;
+ unsigned int nfields;
+ enum id3_field_type const *fields;
+ int defaultflags;
+ char const *description;
+};
%%
#
# ID3v2.4 frames

10
libid3tag-noweak.dif Normal file
View File

@ -0,0 +1,10 @@
--- Makefile.am-dist 2003-06-04 09:37:06.000000000 +0200
+++ Makefile.am 2003-07-03 16:52:39.000000000 +0200
@@ -90,6 +90,7 @@
frametype.gperf compat.gperf genre.dat.in \
debug.c debug.h
+libid3tag_la_LIBADD = -lz
libid3tag_la_LDFLAGS = -version-info $(version_info)
BUILT_SOURCES = frametype.c compat.c genre.dat

20
libid3tag-optflags.patch Normal file
View File

@ -0,0 +1,20 @@
--- configure.ac
+++ configure.ac
@@ -17,7 +17,7 @@
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-AC_REVISION([$Id: configure.ac,v 1.12 2004/01/23 23:22:46 rob Exp $])dnl
+AC_REVISION([$Id: configure.ac,v 1.1 2006/10/31 09:26:19 meissner Exp meissner $])dnl
dnl Process this file with autoconf to produce a configure script.
@@ -107,7 +107,7 @@
shift
;;
-O*|-f*)
- optimize="$1"
+ optimize="$optimize $1"
shift
;;
*)

43
libid3tag.changes Normal file
View File

@ -0,0 +1,43 @@
-------------------------------------------------------------------
Tue Oct 31 10:29:01 CET 2006 - meissner@suse.de
- fixed configure.ac to accept more than 1 -O/-f option, added
requires
-------------------------------------------------------------------
Wed Jan 25 21:37:29 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Wed Jan 11 16:47:50 CET 2006 - tiwai@suse.de
- compile with -fstack-protector.
-------------------------------------------------------------------
Mon Jul 5 22:38:34 CEST 2004 - hvogel@suse.de
- add pgkconfig file
-------------------------------------------------------------------
Thu Feb 26 12:45:36 CET 2004 - tiwai@suse.de
- updated to version 0.15.1b.
- fixed memory allocation check.
- fixed for autoreconf.
-------------------------------------------------------------------
Tue Jan 13 20:18:23 CET 2004 - tiwai@suse.de
- build as non-root.
-------------------------------------------------------------------
Mon Aug 11 16:38:43 CEST 2003 - tiwai@suse.de
- fixed the handling of v2 tag.
-------------------------------------------------------------------
Thu Jul 3 16:57:50 CEST 2003 - tiwai@suse.de
- split from mad: version 0.15.0b.

116
libid3tag.spec Normal file
View File

@ -0,0 +1,116 @@
#
# spec file for package libid3tag (Version 0.15.1b)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: libid3tag
BuildRequires: gperf
Summary: ID3 Tag Manipulation Library
Version: 0.15.1b
Release: 46
Group: System/Libraries
License: GNU General Public License (GPL) - all versions
URL: http://www.underbit.com/products/mad/
Source: %{name}-%{version}.tar.bz2
Patch: libid3tag-noweak.dif
Patch1: libid3tag-gperf.dif
Patch2: libid3tag-0.15.1b-mb.diff
Patch3: libid3tag-automake-fix.dif
Patch4: libid3tag-optflags.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
libid3tag is a library for reading and writing ID3 tags, both ID3v1 and
the various versions of ID3v2.
Authors:
--------
Underbit Technologies, Inc. <support@underbit.com>
%package devel
Summary: Development package for libid3tag library
Group: Development/Libraries/C and C++
Requires: libid3tag = %version zlib-devel
%description devel
This package contains the header files and static libraries needed to
develop applications with libid3tag.
Authors:
--------
Underbit Technologies, Inc. <support@underbit.com>
%prep
%setup -q
%patch
%patch1
%patch2
%patch3
%patch4
%build
%{?suse_update_config:%{suse_update_config -f}}
autoreconf -fi
CFLAGS="$RPM_OPT_FLAGS -fstack-protector" \
./configure --prefix=%{_prefix} --mandir=%{_mandir} \
--libdir=%{_libdir}
make
echo -e "prefix=%_prefix\nexec_prefix=%_prefix\nlibdir=%_libdir\nincludedir=%_includedir\nName: id3tag\nDescription: ID3 tag library\nRequires:\nVersion: %version\nLibs: -L%_libdir -lid3tag -lz\nCflags: -I%_includedir\n" > id3tag.pc
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
install -m 644 -D id3tag.pc %{buildroot}%{_libdir}/pkgconfig/id3tag.pc
%post
%run_ldconfig
%postun
%run_ldconfig
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc CHANGES COPYING COPYRIGHT CREDITS README TODO VERSION
%{_libdir}/lib*.so.*
%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.*a
%{_libdir}/*.so
%{_libdir}/pkgconfig/id3tag.pc
%changelog -n libid3tag
* Tue Oct 31 2006 - meissner@suse.de
- fixed configure.ac to accept more than 1 -O/-f option, added
requires
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jan 11 2006 - tiwai@suse.de
- compile with -fstack-protector.
* Mon Jul 05 2004 - hvogel@suse.de
- add pgkconfig file
* Thu Feb 26 2004 - tiwai@suse.de
- updated to version 0.15.1b.
- fixed memory allocation check.
- fixed for autoreconf.
* Tue Jan 13 2004 - tiwai@suse.de
- build as non-root.
* Mon Aug 11 2003 - tiwai@suse.de
- fixed the handling of v2 tag.
* Thu Jul 03 2003 - tiwai@suse.de
- split from mad: version 0.15.0b.

0
ready Normal file
View File