git: 263d5293fc66 - main - net-p2p/transmission-components: Fix build with miniupnpc-2.2.8

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Wed, 17 Jul 2024 09:10:12 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=263d5293fc66e3f9f48a8cc3217235fb933d1f08

commit 263d5293fc66e3f9f48a8cc3217235fb933d1f08
Author:     Anton Saietskii <vsasjason@gmail.com>
AuthorDate: 2024-07-17 09:03:29 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-07-17 09:09:29 +0000

    net-p2p/transmission-components: Fix build with miniupnpc-2.2.8
    
    /usr/ports/net-p2p/transmission-components/work-cli/transmission-4.0.6/libtransmission/port-forwarding-upnp.cc:278:13:
    error: no matching function for call to 'UPNP_GetValidIGD'
      278 |         if (UPNP_GetValidIGD(devlist, &handle->urls,
    &handle->data, std::data(lanaddr), std::size(lanaddr) - 1) ==
          |             ^~~~~~~~~~~~~~~~
    /usr/local/include/miniupnpc/miniupnpc.h:122:1: note: candidate function
    not viable: requires 7 arguments, but 5 were provided
      122 | UPNP_GetValidIGD(struct UPNPDev * devlist,
          | ^                ~~~~~~~~~~~~~~~~~~~~~~~~~
      123 |                  struct UPNPUrls * urls,
          |                  ~~~~~~~~~~~~~~~~~~~~~~~
      124 |                  struct IGDdatas * data,
          |                  ~~~~~~~~~~~~~~~~~~~~~~~
      125 |                  char * lanaddr, int lanaddrlen,
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      126 |                  char * wanaddr, int wanaddrlen);
          |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    ninja: build stopped: subcommand failed.
    *** Error code 1
    
    PR:             280298
    Approved by:    Rafe <mondo.debater_0q@icloud.com> (maintainer)
    Obtained from:  https://github.com/transmission/transmission/commit/febfe49ca3ecab1a7142ecb34012c1f0b2bcdee8
---
 .../files/patch-libtransmission_port-forwarding-upnp.cc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/net-p2p/transmission-components/files/patch-libtransmission_port-forwarding-upnp.cc b/net-p2p/transmission-components/files/patch-libtransmission_port-forwarding-upnp.cc
new file mode 100644
index 000000000000..ae97f1095a60
--- /dev/null
+++ b/net-p2p/transmission-components/files/patch-libtransmission_port-forwarding-upnp.cc
@@ -0,0 +1,17 @@
+--- libtransmission/port-forwarding-upnp.cc.orig	2024-05-29 01:38:35 UTC
++++ libtransmission/port-forwarding-upnp.cc
+@@ -275,8 +275,12 @@ tr_port_forwarding_state tr_upnpPulse(tr_upnp* handle,
+ 
+         FreeUPNPUrls(&handle->urls);
+         auto lanaddr = std::array<char, TR_ADDRSTRLEN>{};
+-        if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1) ==
+-            UPNP_IGD_VALID_CONNECTED)
++#if (MINIUPNPC_API_VERSION >= 18)
++        if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1, nullptr, 0)
++#else
++        if (UPNP_GetValidIGD(devlist, &handle->urls, &handle->data, std::data(lanaddr), std::size(lanaddr) - 1)
++#endif
++            == UPNP_IGD_VALID_CONNECTED)
+         {
+             tr_logAddInfo(fmt::format(_("Found Internet Gateway Device '{url}'"), fmt::arg("url", handle->urls.controlURL)));
+             tr_logAddInfo(fmt::format(_("Local Address is '{address}'"), fmt::arg("address", lanaddr.data())));