Skip to content

Commit

Permalink
fix link error for monolithic build mode: we use zlib-ng instead of z…
Browse files Browse the repository at this point in the history
…lib.
  • Loading branch information
GerHobbelt committed Nov 26, 2024
1 parent e5d9582 commit aed6541
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dcmdata/include/dcmtk/dcmdata/dcistrmz.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class DCMTK_DCMDATA_EXPORT DcmZLibInputFilter: public DcmInputFilter
DcmProducer *current_;

/// pointer to struct z_stream object containing the zlib status
z_streamp zstream_;
zng_streamp zstream_;

/// status
OFCondition status_;
Expand Down
2 changes: 1 addition & 1 deletion dcmdata/include/dcmtk/dcmdata/dcostrmz.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class DCMTK_DCMDATA_EXPORT DcmZLibOutputFilter: public DcmOutputFilter
DcmConsumer *current_;

/// pointer to struct z_stream object containing the zlib status
z_streamp zstream_;
zng_streamp zstream_;

/// status
OFCondition status_;
Expand Down
16 changes: 8 additions & 8 deletions dcmdata/libsrc/dcistrmz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ OFGlobal<OFBool> dcmZlibExpectRFC1950Encoding(OFFalse);

// helper methods to fix old-style casts warnings
BEGIN_EXTERN_C
static int OFinflateInit(z_stream* const stream)
static int OFinflateInit(zng_stream* const stream)
{
return inflateInit(stream);
return zng_inflateInit(stream);
}

static int OFinflateInit2(z_stream* const stream)
static int OFinflateInit2(zng_stream* const stream)
{
return inflateInit2(stream, -MAX_WBITS);
return zng_inflateInit2(stream, -MAX_WBITS);
}
END_EXTERN_C

DcmZLibInputFilter::DcmZLibInputFilter()
: DcmInputFilter()
, current_(NULL)
, zstream_(new z_stream)
, zstream_(new zng_stream)
, status_(EC_MemoryExhausted)
, eos_(OFFalse)
, inputBuf_(new unsigned char[DCMZLIBINPUTFILTER_BUFSIZE])
Expand Down Expand Up @@ -104,7 +104,7 @@ DcmZLibInputFilter::~DcmZLibInputFilter()
{
if (zstream_)
{
inflateEnd(zstream_); // discards any unprocessed input and does not flush any pending output
zng_inflateEnd(zstream_); // discards any unprocessed input and does not flush any pending output
delete zstream_;
}
delete[] inputBuf_;
Expand Down Expand Up @@ -303,7 +303,7 @@ offile_off_t DcmZLibInputFilter::decompress(const void *buf, offile_off_t buflen
{
zstream_->next_in = OFstatic_cast(Bytef *, inputBuf_ + inputBufStart_);
zstream_->avail_in = OFstatic_cast(uInt, numBytes);
astatus = inflate(zstream_, 0);
astatus = zng_inflate(zstream_, 0);

if (astatus == Z_OK || astatus == Z_BUF_ERROR) { /* everything OK */ }
else if (astatus == Z_STREAM_END)
Expand Down Expand Up @@ -348,7 +348,7 @@ offile_off_t DcmZLibInputFilter::decompress(const void *buf, offile_off_t buflen
{
zstream_->next_in = OFstatic_cast(Bytef *, inputBuf_);
zstream_->avail_in = OFstatic_cast(uInt, inputBufCount_);
astatus = inflate(zstream_, 0);
astatus = zng_inflate(zstream_, 0);

if (astatus == Z_OK || astatus == Z_BUF_ERROR) { /* everything OK */ }
else if (astatus == Z_STREAM_END)
Expand Down
14 changes: 7 additions & 7 deletions dcmdata/libsrc/dcostrmz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,26 @@ OFGlobal<int> dcmZlibCompressionLevel(Z_DEFAULT_COMPRESSION);

// helper method to fix old-style casts warnings
BEGIN_EXTERN_C
static int OFdeflateInit(z_stream* const stream, int level)
static int OFdeflateInit(zng_stream* const stream, int level)
{
#ifdef ZLIB_ENCODE_RFC1950_HEADER
/* create deflated ZLIB format instead of deflated bitstream format
* (i.e. RFC 1950 instead of RFC 1951).
* THE RESULTING BITSTREAM IS NOT DICOM COMPLIANT!
* Use only for testing, and use with care.
*/
return deflateInit(stream, level);
return zng_deflateInit(stream, level);
#else
/* windowBits is passed < 0 to suppress zlib header */
return deflateInit2(stream, level, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
return zng_deflateInit2(stream, level, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
#endif
}
END_EXTERN_C

DcmZLibOutputFilter::DcmZLibOutputFilter()
: DcmOutputFilter()
, current_(NULL)
, zstream_(new z_stream)
, zstream_(new zng_stream)
, status_(EC_MemoryExhausted)
, flushed_(OFFalse)
, inputBuf_(new unsigned char[DCMZLIBOUTPUTFILTER_BUFSIZE])
Expand Down Expand Up @@ -88,7 +88,7 @@ DcmZLibOutputFilter::~DcmZLibOutputFilter()
{
if (zstream_)
{
deflateEnd(zstream_); // discards any unprocessed input and does not flush any pending output
zng_deflateEnd(zstream_); // discards any unprocessed input and does not flush any pending output
delete zstream_;
}
delete[] inputBuf_;
Expand Down Expand Up @@ -240,7 +240,7 @@ offile_off_t DcmZLibOutputFilter::compress(const void *buf, offile_off_t buflen,
{
zstream_->next_out = OFstatic_cast(Bytef *, outputBuf_ + outputBufStart_ + outputBufCount_);
zstream_->avail_out = OFstatic_cast(uInt, DCMZLIBOUTPUTFILTER_BUFSIZE - (outputBufStart_ + outputBufCount_));
zstatus = deflate(zstream_, (finalize ? Z_FINISH : 0));
zstatus = zng_deflate(zstream_, (finalize ? Z_FINISH : 0));

if (zstatus == Z_OK || zstatus == Z_BUF_ERROR) { /* everything OK */ }
else if (zstatus == Z_STREAM_END) flushed_ = OFTrue;
Expand All @@ -260,7 +260,7 @@ offile_off_t DcmZLibOutputFilter::compress(const void *buf, offile_off_t buflen,
{
zstream_->next_out = OFstatic_cast(Bytef *, outputBuf_ + (outputBufStart_ + outputBufCount_ - DCMZLIBOUTPUTFILTER_BUFSIZE));
zstream_->avail_out = OFstatic_cast(uInt, DCMZLIBOUTPUTFILTER_BUFSIZE - outputBufCount_);
zstatus = deflate(zstream_, (finalize ? Z_FINISH : 0));
zstatus = zng_deflate(zstream_, (finalize ? Z_FINISH : 0));

if (zstatus == Z_OK || zstatus == Z_BUF_ERROR) { /* everything OK */ }
else if (zstatus == Z_STREAM_END) flushed_ = OFTrue;
Expand Down

0 comments on commit aed6541

Please sign in to comment.