[SCM] milkytracker/master: Drop obsolete patches
jcowgill at users.alioth.debian.org
jcowgill at users.alioth.debian.org
Thu Apr 13 22:53:13 UTC 2017
The following commit has been merged in the master branch:
commit d2c954577375e2d5ce4cd0071fa8b293110854ff
Author: James Cowgill <james410 at cowgill.org.uk>
Date: Thu Apr 13 23:42:27 2017 +0100
Drop obsolete patches
diff --git a/debian/patches/01_add-alsalibs.patch b/debian/patches/01_add-alsalibs.patch
deleted file mode 100644
index e517dc3..0000000
--- a/debian/patches/01_add-alsalibs.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Link against ALSA properly
-Author: James Cowgill <jcowgill at debian.org>
-Applied-Upstream: https://github.com/Deltafire/MilkyTracker/commit/edc78c3ff60a36f9dff77ae9771eadb470bd9e69
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/src/tracker/Makefile.am
-+++ b/src/tracker/Makefile.am
-@@ -76,7 +76,7 @@ $(top_builddir)/src/ppui/libppui.a \
- $(top_builddir)/src/ppui/osinterface/libosinterface.a \
- $(top_builddir)/src/fx/libfx.a $(compressionLib) $(RTMIDI) $(SDL_LIBS) \
- $(top_builddir)/src/compression/zziplib/generic/libzzip.a \
--$(Z_LIBS)
-+$(Z_LIBS) $(ALSA_LIBS)
- #$(ZZIP_LIBS) read below
-
- # NOTE: The MilkyTracker source contains a MODIFIED version of the zzip
diff --git a/debian/patches/02_debundle-rtmidi.patch b/debian/patches/02_debundle-rtmidi.patch
deleted file mode 100644
index a449f7a..0000000
--- a/debian/patches/02_debundle-rtmidi.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-Description: Use system version of RtMidi
- Backported from these two upstream patches:
- https://github.com/Deltafire/MilkyTracker/commit/b36c3a5c232d5d1fdf6a48fd501b5e767366a463
- https://github.com/Deltafire/MilkyTracker/commit/c3c651cc95bd3a243779ee67a66114e8874ecfb2
-Author: Joonas Sarajärvi <muep at iki.fi>
-
---- a/src/midi/posix/MidiReceiver_pthread.cpp
-+++ b/src/midi/posix/MidiReceiver_pthread.cpp
-@@ -32,7 +32,6 @@
- #include "Tracker.h"
- #include "PPMutex.h"
- #include "RtMidi.h"
--#include "RtError.h"
- #include "PPSystem.h"
- #include <iostream>
- #include "MidiTools.h"
-@@ -64,7 +63,7 @@ bool MidiReceiver::startRecording(unsign
- midiin = new RtMidiIn();
- midiin->openPort(deviceID);
- }
-- catch (RtError &error)
-+ catch (RtMidiError &error)
- {
- error.printMessage();
- goto cleanup;
---- a/configure.ac
-+++ b/configure.ac
-@@ -31,15 +31,20 @@ AC_ARG_WITH([alsa],
-
- if test "x$with_alsa" != xno; then
- AM_PATH_ALSA([1.0.0],[
-- RTMIDI="../midi/libmidi.a"
-- RTMIDI_DIR="midi"
-- AC_SUBST(RTMIDI)
-- AC_SUBST(RTMIDI_DIR)],
-- [if test "x$with_alsa" != xcheck; then
-+ # ALSA found, check for RtMidi
-+ PKG_CHECK_MODULES([RTMIDI],[rtmidi])
-+ MIDI_LIB="../midi/libmidi.a"
-+ MIDI_LIB_DIR="midi"
-+ AC_SUBST(MIDI_LIB)
-+ AC_SUBST(MIDI_LIB_DIR)
-+ ],[
-+ # ALSA not found
-+ if test "x$with_alsa" != xcheck; then
- AC_MSG_FAILURE([--with-alsa was given, but test for alsa failed])
- else
- AC_MSG_WARN([ALSA not found - midi support disabled])
-- fi])
-+ fi
-+ ])
- fi
-
- AC_SEARCH_LIBS(gzopen, z, AC_DEFINE([HAVE_LIBZ], [1], [Define to 1 if you have the 'libz' library.]),)
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -1,3 +1,3 @@
--SUBDIRS = milkyplay ${RTMIDI_DIR} ppui fx compression tracker
-+SUBDIRS = milkyplay $(MIDI_LIB_DIR) ppui fx compression tracker
-
- DIST_SUBDIRS = milkyplay midi ppui fx compression tracker
---- a/src/midi/Makefile.am
-+++ b/src/midi/Makefile.am
-@@ -1,17 +1,16 @@
- noinst_LIBRARIES = libmidi.a
-
--libmidi_a_SOURCES = posix/MidiReceiver_pthread.cpp rtmidi/RtMidi.cpp
-+libmidi_a_SOURCES = posix/MidiReceiver_pthread.cpp
-
--noinst_HEADERS = posix/MidiReceiver_pthread.h rtmidi/RtError.h rtmidi/RtMidi.h \
--MidiTools.h
-+noinst_HEADERS = posix/MidiReceiver_pthread.h MidiTools.h
-
- AM_CPPFLAGS=-D__LINUX_ALSASEQ__ -D__LINUX__ -DMILKYTRACKER ${ALSA_CFLAGS} \
--${SDL_CFLAGS}
-+$(SDL_CFLAGS) $(RTMIDI_CFLAGS)
-
- AM_CPPFLAGS += -I$(top_srcdir)/src/milkyplay -I$(top_srcdir)/src/ppui \
- -I$(top_srcdir)/src/tracker -I$(top_srcdir)/src/ppui/osinterface \
- -I$(top_srcdir)/src/ppui/osinterface/sdl \
---I$(top_srcdir)/src/ppui/osinterface/posix -I$(top_srcdir)/src/midi/rtmidi
-+-I$(top_srcdir)/src/ppui/osinterface/posix
-
- EXTRA_DIST = win32/LongMsg.cpp win32/LongMsg.h win32/MIDIInDevice.cpp \
- win32/MIDIInDevice.h win32/MIDIMsg.h win32/MidiReceiver_win32.cpp \
---- a/src/tracker/Makefile.am
-+++ b/src/tracker/Makefile.am
-@@ -48,17 +48,18 @@ TabHeaderControl.h TabManager.h TabTitle
- TitlePageManager.h ToolInvokeHelper.h Tracker.h TrackerConfig.h \
- TrackerSettingsDatabase.h Undo.h VRand.h Zapper.h sdl/SDL_KeyTranslation.h
-
--AM_CPPFLAGS = -DMILKYTRACKER -D__THREADTIMER__ -D__LINUX__ ${SDL_CFLAGS}
-+AM_CPPFLAGS = -DMILKYTRACKER -D__THREADTIMER__ -D__LINUX__ $(SDL_CFLAGS) \
-+$(RTMIDI_CFLAGS)
-
--AM_CPPFLAGS += -I$(top_srcdir)/src/${RTMIDI_DIR} -I$(top_srcdir)/src/compression \
---I$(top_srcdir)/src/fx -I$(top_srcdir)/src/milkyplay -I$(top_srcdir)/src/ppui \
---I$(top_srcdir)/src/tracker -I$(top_srcdir)/src/midi/posix -I../midi/rtmidi \
-+AM_CPPFLAGS += -I$(top_srcdir)/src/compression -I$(top_srcdir)/src/fx \
-+-I$(top_srcdir)/src/milkyplay -I$(top_srcdir)/src/ppui \
-+-I$(top_srcdir)/src/tracker -I$(top_srcdir)/src/midi/posix \
- -I$(top_srcdir)/src/ppui/osinterface -I$(top_srcdir)/src/ppui/osinterface/sdl \
- -I$(top_srcdir)/src/ppui/osinterface/posix -I$(top_srcdir)/src/ppui/sdl -Isdl
-
- # The following cannot be linked as a static library, the linker will regard
- # the DecompressorXXX files as unused and therefore won't pull them in:
--compressionLib = $(top_builddir)/src/compression/Decompressor.o \
-+COMPRESSION_LIB = $(top_builddir)/src/compression/Decompressor.o \
- $(top_builddir)/src/compression/DecompressorGZIP.o \
- $(top_builddir)/src/compression/DecompressorLHA.o \
- $(top_builddir)/src/compression/DecompressorPP20.o \
-@@ -74,9 +75,9 @@ milkytracker_LDADD = $(top_builddir)/src
- $(top_builddir)/src/ppui/osinterface/libosinterface.a \
- $(top_builddir)/src/ppui/libppui.a \
- $(top_builddir)/src/ppui/osinterface/libosinterface.a \
--$(top_builddir)/src/fx/libfx.a $(compressionLib) $(RTMIDI) $(SDL_LIBS) \
-+$(top_builddir)/src/fx/libfx.a $(COMPRESSION_LIB) $(MIDI_LIB) \
- $(top_builddir)/src/compression/zziplib/generic/libzzip.a \
--$(Z_LIBS) $(ALSA_LIBS)
-+$(SDL_LIBS) $(ALSA_LIBS) $(Z_LIBS) $(RTMIDI_LIBS)
- #$(ZZIP_LIBS) read below
-
- # NOTE: The MilkyTracker source contains a MODIFIED version of the zzip
diff --git a/debian/patches/03_debundle-zzlib.patch b/debian/patches/03_debundle-zzlib.patch
deleted file mode 100644
index 2abdab5..0000000
--- a/debian/patches/03_debundle-zzlib.patch
+++ /dev/null
@@ -1,232 +0,0 @@
-Description: Debundle zziplib
- Changes to allow building against the system version of zziplib
-Author: James Cowgill <jcowgill at debian.org>
-Forwarded: no
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/src/compression/ZipExtractor.cpp
-+++ b/src/compression/ZipExtractor.cpp
-@@ -35,7 +35,18 @@
- #include "XModule.h"
- #include "XMFile.h"
- #include "MyIO.h"
--#include "zzip_lib.h"
-+#include <zzip/lib.h>
-+
-+static const struct zzip_plugin_io milkytracker_zzip_io =
-+{
-+ &Myopen,
-+ &Myclose,
-+ &Myread,
-+ &Mylseek,
-+ &Myfsize,
-+ 1, 1,
-+ NULL
-+};
-
- ZipExtractor::ZipExtractor(const PPSystemString& archivePath) :
- archivePath(archivePath)
-@@ -45,7 +56,7 @@ ZipExtractor::ZipExtractor(const PPSyste
- bool ZipExtractor::parseZip(pp_int32& err, bool extract, const PPSystemString* outFile)
- {
- int i;
-- __zzipfd fd;
-+ int fd;
-
- ZZIP_DIR * dir;
- zzip_error_t rv;
-@@ -57,13 +68,13 @@ bool ZipExtractor::parseZip(pp_int32& er
- const SYSCHAR* fileName = archivePath;
- fd = Myopen((const zzip_char_t*)fileName, O_RDONLY);
-
-- if (fd == (__zzipfd)-1)
-+ if (fd == -1)
- {
- err = 1;
- return false;
- }
-
-- if (! (dir = zzip_dir_fdopen(fd, &rv)))
-+ if (! (dir = zzip_dir_fdopen_ext_io(fd, &rv, NULL, (zzip_plugin_io_t) &milkytracker_zzip_io)))
- {
- err = 2;
- return false;
---- a/src/compression/zziplib/MyIO.cpp
-+++ b/src/compression/zziplib/MyIO.cpp
-@@ -9,39 +9,51 @@
- #include "MyIO.h"
- #include "XMFile.h"
-
--__zzipfd Myopen(const zzip_char_t* name, int flags, ...)
-+#define FILE_TABLE_ENTRIES 256
-+static XMFile* file_table[FILE_TABLE_ENTRIES];
-+
-+int Myopen(const zzip_char_t* name, int flags, ...)
- {
- XMFile* f = new XMFile((SYSCHAR*)name, (flags & O_WRONLY) ? true : false);
-- if (!f->isOpen())
-+ if (f->isOpen())
- {
-- delete f;
-- return (__zzipfd)-1;
-+ // Find free space in the file table
-+ // zziplib has a bug where it forbid using fd 0, so skip it
-+ for (int i = 1; i < FILE_TABLE_ENTRIES; i++)
-+ {
-+ if (file_table[i] == NULL)
-+ {
-+ file_table[i] = f;
-+ return i;
-+ }
-+ }
- }
-- //TODO: find a better solution
-- ASSERT(sizeof(f) == sizeof(__zzipfd));
-- return reinterpret_cast<__zzipfd>(f);
-+
-+ delete f;
-+ return -1;
- }
-
--int Myclose(__zzipfd fd)
-+int Myclose(int fd)
- {
-- if (fd == (__zzipfd)-1)
-+ if (fd == -1)
- return -1;
-
-- delete reinterpret_cast<XMFile*>(fd);
-+ delete file_table[fd];
-+ file_table[fd] = NULL;
- return 0;
- }
-
--zzip_ssize_t Myread(__zzipfd fd, void *buffer, zzip_size_t count)
-+zzip_ssize_t Myread(int fd, void *buffer, zzip_size_t count)
- {
-- if (fd == (__zzipfd)-1)
-+ if (fd == -1)
- return -1;
-
-- return reinterpret_cast<XMFile*>(fd)->read(buffer, 1, count);
-+ return file_table[fd]->read(buffer, 1, count);
- }
-
--zzip_off_t Mylseek(__zzipfd fd, zzip_off_t offset, int origin)
-+zzip_off_t Mylseek(int fd, zzip_off_t offset, int origin)
- {
-- if (fd == (__zzipfd)-1)
-+ if (fd == -1)
- return -1;
-
- XMFile::SeekOffsetTypes moveMethod = XMFile::SeekOffsetTypeStart;
-@@ -51,14 +63,14 @@ zzip_off_t Mylseek(__zzipfd fd, zzip_off
- else if (origin == SEEK_END)
- moveMethod = XMFile::SeekOffsetTypeEnd;
-
-- reinterpret_cast<XMFile*>(fd)->seek(offset, moveMethod);
-- return reinterpret_cast<XMFile*>(fd)->pos();
-+ file_table[fd]->seek(offset, moveMethod);
-+ return file_table[fd]->pos();
- }
-
--zzip_off_t Myfsize(__zzipfd fd)
-+zzip_off_t Myfsize(int fd)
- {
-- if (fd == (__zzipfd)-1)
-+ if (fd == -1)
- return -1;
-
-- return reinterpret_cast<XMFile*>(fd)->size();
-+ return file_table[fd]->size();
- }
---- a/src/compression/zziplib/MyIO.h
-+++ b/src/compression/zziplib/MyIO.h
-@@ -9,17 +9,17 @@
- #ifndef __MYIO_H__
- #define __MYIO_H__
-
--#include "zzip_plugin.h"
-+#include <zzip/plugin.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
--__zzipfd Myopen(const zzip_char_t* name, int flags, ...);
--int Myclose(__zzipfd fd);
--zzip_ssize_t Myread(__zzipfd fd, void *buffer, zzip_size_t count);
--zzip_off_t Mylseek(__zzipfd fd, zzip_off_t offset, int origin);
--zzip_off_t Myfsize(__zzipfd fd);
-+int Myopen(const zzip_char_t* name, int flags, ...);
-+int Myclose(int fd);
-+zzip_ssize_t Myread(int fd, void *buffer, zzip_size_t count);
-+zzip_off_t Mylseek(int fd, zzip_off_t offset, int origin);
-+zzip_off_t Myfsize(int fd);
-
- #ifdef __cplusplus
- };
---- a/src/compression/Makefile.am
-+++ b/src/compression/Makefile.am
-@@ -1,4 +1,3 @@
--SUBDIRS = zziplib/generic
- noinst_LIBRARIES = libcompression.a
-
- libcompression_a_SOURCES = PP20.cpp ZipExtractor.cpp zziplib/MyIO.cpp \
-@@ -28,7 +27,6 @@ zlib/generic/zutil.h
-
- AM_CPPFLAGS = -I$(top_srcdir)/src/milkyplay -I$(top_srcdir)/src/ppui \
- -I$(top_srcdir)/src/ppui/osinterface/posix \
---I$(top_srcdir)/src/compression/lha -I$(top_srcdir)/src/compression/zziplib \
---I$(top_srcdir)/src/compression/zziplib/generic
-+-I$(top_srcdir)/src/compression/lha -I$(top_srcdir)/src/compression/zziplib
-
- #AM_CPPFLAGS = -I../ppui -I../ppui/osinterface -I../ppui/osinterface/posix
---- a/configure.ac
-+++ b/configure.ac
-@@ -20,7 +20,7 @@ AC_PROG_MKDIR_P
- AC_HEADER_DIRENT
- AC_HEADER_STDC
- AC_CHECK_HEADERS_ONCE([fcntl.h inttypes.h limits.h malloc.h memory.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/time.h unistd.h],,AC_MSG_ERROR([One or more required header files are missing]))
--# AC_CHECK_HEADER(zzip/lib.h,,AC_MSG_ERROR("Cannot find zzip/lib.h"))
-+AC_CHECK_HEADER(zzip/lib.h,,AC_MSG_ERROR("Cannot find zzip/lib.h"))
-
- # Checks for libraries.
- AC_ARG_WITH([alsa],
-@@ -48,8 +48,8 @@ if test "x$with_alsa" != xno; then
- fi
-
- AC_SEARCH_LIBS(gzopen, z, AC_DEFINE([HAVE_LIBZ], [1], [Define to 1 if you have the 'libz' library.]),)
--#AC_CHECK_LIB(zzip, zzip_file_open,,AC_MSG_ERROR("Cannot find -lzzip"))
--#PKG_CHECK_MODULES([ZZIP],[zziplib >= 0.10.75])
-+AC_CHECK_LIB(zzip, zzip_file_open,,AC_MSG_ERROR("Cannot find -lzzip"))
-+PKG_CHECK_MODULES([ZZIP],[zziplib >= 0.10.75])
-
- SDL_VERSION=1.2.0
- AM_PATH_SDL($SDL_VERSION,, AC_MSG_ERROR([Please install libSDL]))
-@@ -122,7 +122,6 @@ AC_CONFIG_HEADER(config.h)
- AC_CONFIG_FILES([Makefile
- src/Makefile
- src/compression/Makefile
-- src/compression/zziplib/generic/Makefile
- src/fx/Makefile
- src/midi/Makefile
- src/milkyplay/Makefile
---- a/src/tracker/Makefile.am
-+++ b/src/tracker/Makefile.am
-@@ -76,14 +76,7 @@ $(top_builddir)/src/ppui/osinterface/lib
- $(top_builddir)/src/ppui/libppui.a \
- $(top_builddir)/src/ppui/osinterface/libosinterface.a \
- $(top_builddir)/src/fx/libfx.a $(COMPRESSION_LIB) $(MIDI_LIB) \
--$(top_builddir)/src/compression/zziplib/generic/libzzip.a \
--$(SDL_LIBS) $(ALSA_LIBS) $(Z_LIBS) $(RTMIDI_LIBS)
--#$(ZZIP_LIBS) read below
--
--# NOTE: The MilkyTracker source contains a MODIFIED version of the zzip
--# library, which is statically linked to the executable. Simply changing the
--# build scripts to link against the system libzzip will result in non-working
--# zip support!
-+$(SDL_LIBS) $(ALSA_LIBS) $(Z_LIBS) $(RTMIDI_LIBS) $(ZZIP_LIBS)
-
- EXTRA_DIST = carbon/Carbon_Definitions.h carbon/Carbon_main.cpp \
- carbon/InfoPlist.strings carbon/KeyTranslation.cpp carbon/KeyTranslation.h \
diff --git a/debian/patches/04_use-lhasa.patch b/debian/patches/04_use-lhasa.patch
deleted file mode 100644
index 231b2a6..0000000
--- a/debian/patches/04_use-lhasa.patch
+++ /dev/null
@@ -1,268 +0,0 @@
-Description: Implement lha decompression using lhasa
- The original lha decompressor supplied with MilkyTracker is non-free, so
- reimplement the decompression module using the free lhasa library.
-Author: James Cowgill <jcowgill at debian.org>
-Forwarded: no
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/src/compression/Makefile.am
-+++ b/src/compression/Makefile.am
-@@ -1,17 +1,14 @@
- noinst_LIBRARIES = libcompression.a
-
- libcompression_a_SOURCES = PP20.cpp ZipExtractor.cpp zziplib/MyIO.cpp \
--Decompressor.cpp DecompressorUMX.cpp DecompressorPP20.cpp lha/unlha.cpp \
-+Decompressor.cpp DecompressorUMX.cpp DecompressorPP20.cpp \
- DecompressorZIP.cpp DecompressorLHA.cpp DecompressorGZIP.cpp \
- DecompressorLZX.cpp unlzx.cpp
-
- noinst_HEADERS = PP20.h ZipExtractor.h zziplib/MyIO.h DecompressorLHA.h \
- DecompressorUMX.h DecompressorGZIP.h AIFFWriter.h Decompressor.h \
--DecompressorPP20.h DecompressorQT.h lha/lharc.h DecompressorZIP.h \
--DecompressorLZX.h unlzx.h \
--lha/dhuf.inl lha/extract.inl lha/header.inl lha/huf.inl lha/larc.inl \
--lha/lharc.h lha/lhext.inl lha/maketbl.inl lha/shuf.inl lha/slidehuf.h \
--lha/slide.inl lha/unlha32.h
-+DecompressorPP20.h DecompressorQT.h DecompressorZIP.h \
-+DecompressorLZX.h unlzx.h
-
- EXTRA_DIST = DecompressorQT.mm AIFFWriter.m zlib/generic/adler32.cpp \
- zlib/generic/compress.cpp zlib/generic/crc32.cpp zlib/generic/crc32.h \
-@@ -27,6 +24,6 @@ zlib/generic/zutil.h
-
- AM_CPPFLAGS = -I$(top_srcdir)/src/milkyplay -I$(top_srcdir)/src/ppui \
- -I$(top_srcdir)/src/ppui/osinterface/posix \
---I$(top_srcdir)/src/compression/lha -I$(top_srcdir)/src/compression/zziplib
-+-I$(top_srcdir)/src/compression/zziplib -I/usr/include/liblhasa-1.0
-
- #AM_CPPFLAGS = -I../ppui -I../ppui/osinterface -I../ppui/osinterface/posix
---- a/src/tracker/Makefile.am
-+++ b/src/tracker/Makefile.am
-@@ -67,8 +67,7 @@ $(top_builddir)/src/compression/Decompre
- $(top_builddir)/src/compression/DecompressorZIP.o \
- $(top_builddir)/src/compression/zziplib/MyIO.o \
- $(top_builddir)/src/compression/PP20.o \
--$(top_builddir)/src/compression/ZipExtractor.o \
--$(top_builddir)/src/compression/lha/unlha.o
-+$(top_builddir)/src/compression/ZipExtractor.o
-
- # add -lGL for experimental OpenGL support (and see ../ppui/Makefile.am)
- milkytracker_LDADD = $(top_builddir)/src/milkyplay/libmilkyplay.a \
-@@ -76,7 +75,7 @@ $(top_builddir)/src/ppui/osinterface/lib
- $(top_builddir)/src/ppui/libppui.a \
- $(top_builddir)/src/ppui/osinterface/libosinterface.a \
- $(top_builddir)/src/fx/libfx.a $(COMPRESSION_LIB) $(MIDI_LIB) \
--$(SDL_LIBS) $(ALSA_LIBS) $(Z_LIBS) $(RTMIDI_LIBS) $(ZZIP_LIBS)
-+$(SDL_LIBS) $(ALSA_LIBS) $(Z_LIBS) $(RTMIDI_LIBS) $(ZZIP_LIBS) -llhasa
-
- EXTRA_DIST = carbon/Carbon_Definitions.h carbon/Carbon_main.cpp \
- carbon/InfoPlist.strings carbon/KeyTranslation.cpp carbon/KeyTranslation.h \
---- a/src/compression/DecompressorLHA.cpp
-+++ b/src/compression/DecompressorLHA.cpp
-@@ -28,72 +28,74 @@
- *
- */
-
-+#include <lhasa.h>
-+
- #include "DecompressorLHA.h"
- #include "XMFile.h"
- #include "XModule.h"
--#include "unlha32.h"
-
--// -- LHA --------------------------------------------------------------------
--class XMFileStreamer : public CLhaArchive::StreamerBase
-+#define LHA_BUFFER_SIZE 0x10000
-+
-+namespace
- {
--private:
-- XMFile& f;
-+ static int lha_read_callback(void *handle, void *buf, size_t buf_len)
-+ {
-+ return static_cast<XMFile*>(handle)->read(buf, 1, buf_len);
-+ }
-
-- pp_uint32 currentPos;
-+ static const LHAInputStreamType lha_callbacks =
-+ {
-+ lha_read_callback,
-+ NULL,
-+ NULL
-+ };
-
--protected:
-- virtual pp_uint8 get(pp_uint32 pos)
-+ // Simple wrapper for lha_reader_*
-+ class LHAReaderWrapper
- {
-- pp_uint8 result;
-- if (currentPos != pos)
-+ public:
-+ explicit LHAReaderWrapper(XMFile& file)
- {
-- f.seek(pos);
-- result = f.readByte();
-- currentPos = f.pos();
-+ // Open input stream
-+ input_stream = lha_input_stream_new(&lha_callbacks, &file);
-+ if (input_stream == NULL)
-+ return;
-+
-+ // Open reader
-+ reader = lha_reader_new(input_stream);
- }
-- else
-+
-+ bool isOpen() const
- {
-- result = f.readByte();
-- currentPos = f.pos();
-+ return reader != NULL;
- }
--
-- return result;
-- }
-
--public:
-- XMFileStreamer(XMFile& f) :
-- f(f)
-- {
-- currentPos = f.pos();
-- }
-+ LHAFileHeader* nextFile()
-+ {
-+ return lha_reader_next_file(reader);
-+ }
-
-- virtual void read(void* buffer, pp_uint32 from, pp_uint32 len)
-- {
-- if (currentPos != from)
-+ size_t read(void* buf, size_t length)
- {
-- f.seek(from);
-- f.read(buffer, 1, len);
-- currentPos = f.pos();
-+ return lha_reader_read(reader, buf, length);
- }
-- else
-+
-+ ~LHAReaderWrapper()
- {
-- f.read(buffer, 1, len);
-- currentPos = f.pos();
-+ if (reader != NULL)
-+ lha_reader_free(reader);
-+ if (input_stream != NULL)
-+ lha_input_stream_free(input_stream);
- }
-- }
--};
-
--struct ModuleIdentifyNotifier : public CLhaArchive::IDNotifier
--{
-- virtual bool identify(void* buffer, pp_uint32 len) const
-- {
-- mp_ubyte buff[XModule::IdentificationBufferSize];
-- memset(buff, 0, sizeof(buff));
-- memcpy(buff, buffer, len > sizeof(buff) ? sizeof(buff) : len);
--
-- return XModule::identifyModule(buff) != NULL;
-- }
--};
-+ private:
-+ LHAInputStream* input_stream = NULL;
-+ LHAReader* reader = NULL;
-+
-+ LHAReaderWrapper(const LHAReaderWrapper&) {}
-+ LHAReaderWrapper& operator=(const LHAReaderWrapper&) {}
-+ };
-+}
-
- DecompressorLHA::DecompressorLHA(const PPSystemString& filename) :
- DecompressorBase(filename)
-@@ -102,15 +104,14 @@ DecompressorLHA::DecompressorLHA(const P
-
- bool DecompressorLHA::identify(XMFile& f)
- {
-- f.seek(0);
--
-- XMFileStreamer streamer(f);
-+ f.seek(0);
-
-- CLhaArchive archive(streamer, f.size(), NULL);
--
-- bool res = archive.IsArchive() != 0;
-+ // Attempt to create the reader and read the header of the first file
-+ LHAReaderWrapper reader(f);
-+ if (!reader.isOpen())
-+ return false;
-
-- return res;
-+ return reader.nextFile() != NULL;
- }
-
- const PPSimpleVector<Descriptor>& DecompressorLHA::getDescriptors(Hints hint) const
-@@ -127,31 +128,46 @@ bool DecompressorLHA::decompress(const P
- if (!f.isOpen())
- return false;
-
-- XMFileStreamer streamer(f);
--
-- ModuleIdentifyNotifier idnotifier;
--
-- CLhaArchive archive(streamer, f.size(), &idnotifier);
--
-- if (!archive.IsArchive())
-+ // Create reader object
-+ LHAReaderWrapper reader(f);
-+ if (!reader.isOpen())
- return false;
-
-- pp_uint32 result = archive.ExtractFile();
--
-- if (result && archive.GetOutputFile())
-+ // Loop through each file until we find a sutible module
-+ while (1)
- {
-- const char* id = XModule::identifyModule(archive.GetOutputFile());
-- if (id)
-+ LHAFileHeader* header = reader.nextFile();
-+ if (header == NULL)
-+ break;
-+
-+ // Skip directories and symlinks
-+ if (strcmp(header->compress_method, LHA_COMPRESS_TYPE_DIR) == 0)
-+ continue;
-+
-+ // Identify the current file
-+ mp_ubyte buf[LHA_BUFFER_SIZE];
-+ memset(buf, 0, sizeof(buf));
-+ size_t bytes_read = reader.read(buf, sizeof(buf));
-+
-+ if (bytes_read > 0 && XModule::identifyModule(buf) != NULL)
- {
-+ // Write to output file
- XMFile outFile(outFilename, true);
- if (!outFile.isOpenForWriting())
- return false;
--
-- outFile.write(archive.GetOutputFile(), 1, archive.GetOutputFileLength());
-- return true;
-+
-+ // Decompress into outFile
-+ do
-+ {
-+ outFile.write(buf, 1, bytes_read);
-+ }
-+ while ((bytes_read = reader.read(buf, sizeof(buf))) > 0);
-+
-+ return (bytes_read == 0);
- }
- }
--
-+
-+ // No sutible modules found
- return false;
- }
-
diff --git a/debian/patches/series b/debian/patches/series
index 2322794..e69de29 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +0,0 @@
-01_add-alsalibs.patch
-02_debundle-rtmidi.patch
-03_debundle-zzlib.patch
-04_use-lhasa.patch
--
milkytracker packaging
More information about the pkg-multimedia-commits
mailing list