id3lib: fix build for gcc 12

This commit is contained in:
John McQuah 2023-01-22 20:03:36 -05:00
parent 58c37dad97
commit c0c850dcce
7 changed files with 284 additions and 117 deletions

View File

@ -1,11 +1,11 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF378NEje3bXiI419czAENHF3/FEGYZKxOwZs+bcRe8/hlquYgXCiB4GGn11X4LTkpa8QLyW5aK1Id/Xq6RQMu1ww=
SHA256 (Pkgfile) = 2da472246eab7c1f1d6615fa973196376e6ba245715ba3a89a383f4fc2419859
RWSagIOpLGJF34MNZsmNNTwLeKIvDp16lHkuVm1vACp17SLLVCSdnL79/jVTAa7189vhdPy8tTTan8Bcdw+tXc5ewCo6lxsB2wQ=
SHA256 (Pkgfile) = 80ecc901d14ddc823868ce4b85e698140cb3caa35620d0d6363ece3ce92f6718
SHA256 (.footprint) = 1d74d6500595dabc037211dece8cd72001d3bba213949d521b3275087f0afa85
SHA256 (id3lib-3.8.3.tar.gz) = 2749cc3c0cd7280b299518b1ddf5a5bcfe2d1100614519b68702230e26c7d079
SHA256 (id3lib-3.8.3-zlib.patch) = 0b5531089422bda659deddcccf0562fcaa96529e74778065e35c848d6cf2a502
SHA256 (id3lib-3.8.3-test_io.patch) = cc124f8805bcb977a1673f0b04fff368dac1af70d78c21da6f0415ce067d7687
SHA256 (id3lib-3.8.3-gcc-4.3.patch) = e892313aea25c043c6fbe43e4bab041145ea454dbc04ea0e2e88b61345db7040
SHA256 (id3lib-3.8.3-autoconf259.patch) = ffde572cb263cce4585292143a4396ebd12592ac34b398da19d1608f1c2374f9
SHA256 (id3lib-3.8.3-unicode16.patch) = 71c79002d9485965a3a93e87ecbd7fed8f89f64340433b7ccd263d21385ac969
SHA256 (id3lib-3.8.3-gcc-4.3.patch) = 536f6bb5dddd48df3c7fc080c04f03a2053ab11429094f2f31d6e2d5f21a987e
SHA256 (id3lib-3.8.3-missing-nullptr-check.patch) = e27d93dd84994e20485ebe22b1628c4fa6ebc26a538afd1ff5f5947ef1836dde
SHA256 (id3lib-3.8.3-abi-fix.patch) = 51fb502f76f918d44efa5ee62c6835c83467ef7363f37d5d6798a2a3e5346e44
SHA256 (CVE-2007-4460.diff) = 631545e2460cdd0f0566034149a51f409eda3c19871dd7d4c1c5280febc53a2f

View File

@ -1,40 +1,37 @@
# Description: An open-source, cross-platform library for reading/writing/manipulating ID3 tags.
# URL: http://id3lib.sourceforge.net/
# Maintainer: Danny Rawlins, crux at romster dot me
# Maintainer: John McQuah, jmcquah at disroot dot org
# Depends on: zlib
name=id3lib
version=3.8.3
release=3
release=4
source=(http://downloads.sourceforge.net/project/$name/$name/$version/$name-$version.tar.gz
$name-3.8.3-zlib.patch
$name-3.8.3-test_io.patch
$name-3.8.3-autoconf259.patch
$name-3.8.3-unicode16.patch
$name-3.8.3-gcc-4.3.patch
$name-$version-gcc-4.3.patch
$name-$version-autoconf259.patch
$name-$version-unicode16.patch
$name-$version-missing-nullptr-check.patch
$name-$version-abi-fix.patch
CVE-2007-4460.diff)
build() {
cd $name-$version
patch -p 1 -i $SRC/$name-3.8.3-zlib.patch
patch -p 1 -i $SRC/$name-3.8.3-test_io.patch
patch -p 1 -i $SRC/$name-3.8.3-autoconf259.patch
patch -p 1 -i $SRC/$name-3.8.3-unicode16.patch
patch -p 1 -i $SRC/$name-3.8.3-gcc-4.3.patch
patch -p 1 -i $SRC/CVE-2007-4460.diff
patch -p1 -i $SRC/$name-$version-gcc-4.3.patch
patch -p1 -i $SRC/$name-$version-autoconf259.patch
patch -p1 -i $SRC/$name-$version-unicode16.patch
patch -p1 -i $SRC/$name-$version-missing-nullptr-check.patch
patch -p1 -i $SRC/$name-$version-abi-fix.patch
patch -p1 -i $SRC/CVE-2007-4460.diff
sed -i -e 's/^AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' \
configure.in zlib/configure.in
sed -i 's/^AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' {.,zlib}/configure.in
autoreconf -ivfs # buggy configure
CC='g++' \
./configure \
--prefix=/usr \
--disable-static \
--disable-assert \
--enable-debug=no
./configure --prefix=/usr \
--disable-static \
--disable-assert \
--enable-debug=no
make
make DESTDIR=$PKG install

View File

@ -0,0 +1,226 @@
--- a/include/id3.h
+++ b/include/id3.h
@@ -47,12 +47,12 @@ extern "C"
ID3_C_EXPORT ID3Tag* CCONV ID3Tag_New (void);
ID3_C_EXPORT void CCONV ID3Tag_Delete (ID3Tag *tag);
ID3_C_EXPORT void CCONV ID3Tag_Clear (ID3Tag *tag);
- ID3_C_EXPORT bool CCONV ID3Tag_HasChanged (const ID3Tag *tag);
- ID3_C_EXPORT void CCONV ID3Tag_SetUnsync (ID3Tag *tag, bool unsync);
- ID3_C_EXPORT void CCONV ID3Tag_SetExtendedHeader (ID3Tag *tag, bool ext);
- ID3_C_EXPORT void CCONV ID3Tag_SetPadding (ID3Tag *tag, bool pad);
+ ID3_C_EXPORT ID3_Bool CCONV ID3Tag_HasChanged (const ID3Tag *tag);
+ ID3_C_EXPORT void CCONV ID3Tag_SetUnsync (ID3Tag *tag, ID3_Bool unsync);
+ ID3_C_EXPORT void CCONV ID3Tag_SetExtendedHeader (ID3Tag *tag, ID3_Bool ext);
+ ID3_C_EXPORT void CCONV ID3Tag_SetPadding (ID3Tag *tag, ID3_Bool pad);
ID3_C_EXPORT void CCONV ID3Tag_AddFrame (ID3Tag *tag, const ID3Frame *frame);
- ID3_C_EXPORT bool CCONV ID3Tag_AttachFrame (ID3Tag *tag, ID3Frame *frame);
+ ID3_C_EXPORT ID3_Bool CCONV ID3Tag_AttachFrame (ID3Tag *tag, ID3Frame *frame);
ID3_C_EXPORT void CCONV ID3Tag_AddFrames (ID3Tag *tag, const ID3Frame *frames, size_t num);
ID3_C_EXPORT ID3Frame* CCONV ID3Tag_RemoveFrame (ID3Tag *tag, const ID3Frame *frame);
ID3_C_EXPORT ID3_Err CCONV ID3Tag_Parse (ID3Tag *tag, const uchar header[ID3_TAGHEADERSIZE], const uchar *buffer);
@@ -66,7 +66,7 @@ extern "C"
ID3_C_EXPORT ID3Frame* CCONV ID3Tag_FindFrameWithASCII (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, const char *data);
ID3_C_EXPORT ID3Frame* CCONV ID3Tag_FindFrameWithUNICODE (const ID3Tag *tag, ID3_FrameID id, ID3_FieldID fld, const unicode_t *data);
ID3_C_EXPORT size_t CCONV ID3Tag_NumFrames (const ID3Tag *tag);
- ID3_C_EXPORT bool CCONV ID3Tag_HasTagType (const ID3Tag *tag, ID3_TagType);
+ ID3_C_EXPORT ID3_Bool CCONV ID3Tag_HasTagType (const ID3Tag *tag, ID3_TagType);
ID3_C_EXPORT ID3TagIterator* CCONV ID3Tag_CreateIterator (ID3Tag *tag);
ID3_C_EXPORT ID3TagConstIterator* CCONV ID3Tag_CreateConstIterator (const ID3Tag *tag);
@@ -83,8 +83,8 @@ extern "C"
ID3_C_EXPORT void CCONV ID3Frame_SetID (ID3Frame *frame, ID3_FrameID id);
ID3_C_EXPORT ID3_FrameID CCONV ID3Frame_GetID (const ID3Frame *frame);
ID3_C_EXPORT ID3Field* CCONV ID3Frame_GetField (const ID3Frame *frame, ID3_FieldID name);
- ID3_C_EXPORT void CCONV ID3Frame_SetCompression (ID3Frame *frame, bool comp);
- ID3_C_EXPORT bool CCONV ID3Frame_GetCompression (const ID3Frame *frame);
+ ID3_C_EXPORT void CCONV ID3Frame_SetCompression (ID3Frame *frame, ID3_Bool comp);
+ ID3_C_EXPORT ID3_Bool CCONV ID3Frame_GetCompression (const ID3Frame *frame);
/* field wrappers */
ID3_C_EXPORT void CCONV ID3Field_Clear (ID3Field *field);
@@ -116,7 +116,7 @@ extern "C"
ID3_C_EXPORT flags_t CCONV ID3FrameInfo_FieldFlags (ID3_FrameID frameid, int fieldnum);
/* Deprecated */
- ID3_C_EXPORT void CCONV ID3Tag_SetCompression (ID3Tag *tag, bool comp);
+ ID3_C_EXPORT void CCONV ID3Tag_SetCompression (ID3Tag *tag, ID3_Bool comp);
#ifdef __cplusplus
}
--- a/include/id3/globals.h
+++ b/include/id3/globals.h
@@ -82,14 +82,10 @@
#define ID3_C_VAR extern
-#ifndef __cplusplus
-
-typedef int bool;
-# define false (0)
-# define true (!false)
-
-#endif /* __cplusplus */
+typedef int ID3_Bool;
+# define ID3_False 0
+# define ID3_True 1
ID3_C_VAR const char * const ID3LIB_NAME;
ID3_C_VAR const char * const ID3LIB_RELEASE;
ID3_C_VAR const char * const ID3LIB_FULL_NAME;
@@ -532,9 +530,9 @@ ID3_STRUCT(Mp3_Headerinfo)
uint32 framesize;
uint32 frames; // nr of frames
uint32 time; // nr of seconds in song
- bool privatebit;
- bool copyrighted;
- bool original;
+ ID3_Bool privatebit;
+ ID3_Bool copyrighted;
+ ID3_Bool original;
};
#define ID3_NR_OF_V1_GENRES 148
--- a/src/c_wrapper.cpp
+++ b/src/c_wrapper.cpp
@@ -72,10 +72,10 @@ extern "C"
}
- ID3_C_EXPORT bool CCONV
+ ID3_C_EXPORT ID3_Bool CCONV
ID3Tag_HasChanged(const ID3Tag *tag)
{
- bool changed = false;
+ ID3_Bool changed = ID3_False;
if (tag)
{
@@ -87,7 +87,7 @@ extern "C"
ID3_C_EXPORT void CCONV
- ID3Tag_SetUnsync(ID3Tag *tag, bool unsync)
+ ID3Tag_SetUnsync(ID3Tag *tag, ID3_Bool unsync)
{
if (tag)
{
@@ -97,7 +97,7 @@ extern "C"
ID3_C_EXPORT void CCONV
- ID3Tag_SetExtendedHeader(ID3Tag *tag, bool ext)
+ ID3Tag_SetExtendedHeader(ID3Tag *tag, ID3_Bool ext)
{
if (tag)
{
@@ -106,7 +106,7 @@ extern "C"
}
ID3_C_EXPORT void CCONV
- ID3Tag_SetPadding(ID3Tag *tag, bool pad)
+ ID3Tag_SetPadding(ID3Tag *tag, ID3_Bool pad)
{
if (tag)
{
@@ -125,10 +125,10 @@ extern "C"
}
- ID3_C_EXPORT bool CCONV
+ ID3_C_EXPORT ID3_Bool CCONV
ID3Tag_AttachFrame(ID3Tag *tag, ID3Frame *frame)
{
- bool b = false;
+ ID3_Bool b = ID3_False;
if (tag)
{
ID3_CATCH(b = reinterpret_cast<ID3_Tag *>(tag)->AttachFrame(reinterpret_cast<ID3_Frame *>(frame)));
@@ -303,10 +303,10 @@ extern "C"
}
- ID3_C_EXPORT bool CCONV
+ ID3_C_EXPORT ID3_Bool CCONV
ID3Tag_HasTagType(const ID3Tag *tag, ID3_TagType tt)
{
- bool has_tt = false;
+ ID3_Bool has_tt = ID3_False;
if (tag)
{
@@ -459,7 +459,7 @@ extern "C"
ID3_C_EXPORT void CCONV
- ID3Frame_SetCompression(ID3Frame *frame, bool comp)
+ ID3Frame_SetCompression(ID3Frame *frame, ID3_Bool comp)
{
if (frame)
{
@@ -468,10 +468,10 @@ extern "C"
}
- ID3_C_EXPORT bool CCONV
+ ID3_C_EXPORT ID3_Bool CCONV
ID3Frame_GetCompression(const ID3Frame *frame)
{
- bool compressed = false;
+ ID3_Bool compressed = ID3_False;
if (frame)
{
ID3_CATCH(compressed = reinterpret_cast<const ID3_Frame *>(frame)->GetCompression());
--- a/examples/findeng.cpp
+++ b/examples/findeng.cpp
@@ -9,7 +9,7 @@
using std::cout;
using std::endl;
-int main(unsigned argc, char* argv[])
+int main(int argc, char* argv[])
{
ID3D_INIT_DOUT();
ID3D_INIT_WARNING();
--- a/examples/findstr.cpp
+++ b/examples/findstr.cpp
@@ -9,7 +9,7 @@
using std::cout;
using std::endl;
-int main(unsigned argc, char* argv[])
+int main(int argc, char* argv[])
{
ID3D_INIT_DOUT();
ID3D_INIT_WARNING();
--- a/examples/test_io.cpp
+++ b/examples/test_io.cpp
@@ -18,13 +18,13 @@ using std::cerr;
using namespace dami;
int
-main(size_t argc, const char** argv)
+main(int argc, const char** argv)
{
ID3D_INIT_DOUT();
ID3D_INIT_WARNING();
ID3D_INIT_NOTICE();
- ID3_IStreamReader isr(cin);
+ ID3_IStreamReader isr(std::cin);
BString orig = io::readAllBinary(isr);
cout << "input size: " << orig.size() << endl;
@@ -116,7 +116,7 @@ main(size_t argc, const char** argv)
cout << "binary number:";
for (size_t i = 0; i < number.size(); ++i)
{
- cout << " 0x" << hex << (size_t) (0xFF & number[i]) << dec;
+ cout << " 0x" << std::hex << (size_t) (0xFF & number[i]) << std::dec;
}
cout << endl;

View File

@ -1,6 +1,5 @@
diff -Naur id3lib-3.8.3-orig/configure.in id3lib-3.8.3/configure.in
--- id3lib-3.8.3-orig/configure.in 2008-03-05 18:03:25.000000000 -0600
+++ id3lib-3.8.3/configure.in 2008-03-05 18:15:42.000000000 -0600
--- a/configure.in
+++ b/configure.in
@@ -227,7 +227,6 @@
)
AC_CHECK_HEADERS( \
@ -9,9 +8,8 @@ diff -Naur id3lib-3.8.3-orig/configure.in id3lib-3.8.3/configure.in
,,AC_MSG_ERROR([Missing a vital header file for id3lib])
)
diff -Naur id3lib-3.8.3-orig/include/id3/id3lib_strings.h id3lib-3.8.3/include/id3/id3lib_strings.h
--- id3lib-3.8.3-orig/include/id3/id3lib_strings.h 2008-03-05 18:19:46.000000000 -0600
+++ id3lib-3.8.3/include/id3/id3lib_strings.h 2008-03-05 18:19:38.000000000 -0600
--- a/include/id3/id3lib_strings.h
+++ b/include/id3/id3lib_strings.h
@@ -30,6 +30,7 @@
#define _ID3LIB_STRINGS_H_
@ -20,63 +18,15 @@ diff -Naur id3lib-3.8.3-orig/include/id3/id3lib_strings.h id3lib-3.8.3/include/i
#if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000))
namespace std
diff -Naur id3lib-3.8.3-orig/include/id3/writers.h id3lib-3.8.3/include/id3/writers.h
--- id3lib-3.8.3-orig/include/id3/writers.h 2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/include/id3/writers.h 2008-03-05 18:23:05.000000000 -0600
--- a/include/id3/writers.h
+++ b/include/id3/writers.h
@@ -30,7 +30,7 @@
#include "id3/writer.h"
#include "id3/id3lib_streams.h"
-//#include <string.h>
+#include <string.h>
+#include <cstring>
class ID3_CPP_EXPORT ID3_OStreamWriter : public ID3_Writer
{
diff -Naur id3lib-3.8.3-orig/examples/demo_convert.cpp id3lib-3.8.3/examples/demo_convert.cpp
--- id3lib-3.8.3-orig/examples/demo_convert.cpp 2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_convert.cpp 2008-03-05 18:26:50.000000000 -0600
@@ -84,7 +84,7 @@
}
}
-int main( unsigned int argc, char * const argv[])
+int main( int argc, char * const argv[])
{
flags_t ulFlag = ID3TT_ALL;
gengetopt_args_info args;
diff -Naur id3lib-3.8.3-orig/examples/demo_info.cpp id3lib-3.8.3/examples/demo_info.cpp
--- id3lib-3.8.3-orig/examples/demo_info.cpp 2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_info.cpp 2008-03-05 18:27:40.000000000 -0600
@@ -309,7 +309,7 @@
#define DEBUG
-int main( unsigned int argc, char * const argv[])
+int main( int argc, char * const argv[])
{
ID3D_INIT_DOUT();
diff -Naur id3lib-3.8.3-orig/examples/demo_tag.cpp id3lib-3.8.3/examples/demo_tag.cpp
--- id3lib-3.8.3-orig/examples/demo_tag.cpp 2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_tag.cpp 2008-03-05 18:31:20.000000000 -0600
@@ -46,7 +46,7 @@
os << "v2";
}
-int main( unsigned int argc, char * const argv[])
+int main( int argc, char * const argv[])
{
int ulFlag = ID3TT_ID3;
ID3D_INIT_DOUT();
diff -Naur id3lib-3.8.3-orig/examples/demo_copy.cpp id3lib-3.8.3/examples/demo_copy.cpp
--- id3lib-3.8.3-orig/examples/demo_copy.cpp 2003-03-01 18:23:00.000000000 -0600
+++ id3lib-3.8.3/examples/demo_copy.cpp 2008-03-05 18:32:44.000000000 -0600
@@ -81,7 +81,7 @@
}
}
-int main( unsigned int argc, char * const argv[])
+int main( int argc, char * const argv[])
{
int ulFlag = ID3TT_ID3;
ID3D_INIT_DOUT();

View File

@ -0,0 +1,27 @@
This patch adds a check for a null pointer
--- a/src/header_tag.cpp
+++ b/src/header_tag.cpp
@@ -54,7 +54,7 @@
{
size_t bytesUsed = ID3_TagHeader::SIZE;
- if (_info->is_extended)
+ if (_info && _info->is_extended)
{
bytesUsed += _info->extended_bytes;
}
This patch by Urs Fleisch prevents crashes when reading VBR MP3 file.
Index: id3lib3.8.3-3.8.3/src/mp3_parse.cpp
===================================================================
--- a/src/mp3_parse.cpp 2009-10-06 23:12:10.381250132 +0200
+++ b/src/mp3_parse.cpp 2009-10-06 23:14:09.545252591 +0200
@@ -465,7 +465,7 @@
// from http://www.xingtech.com/developer/mp3/
const size_t VBR_HEADER_MIN_SIZE = 8; // "xing" + flags are fixed
- const size_t VBR_HEADER_MAX_SIZE = 116; // frames, bytes, toc and scale are optional
+ const size_t VBR_HEADER_MAX_SIZE = 120; // frames, bytes, toc and scale are optional
if (mp3size >= vbr_header_offest + VBR_HEADER_MIN_SIZE)
{

View File

@ -1,10 +0,0 @@
--- id3lib-3.8.3/examples/test_io.cpp.orig 2004-09-21 23:40:48.398826320 +0200
+++ id3lib-3.8.3/examples/test_io.cpp 2004-09-21 23:40:55.408760648 +0200
@@ -16,6 +16,7 @@
using std::cerr;
using namespace dami;
+using namespace std;
int
main(size_t argc, const char** argv)

View File

@ -1,23 +0,0 @@
diff -Naur id3lib-3.8.3.orig/Makefile.am id3lib-3.8.3/Makefile.am
--- id3lib-3.8.3.orig/Makefile.am 2003-03-01 16:23:00.000000000 -0800
+++ id3lib-3.8.3/Makefile.am 2004-09-12 19:05:39.564456828 -0700
@@ -28,7 +28,7 @@
endif
SUBDIRS = . m4 $(zlib_subdir) doc include id3com src examples
-DIST_SUBDIRS = . m4 zlib doc include id3com src examples prj libprj
+DIST_SUBDIRS = . m4 $(zlib_subdir) doc include id3com src examples prj libprj
INCLUDES = @ID3LIB_DEBUG_FLAGS@
diff -Naur id3lib-3.8.3.orig/src/Makefile.am id3lib-3.8.3/src/Makefile.am
--- id3lib-3.8.3.orig/src/Makefile.am 2003-03-01 16:23:00.000000000 -0800
+++ id3lib-3.8.3/src/Makefile.am 2004-09-12 19:08:30.814149521 -0700
@@ -77,6 +77,7 @@
endif
libid3_la_LDFLAGS = \
+ -lz \
-version-info $(LT_VERSION) \
-release $(LT_RELEASE) \
-export-dynamic