0001-Fix-build-with-libmicrohttpd.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From d983161415f5f5748fbdbaa5fbd168154ccf8867 Mon Sep 17 00:00:00 2001
  2. From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
  3. Date: Wed, 5 Aug 2020 12:31:24 +0900
  4. Subject: [PATCH] Fix build with libmicrohttpd 0.9.71
  5. ---
  6. src/jsonrpccpp/server/connectors/httpserver.cpp | 2 +-
  7. src/jsonrpccpp/server/connectors/httpserver.h | 8 +++++++-
  8. 2 files changed, 8 insertions(+), 2 deletions(-)
  9. diff --git a/src/jsonrpccpp/server/connectors/httpserver.cpp b/src/jsonrpccpp/server/connectors/httpserver.cpp
  10. index a849615..dd3b841 100644
  11. --- a/src/jsonrpccpp/server/connectors/httpserver.cpp
  12. +++ b/src/jsonrpccpp/server/connectors/httpserver.cpp
  13. @@ -151,7 +151,7 @@ void HttpServer::SetUrlHandler(const string &url,
  14. this->SetHandler(NULL);
  15. }
  16. -int HttpServer::callback(void *cls, MHD_Connection *connection, const char *url,
  17. +mhd_result HttpServer::callback(void *cls, MHD_Connection *connection, const char *url,
  18. const char *method, const char *version,
  19. const char *upload_data, size_t *upload_data_size,
  20. void **con_cls) {
  21. diff --git a/src/jsonrpccpp/server/connectors/httpserver.h b/src/jsonrpccpp/server/connectors/httpserver.h
  22. index 7785edb..0dcf032 100644
  23. --- a/src/jsonrpccpp/server/connectors/httpserver.h
  24. +++ b/src/jsonrpccpp/server/connectors/httpserver.h
  25. @@ -32,6 +32,12 @@ typedef intptr_t ssize_t;
  26. #include <map>
  27. #include <microhttpd.h>
  28. +#if MHD_VERSION >= 0x00097002
  29. +# define mhd_result enum MHD_Result
  30. +#else
  31. +# define mhd_result int
  32. +#endif
  33. +
  34. namespace jsonrpc {
  35. /**
  36. * This class provides an embedded HTTP Server, based on libmicrohttpd, to
  37. @@ -79,7 +85,7 @@ private:
  38. std::map<std::string, IClientConnectionHandler *> urlhandler;
  39. struct sockaddr_in loopback_addr;
  40. - static int callback(void *cls, struct MHD_Connection *connection,
  41. + static mhd_result callback(void *cls, struct MHD_Connection *connection,
  42. const char *url, const char *method, const char *version,
  43. const char *upload_data, size_t *upload_data_size,
  44. void **con_cls);
  45. --
  46. 2.25.1