c++ - Why isn't zlibs z_stream::next_in const? -


i integrating code stack-overflow question, uncompresses data qbytearray application.

since enabled compiler errors, have reinterpret_cast , const_cast qbytearray::data():

z_stream strm; strm.next_in = reinterpret_cast<bytef *>(const_cast<char *>(data.data())); 

why input parameter non-const? in opinion, suggests, data somehow modified, not want , not believe happening.

by default z_stream interface functions aren't const, presumably legacy reasons.

you can build zlib const support running configure --const.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -