wok diff amule/stuff/libupnp1.8.patch @ rev 21621

linld: more ram for zImage (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 25 13:23:29 2019 +0200 (2019-05-25)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/amule/stuff/libupnp1.8.patch	Sat May 25 13:23:29 2019 +0200
     1.3 @@ -0,0 +1,241 @@
     1.4 +--- a/src/UPnPBase.cpp
     1.5 ++++ b/src/UPnPBase.cpp
     1.6 +@@ -29,22 +29,12 @@
     1.7 + 
     1.8 + #ifdef ENABLE_UPNP
     1.9 + 
    1.10 +-// check for broken Debian-hacked libUPnP
    1.11 + #include <upnp.h>
    1.12 +-#ifdef STRING_H			// defined in UpnpString.h Yes, I would have liked UPNPSTRING_H much better.
    1.13 +-#define BROKEN_DEBIAN_LIBUPNP
    1.14 +-#endif
    1.15 + 
    1.16 + #include "UPnPBase.h"
    1.17 + 
    1.18 + #include <algorithm>		// For transform()
    1.19 + 
    1.20 +-#ifdef BROKEN_DEBIAN_LIBUPNP
    1.21 +-  #define GET_UPNP_STRING(a) UpnpString_get_String(a)
    1.22 +-#else
    1.23 +-  #define GET_UPNP_STRING(a) (a)
    1.24 +-#endif
    1.25 +-
    1.26 + std::string stdEmptyString;
    1.27 + 
    1.28 + const char s_argument[] = "argument";
    1.29 +@@ -1127,7 +1117,7 @@ bool CUPnPControlPoint::PrivateDeletePor
    1.30 + 
    1.31 + 
    1.32 + // This function is static
    1.33 +-int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * /*Cookie*/)
    1.34 ++int CUPnPControlPoint::Callback(Upnp_EventType EventType, const void *Event, void * /*Cookie*/)
    1.35 + {
    1.36 + 	std::ostringstream msg;
    1.37 + 	std::ostringstream msg2;
    1.38 +@@ -1149,24 +1139,24 @@ int CUPnPControlPoint::Callback(Upnp_Eve
    1.39 + 		msg2<< "UPNP_DISCOVERY_SEARCH_RESULT: ";
    1.40 + 		// UPnP Discovery
    1.41 + upnpDiscovery:
    1.42 +-		struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
    1.43 ++		UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
    1.44 + 		IXML_Document *doc = NULL;
    1.45 + 		int ret;
    1.46 +-		if (d_event->ErrCode != UPNP_E_SUCCESS) {
    1.47 +-			msg << UpnpGetErrorMessage(d_event->ErrCode) << ".";
    1.48 ++		if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) {
    1.49 ++			msg << UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(d_event)) << ".";
    1.50 + 			AddDebugLogLineC(logUPnP, msg);
    1.51 + 		}
    1.52 + 		// Get the XML tree device description in doc
    1.53 +-		ret = UpnpDownloadXmlDoc(d_event->Location, &doc);
    1.54 ++		ret = UpnpDownloadXmlDoc(UpnpDiscovery_get_Location_cstr(d_event), &doc);
    1.55 + 		if (ret != UPNP_E_SUCCESS) {
    1.56 + 			msg << "Error retrieving device description from " <<
    1.57 +-				d_event->Location << ": " <<
    1.58 ++				UpnpDiscovery_get_Location_cstr(d_event) << ": " <<
    1.59 + 				UpnpGetErrorMessage(ret) <<
    1.60 + 				"(" << ret << ").";
    1.61 + 			AddDebugLogLineC(logUPnP, msg);
    1.62 + 		} else {
    1.63 + 			msg2 << "Retrieving device description from " <<
    1.64 +-				d_event->Location << ".";
    1.65 ++				UpnpDiscovery_get_Location_cstr(d_event) << ".";
    1.66 + 			AddDebugLogLineN(logUPnP, msg2);
    1.67 + 		}
    1.68 + 		if (doc) {
    1.69 +@@ -1195,7 +1185,7 @@ upnpDiscovery:
    1.70 + 				}
    1.71 + 				// Add the root device to our list
    1.72 + 				upnpCP->AddRootDevice(rootDevice, urlBase,
    1.73 +-					d_event->Location, d_event->Expires);
    1.74 ++					UpnpDiscovery_get_Location_cstr(d_event), UpnpDiscovery_get_Expires(d_event));
    1.75 + 			}
    1.76 + 			// Free the XML doc tree
    1.77 + 			IXML::Document::Free(doc);
    1.78 +@@ -1216,28 +1206,28 @@ upnpDiscovery:
    1.79 + 	case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
    1.80 + 		//fprintf(stderr, "Callback: UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE\n");
    1.81 + 		// UPnP Device Removed
    1.82 +-		struct Upnp_Discovery *dab_event = (struct Upnp_Discovery *)Event;
    1.83 +-		if (dab_event->ErrCode != UPNP_E_SUCCESS) {
    1.84 ++		UpnpDiscovery *dab_event = (UpnpDiscovery *)Event;
    1.85 ++		if (UpnpDiscovery_get_ErrCode(dab_event) != UPNP_E_SUCCESS) {
    1.86 + 			msg << "error(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE): " <<
    1.87 +-				UpnpGetErrorMessage(dab_event->ErrCode) <<
    1.88 ++				UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(dab_event)) <<
    1.89 + 				".";
    1.90 + 			AddDebugLogLineC(logUPnP, msg);
    1.91 + 		}
    1.92 +-		std::string devType = dab_event->DeviceType;
    1.93 ++		std::string devType = UpnpDiscovery_get_DeviceType_cstr(dab_event);
    1.94 + 		// Check for an InternetGatewayDevice and removes it from the list
    1.95 + 		std::transform(devType.begin(), devType.end(), devType.begin(), tolower);
    1.96 + 		if (stdStringIsEqualCI(devType, UPnP::Device::IGW)) {
    1.97 +-			upnpCP->RemoveRootDevice(dab_event->DeviceId);
    1.98 ++			upnpCP->RemoveRootDevice(UpnpDiscovery_get_DeviceID_cstr(dab_event));
    1.99 + 		}
   1.100 + 		break;
   1.101 + 	}
   1.102 + 	case UPNP_EVENT_RECEIVED: {
   1.103 + 		//fprintf(stderr, "Callback: UPNP_EVENT_RECEIVED\n");
   1.104 + 		// Event reveived
   1.105 +-		struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
   1.106 +-		const std::string Sid = e_event->Sid;
   1.107 ++		UpnpEvent *e_event = (UpnpEvent *)Event;
   1.108 ++		const std::string Sid = UpnpEvent_get_SID_cstr(e_event);
   1.109 + 		// Parses the event
   1.110 +-		upnpCP->OnEventReceived(Sid, e_event->EventKey, e_event->ChangedVariables);
   1.111 ++		upnpCP->OnEventReceived(Sid, UpnpEvent_get_EventKey(e_event), UpnpEvent_get_ChangedVariables(e_event));
   1.112 + 		break;
   1.113 + 	}
   1.114 + 	case UPNP_EVENT_SUBSCRIBE_COMPLETE:
   1.115 +@@ -1252,16 +1242,15 @@ upnpDiscovery:
   1.116 + 		//fprintf(stderr, "Callback: UPNP_EVENT_RENEWAL_COMPLETE\n");
   1.117 + 		msg << "error(UPNP_EVENT_RENEWAL_COMPLETE): ";
   1.118 + upnpEventRenewalComplete:
   1.119 +-		struct Upnp_Event_Subscribe *es_event =
   1.120 +-			(struct Upnp_Event_Subscribe *)Event;
   1.121 +-		if (es_event->ErrCode != UPNP_E_SUCCESS) {
   1.122 ++		UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
   1.123 ++		if (UpnpEventSubscribe_get_ErrCode(es_event) != UPNP_E_SUCCESS) {
   1.124 + 			msg << "Error in Event Subscribe Callback";
   1.125 + 			UPnP::ProcessErrorMessage(
   1.126 +-				msg.str(), es_event->ErrCode, NULL, NULL);
   1.127 ++				msg.str(), UpnpEventSubscribe_get_ErrCode(es_event), NULL, NULL);
   1.128 + 		} else {
   1.129 + #if 0
   1.130 + 			TvCtrlPointHandleSubscribeUpdate(
   1.131 +-				GET_UPNP_STRING(es_event->PublisherUrl),
   1.132 ++				UpnpEventSubscribe_get_PublisherUrl_cstr(es_event),
   1.133 + 				es_event->Sid,
   1.134 + 				es_event->TimeOut );
   1.135 + #endif
   1.136 +@@ -1280,29 +1269,29 @@ upnpEventRenewalComplete:
   1.137 + 		msg << "error(UPNP_EVENT_SUBSCRIPTION_EXPIRED): ";
   1.138 + 		msg2 << "UPNP_EVENT_SUBSCRIPTION_EXPIRED: ";
   1.139 + upnpEventSubscriptionExpired:
   1.140 +-		struct Upnp_Event_Subscribe *es_event =
   1.141 +-			(struct Upnp_Event_Subscribe *)Event;
   1.142 ++		UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
   1.143 + 		Upnp_SID newSID;
   1.144 + 		memset(newSID, 0, sizeof(Upnp_SID));
   1.145 + 		int TimeOut = 1801;
   1.146 + 		int ret = UpnpSubscribe(
   1.147 + 			upnpCP->m_UPnPClientHandle,
   1.148 +-			GET_UPNP_STRING(es_event->PublisherUrl),
   1.149 ++
   1.150 ++			UpnpEventSubscribe_get_PublisherUrl_cstr(es_event),
   1.151 + 			&TimeOut,
   1.152 + 			newSID);
   1.153 + 		if (ret != UPNP_E_SUCCESS) {
   1.154 + 			msg << "Error Subscribing to EventURL";
   1.155 + 			UPnP::ProcessErrorMessage(
   1.156 +-				msg.str(), es_event->ErrCode, NULL, NULL);
   1.157 ++				msg.str(), UpnpEventSubscribe_get_ErrCode(es_event), NULL, NULL);
   1.158 + 		} else {
   1.159 + 			ServiceMap::iterator it =
   1.160 +-				upnpCP->m_ServiceMap.find(GET_UPNP_STRING(es_event->PublisherUrl));
   1.161 ++				upnpCP->m_ServiceMap.find(UpnpEventSubscribe_get_PublisherUrl_cstr(es_event));
   1.162 + 			if (it != upnpCP->m_ServiceMap.end()) {
   1.163 + 				CUPnPService &service = *(it->second);
   1.164 + 				service.SetTimeout(TimeOut);
   1.165 + 				service.SetSID(newSID);
   1.166 + 				msg2 << "Re-subscribed to EventURL '" <<
   1.167 +-					GET_UPNP_STRING(es_event->PublisherUrl) <<
   1.168 ++					UpnpEventSubscribe_get_PublisherUrl_cstr(es_event) <<
   1.169 + 					"' with SID == '" <<
   1.170 + 					newSID << "'.";
   1.171 + 				AddDebugLogLineC(logUPnP, msg2);
   1.172 +@@ -1321,17 +1310,16 @@ upnpEventSubscriptionExpired:
   1.173 + 	case UPNP_CONTROL_ACTION_COMPLETE: {
   1.174 + 		//fprintf(stderr, "Callback: UPNP_CONTROL_ACTION_COMPLETE\n");
   1.175 + 		// This is here if we choose to do this asynchronously
   1.176 +-		struct Upnp_Action_Complete *a_event =
   1.177 +-			(struct Upnp_Action_Complete *)Event;
   1.178 +-		if (a_event->ErrCode != UPNP_E_SUCCESS) {
   1.179 ++		UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
   1.180 ++		if (UpnpActionComplete_get_ErrCode(a_event) != UPNP_E_SUCCESS) {
   1.181 + 			UPnP::ProcessErrorMessage(
   1.182 + 				"UpnpSendActionAsync",
   1.183 +-				a_event->ErrCode, NULL,
   1.184 +-				a_event->ActionResult);
   1.185 ++				UpnpActionComplete_get_ErrCode(a_event), NULL,
   1.186 ++				UpnpActionComplete_get_ActionResult(a_event));
   1.187 + 		} else {
   1.188 + 			// Check the response document
   1.189 + 			UPnP::ProcessActionResponse(
   1.190 +-				a_event->ActionResult,
   1.191 ++				UpnpActionComplete_get_ActionResult(a_event),
   1.192 + 				"<UpnpSendActionAsync>");
   1.193 + 		}
   1.194 + 		/* No need for any processing here, just print out results.
   1.195 +@@ -1342,12 +1330,11 @@ upnpEventSubscriptionExpired:
   1.196 + 	case UPNP_CONTROL_GET_VAR_COMPLETE: {
   1.197 + 		//fprintf(stderr, "Callback: UPNP_CONTROL_GET_VAR_COMPLETE\n");
   1.198 + 		msg << "error(UPNP_CONTROL_GET_VAR_COMPLETE): ";
   1.199 +-		struct Upnp_State_Var_Complete *sv_event =
   1.200 +-			(struct Upnp_State_Var_Complete *)Event;
   1.201 +-		if (sv_event->ErrCode != UPNP_E_SUCCESS) {
   1.202 ++		UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
   1.203 ++		if (UpnpStateVarComplete_get_ErrCode(sv_event) != UPNP_E_SUCCESS) {
   1.204 + 			msg << "m_UpnpGetServiceVarStatusAsync";
   1.205 + 			UPnP::ProcessErrorMessage(
   1.206 +-				msg.str(), sv_event->ErrCode, NULL, NULL);
   1.207 ++				msg.str(), UpnpStateVarComplete_get_ErrCode(sv_event), NULL, NULL);
   1.208 + 		} else {
   1.209 + #if 0
   1.210 + 			// Warning: The use of UpnpGetServiceVarStatus and
   1.211 +--- a/src/UPnPBase.h
   1.212 ++++ b/src/UPnPBase.h
   1.213 +@@ -490,9 +490,19 @@ public:
   1.214 + 	// Callback function
   1.215 + 	static int Callback(
   1.216 + 		Upnp_EventType EventType,
   1.217 +-		void* Event,
   1.218 ++		const void* Event,
   1.219 + 		void* Cookie);
   1.220 + 
   1.221 ++#if UPNP_VERSION < 10800
   1.222 ++	/* in libupnp 1.6 Event is not const */
   1.223 ++	static int Callback(
   1.224 ++		Upnp_EventType EventType,
   1.225 ++		void* Event,
   1.226 ++		void* Cookie) {
   1.227 ++		return Callback(EventType, (const void *)Event, Cookie);
   1.228 ++	}
   1.229 ++#endif
   1.230 ++
   1.231 + private:
   1.232 + 	void OnEventReceived(
   1.233 + 		const std::string &Sid,
   1.234 +--- a/configure.in
   1.235 ++++ b/configure.in
   1.236 +@@ -220,7 +220,7 @@ MULE_ARG_ENABLE([upnp], [yes], [do not c
   1.237 + MULE_IF_ENABLED_ANY([monolithic, amule-daemon],, [MULE_ENABLEVAR([upnp])=no])
   1.238 + MULE_IF_ENABLED([upnp], [
   1.239 + 	LIBUPNP_CHECK(
   1.240 +-		[1.6.6],
   1.241 ++		[1.6.24],
   1.242 + 		[MULE_APPEND([LIBUPNP_CPPFLAGS], [-DENABLE_UPNP=1])],
   1.243 + 		[MULE_ENABLEVAR([upnp])=disabled
   1.244 + 		MULE_WARNING([UPnP code has been disabled because ${libupnp_error}.])]