tfussell / miniz-cpp

A cross-platform header-only C++14 library for reading and writing ZIP files
MIT License
229 stars 77 forks source link

Correct invalid std::size_t conversions from #9

Open kstenschke opened 4 years ago

kstenschke commented 4 years ago

Compilation prior to this change failed w/ message invalid conversion from ‘std::size_t ()(void, uint64_t, const void, std::size_t) {aka long unsigned int ()(void, long unsigned int, const void, long unsigned int)}’ to ‘mz_file_writefunc {aka long unsigned int ()(void, long long unsigned int, const void*, long unsigned int)}’ [-fpermissive] archive->m_pWrite = &detail::write_callback;

nyckmaia commented 3 years ago

I just added this library in my C++ project and I got this compilation time error:

/home/nyck/Desktop/maia/maia_app/maialib/include/miniz-cpp/zip_file.hpp:5583: error: invalid conversion from ‘std::size_t (*)(void*, uint64_t, const void*, std::size_t)’ {aka ‘long unsigned int (*)(void*, long unsigned int, const void*, long unsigned int)’} to ‘mz_file_write_func’ {aka ‘long unsigned int (*)(void*, long long unsigned int, const void*, long unsigned int)’} [-fpermissive]
In file included from /home/nyck/Desktop/maia/maia_app/maialib/include/score.h:15,
                 from /home/nyck/Desktop/maia/maia_app/maialib/src/orq_functions.cpp:5:
/home/nyck/Desktop/maia/maia_app/maialib/include/miniz-cpp/zip_file.hpp: In member function ‘void miniz_cpp::zip_file::start_write()’:
/home/nyck/Desktop/maia/maia_app/maialib/include/miniz-cpp/zip_file.hpp:5583:38: error: invalid conversion from ‘std::size_t (*)(void*, uint64_t, const void*, std::size_t)’ {aka ‘long unsigned int (*)(void*, long unsigned int, const void*, long unsigned int)’} to ‘mz_file_write_func’ {aka ‘long unsigned int (*)(void*, long long unsigned int, const void*, long unsigned int)’} [-fpermissive]
 5583 |                 archive_->m_pWrite = &detail::write_callback;
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      std::size_t (*)(void*, uint64_t, const void*, std::size_t) {aka long unsigned int (*)(void*, long unsigned int, const void*, long unsigned int)}

What can I do to fix it?

nyckmaia commented 1 year ago

Hi, I got the same error 3 years later... Is there a way to fix it?

/mnt/c/Users/nyck/Desktop/maialib/core/external/miniz-cpp/zip_file.hpp: In member function ‘void miniz_cpp::zip_file::start_write()’:
      /mnt/c/Users/nyck/Desktop/maialib/core/external/miniz-cpp/zip_file.hpp:6340:38: error: invalid conversion from ‘std::size_t (*)(void*, uint64_t, const void*, std::size_t)’ {aka ‘long unsigned int (*)(void*, long unsigned int, const void*, long unsigned int)’} to ‘mz_file_write_func’ {aka ‘long unsigned int (*)(void*, long long unsigned int, const void*, long unsigned int)’} [-fpermissive]
       6340 |                 archive_->m_pWrite = &detail::write_callback;
            |                                      ^~~~~~~~~~~~~~~~~~~~~~~
            |                                      |
            |                                      std::size_t (*)(void*, uint64_t, const void*, std::size_t) {aka long unsigned int (*)(void*, long unsigned int, const void*, long unsigned int)}
      /mnt/c/Users/nyck/Desktop/maialib/core/external/miniz-cpp/zip_file.hpp:6366:30: error: invalid conversion from ‘std::size_t (*)(void*, uint64_t, const void*, std::size_t)’ {aka ‘long unsigned int (*)(void*, long unsigned int, const void*, long unsigned int)’} to ‘mz_file_write_func’ {aka ‘long unsigned int (*)(void*, long long unsigned int, const void*, long unsigned int)’} [-fpermissive]
       6366 |         archive_->m_pWrite = &detail::write_callback;
            |                              ^~~~~~~~~~~~~~~~~~~~~~~
            |                              |
            |                              std::size_t (*)(void*, uint64_t, const void*, std::size_t) {aka long unsigned int (*)(void*, long unsigned int, const void*, long unsigned int)}
      ninja: build stopped: subcommand failed.