Skip to content
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

Define and expose user-defined error handler #156

Merged
merged 12 commits into from
Aug 17, 2022

Conversation

flomnes
Copy link
Contributor

@flomnes flomnes commented Jul 25, 2022

No description provided.

Copy link
Owner

@ctabin ctabin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flomnes Thanks for the PR ! I left a few comments. Can you also rebase, since there is a conflict.

src/libzippp.h Outdated
@@ -538,6 +547,8 @@ namespace libzippp {

void** bufferData;
libzippp_uint64 bufferLength;

ErrorHandlerCallback errorHandlingCallback = nullptr;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialize the variable in the constructor initializer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -526,6 +531,10 @@ namespace libzippp {
inline double getProgressPrecision(void) const { return progressPrecision; }
void setProgressPrecision(double p) { progressPrecision = p; }

void setErrorHandlerCallback(const ErrorHandlerCallback& callback) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, see README.md

@@ -99,14 +99,19 @@ struct zip_source;
namespace libzippp {
class ZipEntry;
class ZipProgressListener;

/**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an empty line before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/libzippp.h Outdated Show resolved Hide resolved
/**
* Represents a ZIP archive. This class provides useful methods to handle an archive
* content. It is simply a wrapper around libzip.
*/
class LIBZIPPP_API ZipArchive {
public:

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let this empty line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/libzippp.cpp Outdated
@@ -310,7 +330,11 @@ int ZipArchive::close(void) {
zip_int64_t newLength = bufferLength + increment;
sourceBuffer = realloc(sourceBuffer, newLength * sizeof(char));
if(sourceBuffer==nullptr) {
if (errorHandlingCallback) {
callErrorHandlingCb(zipHandle, errorHandlingCallback);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beware of the indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

flomnes and others added 2 commits July 26, 2022 12:35
Co-authored-by: Cédric Tabin <tabin.cedric@gmail.com>
@flomnes flomnes force-pushed the feature/user-defined-error-handler branch from 85351c4 to 6a6268f Compare July 26, 2022 10:35
@flomnes
Copy link
Contributor Author

flomnes commented Aug 14, 2022

Hi @ctabin, I've applied the requested changes. I've also added a forgotten call to the callback, see e0cdedc.

@flomnes flomnes requested a review from ctabin August 14, 2022 18:39
@ctabin
Copy link
Owner

ctabin commented Aug 17, 2022

@flomnes LGTM. Thanks for the amazing work !

@ctabin ctabin merged commit e66c448 into ctabin:master Aug 17, 2022
@flomnes flomnes deleted the feature/user-defined-error-handler branch August 18, 2022 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants