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

RFC: Hide zlib and expat libs from the user of Poco libraries #4579

Closed
wants to merge 3 commits into from

Conversation

teksturi
Copy link
Contributor

@teksturi teksturi commented Jun 7, 2024

Seperete zlib and expat so they are only expose internally. There should not be reason for user to use these.

This makes #4358 easier to implement as all external libraries are not exposed to end user.

Kari Argillander added 3 commits June 7, 2024 20:31
Nothing use this and it is not even included in Visual Studio project
files. Remove it so it will not confuse any more.
Hide zlib completly from user. This way we do not need to publish zlib.h
or zconfig.h.

As we now have two different pointer initalizing in constructor I choose
to use unique pointers so it is more obvious those are safe. I also
choose to use make_unique which default initalize z_stream_t. This makes
code more readable as we do not need to specifie every field of
z_stream_t. It really should not matter much if we initialize couple
field for nothing. If does we should add comment about that. Still
keeping _buffer without inializing as it is quite big.
Hide expat completly from user. This way we do not need to publish
expat.h or expat_external.h.

I move also headers to orignal locations so diff is smaller compared to
original.
@teksturi
Copy link
Contributor Author

teksturi commented Jun 7, 2024

Please say if we example still want to expose ParserEngine. I will try to make necessary changes for that. I do not remember exactly if that would be easy as this has been quite long in my POC box.

Also if this is path we will take I also need to check VS project files more closely.

@@ -104,7 +101,7 @@ class Foundation_API DeflatingIOS: public virtual std::ios
/// order of the stream buffer and base classes.
{
public:
DeflatingIOS(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
DeflatingIOS(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Going from Z_DEFAULT_COMPRESSION to just -1 is a loss of info for users. Can we add a POCO_DEFAULT_COMPRESSION const for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

There is an issue with other (non-default) compression levels whenever the user decided to go with non-default.

Shall Poco maintain a copy of compression values that are identical with the ones in zlib?

@andrewauclair , @teksturi

#include "Poco/zlib.h"
#endif

struct z_stream_s;
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think this really needs to be here. Just do struct z_stream_s* _pZstr; in the class (unless I'm not seeing another usage here).

@matejk matejk changed the title RFC: Seperete zlib and expat libs from user RFC: Hide zlib and expat libs from the user of Poco libraries Jun 10, 2024
#include <zlib.h>
#else
// Quirk before we move zlib to external libs.
#include "../../src/zlib.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

The path to zlih.h shall be added CMake's include path instead.

@matejk
Copy link
Contributor

matejk commented Jun 18, 2024

@teksturi , any updates on this?

@matejk
Copy link
Contributor

matejk commented Oct 4, 2024

Replaced with #4724.

@matejk matejk closed this Oct 4, 2024
matejk added a commit that referenced this pull request Oct 4, 2024
) (#4724)

* foundation: Remove unused ucp.h

Nothing use this and it is not even included in Visual Studio project
files. Remove it so it will not confuse any more.

* foundation: Hide zlib from user

Hide zlib completly from user. This way we do not need to publish zlib.h
or zconfig.h.

As we now have two different pointer initalizing in constructor I choose
to use unique pointers so it is more obvious those are safe. I also
choose to use make_unique which default initalize z_stream_t. This makes
code more readable as we do not need to specifie every field of
z_stream_t. It really should not matter much if we initialize couple
field for nothing. If does we should add comment about that. Still
keeping _buffer without inializing as it is quite big.

* xml: Hide expat and ParserEngine from user

Hide expat completly from user. This way we do not need to publish
expat.h or expat_external.h.

I move also headers to orignal locations so diff is smaller compared to
original.

* chore(Foundation): Compression level constants

---------

Co-authored-by: Kari Argillander <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants