-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
player: add zip implementation and improve rar implementation #101
base: master
Are you sure you want to change the base?
Conversation
- better and more specific error handling - signatures placed in derived archive classes - add arc_entry_t to make fewer virtual funcs necessary - use std::unique_ptr so it always deletes on scope exit
I'll try to take a look on this probably tomorrow, this week is pretty busy for me. |
This was with gcc4.9 If I enabled unrar, two --- a/player/Archive_Reader.cpp
+++ b/player/Archive_Reader.cpp
@@ -3,8 +3,8 @@
blargg_err_t const arc_eof = "Archive: End of file";
-#ifdef RARDLL
-
#include <string.h>
+#ifdef RARDLL
+
static const int erar_offset = 10;
static blargg_err_t const erar_handle = "Failed to instantiate RAR handle"; As for rest of the errors, I guess you need some new version of libarchive?? If so, you should specify it in cmake'ry (my libarchive is 2.8.3) |
Or better, polish the code to ensure it will build with older version too to maintain compatibility with older distros environments (even some of supported LTS distro versions will have a similiar older version). |
That should hopefully take care of the unrecognized type and But it sounds like there are still some functions being used which either didn't exist before or had their name changed. Also, i'm using libarchive 3.7.7-1. |
8927766
to
1848cff
Compare
Don't know what to do with |
From what I can tell, a filtering feature hadn't been added yet by that version. I think we can just leave that function call out. "filter all" seems to be the default behavior anyway, and it still works on my end when I take it out. |
Ah, obviously, So, the following patch makes it build for me: diff --git a/player/Archive_Reader.cpp b/player/Archive_Reader.cpp
index 6423d18..a272523 100644
--- a/player/Archive_Reader.cpp
+++ b/player/Archive_Reader.cpp
@@ -102,6 +102,16 @@ static blargg_err_t const zerrs[] = {
};
#endif // HAVE_ZLIB_H
+#if (ARCHIVE_VERSION_NUMBER < 3000000)
+static inline int archive_read_free(struct archive *a) {
+ return archive_read_finish(a);
+}
+
+static inline int archive_read_support_filter_all(struct archive *a) {
+ return archive_read_support_compression_all(a);
+}
+#endif
+
blargg_err_t Zip_Reader::open_zip( const char* path ) {
if ( !(zip = archive_read_new()) )
return zip_err_struct; |
That'd be OK too, I guess.. (not tried though) |
Actually, I think you're right. Looks like "filter" was just a name change from "compression" |
Requires libarchive. Zlib is an optional requirement for decompressing individually gzipped files within a zip. The zip reader should still work somewhat without zlib, just not in as many scenarios.
Latest rev builds cleanly for me. |
Improvements to rar reader:
arc_entry_t
to reduce the amount of virtual functionsstd::unique_ptr
so our reader always cleans up on scope exitThe zip implementation requires libarchive. Zlib is an optional requirement for decompressing
individually gzipped files within a zip. The zip reader should still work somewhat without zlib, just not in as many scenarios.
EDIT: One more change was made. Some zips contain one multi-track file like .kss along with several .m3u's, so the reader now accounts for that scenario.