zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.71k stars 2.35k forks source link

Issue 4478: Fix sprintf deprecation error failing build on macOS #4481

Closed nighthawk24 closed 1 year ago

nighthawk24 commented 1 year ago

Fixes https://github.com/zeromq/libzmq/issues/4478 Fixes https://github.com/zcash/zcash/issues/6006 & https://github.com/zcash/zcash/issues/6296

bluca commented 1 year ago

Please add a relicense statement https://github.com/zeromq/libzmq/tree/master/RELICENSE

bluca commented 1 year ago
../../src/tcp_address.cpp: In instantiation of ‘std::string make_address_string(const char*, uint16_t, const char (&)[N1], const char (&)[N2]) [with long unsigned int N1 = 8; long unsigned int N2 = 3; std::string = std::__cxx11::basic_string<char>; uint16_t = short unsigned int]’:
../../src/tcp_address.cpp:158:37:   required from here
../../src/tcp_address.cpp:132:27: error: argument to ‘sizeof’ in ‘int snprintf(char*, size_t, const char*, ...)’ call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
  132 |     pos += snprintf (pos, sizeof(pos), "%d", ntohs (port_));
      |                           ^~~~~~~~~~~
../../src/tcp_address.cpp: In instantiation of ‘std::string make_address_string(const char*, uint16_t, const char (&)[N1], const char (&)[N2]) [with long unsigned int N1 = 7; long unsigned int N2 = 2; std::string = std::__cxx11::basic_string<char>; uint16_t = short unsigned int]’:
../../src/tcp_address.cpp:161:37:   required from here
../../src/tcp_address.cpp:132:27: error: argument to ‘sizeof’ in ‘int snprintf(char*, size_t, const char*, ...)’ call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
bluca commented 1 year ago

tests are still failing