Skip to content
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

Use microhttpd's MHD_Result return type #299

Merged
merged 1 commit into from
May 20, 2021

Conversation

antonok-edm
Copy link
Contributor

Building on Arch Linux throws some errors like the following, regarding usage of int rather than MHD_Result in return types of callback functions from libmicrohttpd.

libjson-rpc-cpp/src/jsonrpccpp/server/connectors/httpserver.cpp: In member function 'virtual bool jsonrpc::HttpServer::StartListening()':
libjson-rpc-cpp/src/jsonrpccpp/server/connectors/httpserver.cpp:79:60: error: invalid conversion from 'int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, size_t*, void**)' {aka 'int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)'} to 'MHD_AccessHandlerCallback' {aka 'MHD_Result (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)'} [-fpermissive]
   79 |             mhd_flags, this->port, NULL, NULL, HttpServer::callback, this,
      |                                                ~~~~~~~~~~~~^~~~~~~~
      |                                                            |
      |                                                            int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, size_t*, void**) {aka int (*)(void*, MHD_Connection*, const char*, const char*, const char*, const char*, long unsigned int*, void**)}
In file included from libjson-rpc-cpp/src/jsonrpccpp/server/connectors/httpserver.h:33,
                 from libjson-rpc-cpp/src/jsonrpccpp/server/connectors/httpserver.cpp:10:
/usr/include/microhttpd.h:2428:45: note:   initializing argument 5 of 'MHD_Daemon* MHD_start_daemon(unsigned int, uint16_t, MHD_AcceptPolicyCallback, void*, MHD_AccessHandlerCallback, void*, ...)'
 2428 |                   MHD_AccessHandlerCallback dh, void *dh_cls,
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~

That error is caused by recent changes to libmicrohttpd, released in version 0.9.71. That looks like a breaking change, since MHD_Result was not previously defined. I am not sure what your policy on dependency versions is, but if necessary this change could include a conditional typedef int MHD_Result based on the value of MHD_VERSION.

@AndersonTorres AndersonTorres mentioned this pull request Jan 9, 2021
10 tasks
@cinemast cinemast merged commit 0e7785d into cinemast:develop May 20, 2021
@cinemast
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants