-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
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.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
#include "Poco/zlib.h" | ||
#endif | ||
|
||
struct z_stream_s; |
There was a problem hiding this comment.
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).
#include <zlib.h> | ||
#else | ||
// Quirk before we move zlib to external libs. | ||
#include "../../src/zlib.h" |
There was a problem hiding this comment.
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.
@teksturi , any updates on this? |
Replaced with #4724. |
) (#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]>
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.