OpenZWave / open-zwave-control-panel

UNMAINTAINED - We are looking for someone to maintain ozwcp! The OpenZWave Control Panel (ozwcp for short) is an application built on the OpenZWave library that permits users to query, manage and monitor Z-Wave nodes and networks. It provides a web based user interface using AJAX principles.
Other
130 stars 72 forks source link

Fixed deprecated warnings when using libmicrohttpd-0.9.50 #45

Closed gdombiak closed 7 years ago

gdombiak commented 8 years ago

I'm using latest version of libmicrohttpd (version 0.9.50) and the following warnings make the compilation fail. I did not want to remove -Werror so instead fixed the code to use newest function. Here are the warnings that this PR fixes.

webserver.cpp: In function ‘int web_send_data(MHDConnection, const char, int, bool, bool, const char)’: webserver.cpp:109:13: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(strlen(data), (void )data, free ? MHD_YES : MHD_NO, copy ? MHD_YES : MHD_NO); ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp:109:13: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(strlen(data), (void )data, free ? MHD_YES : MHD_NO, copy ? MHD_YES : MHD_NO); ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp:109:119: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(strlen(data), (void )data, free ? MHD_YES : MHD_NO, copy ? MHD_YES : MHD_NO); ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp: In function ‘int web_send_file(MHDConnection, const char_, int, bool)’: webserver.cpp:164:15: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(0, (void )"", MHD_NO, MHD_NO); ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp:164:15: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(0, (void )"", MHD_NO, MHD_NO); ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp:164:74: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(0, (void )"", MHD_NO, MHD_NO); ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp:173:15: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(len, (void )s, MHD_YES, MHD_NO); // free ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp:173:15: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(len, (void )s, MHD_YES, MHD_NO); // free ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ webserver.cpp:173:76: error: ‘MHDResponse MHD_create_response_from_data(sizet, void, int, int)’ is deprecated: MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer() [-Werror=deprecated-declarations] response = MHD_create_response_from_data(len, (void )s, MHD_YES, MHD_NO); // free ^ In file included from webserver.cpp:58:0: ../libmicrohttpd-0.9.50/src/include/microhttpd.h:2068:1: note: declared here MHD_create_response_from_data (size_t size, ^ cc1plus: all warnings being treated as errors Makefile:49: recipe for target 'webserver.o' failed make: _* [webserver.o] Error 1

Fishwaldo commented 8 years ago

is this backwards compatible with older microhttpd versions?

gdombiak commented 8 years ago

Hi Justin,

I tested it with:

and it compiles fine with all of them. I've been using this fix since libmicrohttpd-0.9.43 (I think) was released.

The only thing left to fix is this other warning but it does not break the compilation so might tackle it at some future moment:

webserver.cpp:338: warning: the use of mktemp' is dangerous, better usemkstemp' or `mkdtemp'

Thanks for helping with the PR. Gaston