-
Notifications
You must be signed in to change notification settings - Fork 96
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
Missing cancel option #166
Comments
Hi @Bob590, This looks great ! I always welcome any PR :-) |
Hi @ctabin, |
Hi @Bob590, Thanks for the PR. Unfortunately both of them are failing the Travis CI. Can you have a look ? |
Hi @ctabin, |
I see only now that also the test.cpp must be changed in order to update the ZipProgressListener... |
Done all. Now it should compile and pass the CI. :-) |
Done in #167. |
I'm missing the cancel option... but i have found a way to add it myself.
I have to zip (STORE) a lot of files of about 130MB each – they are already compressed).
I also have the specification that this long zipping activity should be aborted at any time.
The current library implementation doesn’t allow this!
The progress callback is handled but the cancel callback is missing.
I have added the cancel callback:
int progress_cancel_callback(zip archive, void ud) {
ZipArchive za = static_cast<ZipArchive>(ud);
vector<ZipProgressListener*> listeners = za->getProgressListeners();
for(vector<ZipProgressListener*>::const_iterator it=listeners.begin() ; it!=listeners.end() ; ++it) {
ZipProgressListener* listener = *it;
if(listener->cancel())
return 1;
}
return 0;
}
And registered it:
int ZipArchive::close(void) {
if (isOpen()) {
Finally I have modified the progress listener:
I have also made some small changes (basically some cast) and then added this on top of the .cpp file:
#ifdef WIN32
// Disable compiler warning for strcpy
#define _CRT_SECURE_NO_WARNINGS
#endif
All these minor changes were done to avoid VS2017 warnings when compiling.
Now the compilation is CLEAN. ;-)
If you agree I'll make a new Pull Request for your review.
The text was updated successfully, but these errors were encountered: