Hello,

On Wed, 08 Jul 2020 11:22:18 +0200 Andreas Beckmann <a...@debian.org> wrote:
> 
> openzwave-controlpanel recently started to FTBFS with
> 

libmicrohttpd has recent API changes. The attached patch file should fix
the ftbfs with libmicrohttpd 0.9.71. It also fixes a gcc warning with
uninitialized value.

/Nicolas
Index: openzwave-controlpanel-0.2a+git20161006.a390f35/webserver.cpp
===================================================================
--- openzwave-controlpanel-0.2a+git20161006.a390f35.orig/webserver.cpp
+++ openzwave-controlpanel-0.2a+git20161006.a390f35/webserver.cpp
@@ -100,11 +100,11 @@ extern int debug;
  * web_send_data
  * Send internal HTML string
  */
-static int web_send_data (struct MHD_Connection *connection, const char *data,
+static enum MHD_Result web_send_data (struct MHD_Connection *connection, const char *data,
 		const int code, bool free, bool copy, const char *ct)
 {
 	struct MHD_Response *response;
-	int ret;
+	enum MHD_Result ret;
 
 	if (!copy && ! free)
 		response = MHD_create_response_from_buffer(strlen(data), (void *) data, MHD_RESPMEM_PERSISTENT);
@@ -148,14 +148,14 @@ void web_close_file (void *cls)
  * web_send_file
  * Read files and send them out
  */
-int web_send_file (struct MHD_Connection *conn, const char *filename, const int code, const bool unl)
+enum MHD_Result web_send_file (struct MHD_Connection *conn, const char *filename, const int code, const bool unl)
 {
 	struct stat buf;
 	FILE *fp;
 	struct MHD_Response *response;
 	const char *p;
 	const char *ct = NULL;
-	int ret;
+	enum MHD_Result ret;
 
 	if ((p = strchr(filename, '.')) != NULL) {
 		p++;
@@ -540,7 +540,7 @@ const char *Webserver::SendSceneResponse
 	char *fn;
 	int cnt;
 	int i;
-	uint8 sid;
+	uint8 sid = 0;
 	TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "utf-8", "" );
 	doc.LinkEndChild(decl);
 	TiXmlElement* scenesElement = new TiXmlElement("scenes");
@@ -644,7 +644,7 @@ const char *Webserver::SendSceneResponse
  * Process poll request from client and return
  * data as xml.
  */
-int Webserver::SendPollResponse (struct MHD_Connection *conn)
+enum MHD_Result Webserver::SendPollResponse (struct MHD_Connection *conn)
 {
 	TiXmlDocument doc;
 	struct stat buf;
@@ -657,7 +657,7 @@ int Webserver::SendPollResponse (struct
 	char fntemp[32];
 	char *fn;
 	FILE *fp;
-	int32 ret;
+	enum MHD_Result ret;
 
 	TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "utf-8", "" );
 	doc.LinkEndChild(decl);
@@ -811,14 +811,14 @@ int Webserver::SendPollResponse (struct
  * Process request for Device List from client and return
  * data as xml.
  */
-int Webserver::SendDeviceListResponse (struct MHD_Connection *conn)
+enum MHD_Result Webserver::SendDeviceListResponse (struct MHD_Connection *conn)
 {
 	TiXmlDocument doc;
 	char str[16];
 	int32 i, j;
 	char fntemp[32];
 	char *fn;
-	int32 ret;
+	enum MHD_Result ret;
 
 	TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "utf-8", "" );
 	doc.LinkEndChild(decl);
@@ -981,7 +981,7 @@ void web_controller_update (Driver::Cont
  * Handle the post of the updated data
  */
 
-int web_config_post (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename,
+enum MHD_Result web_config_post (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename,
 		const char *content_type, const char *transfer_encoding,
 		const char *data, uint64_t off, size_t size)
 {
@@ -1079,7 +1079,7 @@ int web_config_post (void *cls, enum MHD
 /*
  * Process web requests
  */
-int Webserver::HandlerEP (void *cls, struct MHD_Connection *conn, const char *url,
+enum MHD_Result Webserver::HandlerEP (void *cls, struct MHD_Connection *conn, const char *url,
 		const char *method, const char *version, const char *up_data,
 		size_t *up_data_size, void **ptr)
 {
@@ -1088,11 +1088,11 @@ int Webserver::HandlerEP (void *cls, str
 	return ws->Handler(conn, url, method, version, up_data, up_data_size, ptr);
 }
 
-int Webserver::Handler (struct MHD_Connection *conn, const char *url,
+enum MHD_Result Webserver::Handler (struct MHD_Connection *conn, const char *url,
 		const char *method, const char *version, const char *up_data,
 		size_t *up_data_size, void **ptr)
 {
-	int ret;
+	enum MHD_Result ret;
 	conninfo_t *cp;
 
 	if (debug)
Index: openzwave-controlpanel-0.2a+git20161006.a390f35/webserver.h
===================================================================
--- openzwave-controlpanel-0.2a+git20161006.a390f35.orig/webserver.h
+++ openzwave-controlpanel-0.2a+git20161006.a390f35/webserver.h
@@ -49,16 +49,16 @@ class Webserver {
 		string getAdminMessage() { return adminmsg; }
 		void setAdminMessage (string msg) { adminmsg = msg; }
 	private:
-		static int HandlerEP(void *cls, struct MHD_Connection *conn, const char *url, const char *method,
+		static enum MHD_Result HandlerEP(void *cls, struct MHD_Connection *conn, const char *url, const char *method,
 				const char *version, const char *up_data, size_t *up_data_size, void **ptr);
-		int Handler(struct MHD_Connection *conn, const char *url, const char *method,
+		enum MHD_Result Handler(struct MHD_Connection *conn, const char *url, const char *method,
 				const char *version, const char *up_data, size_t *up_data_size, void **ptr);
 		static void FreeEP(void *cls, struct MHD_Connection *conn, void **ptr, enum MHD_RequestTerminationCode code);
 		void Free(struct MHD_Connection *conn, void **ptr, enum MHD_RequestTerminationCode code);
 		void web_get_groups(int i, TiXmlElement *ep);
 		void web_get_values(int i, TiXmlElement *ep);
-		int SendPollResponse(struct MHD_Connection *conn);
-		int SendDeviceListResponse(struct MHD_Connection *conn);
+		enum MHD_Result SendPollResponse(struct MHD_Connection *conn);
+		enum MHD_Result SendDeviceListResponse(struct MHD_Connection *conn);
 		const char *SendSceneResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);
 		const char *SendTopoResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);
 		const char *SendStatResponse(struct MHD_Connection *conn, const char *fun, const char *arg1, const char *arg2, const char *arg3);

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to