From c08b3ead636d911dbc5ed3316e635d30983dc27e Mon Sep 17 00:00:00 2001 From: upstream svn Date: Wed, 26 Aug 2020 15:41:38 +0000 Subject: [PATCH] Fix for compilation error with previous commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Somehow I did not get this error when compiling. UPnPBase.cpp: In constructor ‘CUPnPControlPoint::CUPnPControlPoint(short unsigned int)’: UPnPBase.cpp:880:1: error: jump to label ‘error’ [-fpermissive] error: ^~~~~ UPnPBase.cpp:832:8: note: from here goto error; ^~~~~ UPnPBase.cpp:835:8: note: crosses initialization of ‘char* ipAddress’ char *ipAddress = UpnpGetServerIpAddress(); ^~~~~~~~~ UPnPBase.cpp:834:17: note: crosses initialization of ‘short unsigned int port’ unsigned short port = UpnpGetServerPort(); ^~~~ --- .svn-revision | 2 +- src/UPnPBase.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.svn-revision b/.svn-revision index e40397b0..63858c91 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -11056 +11057 diff --git a/src/UPnPBase.cpp b/src/UPnPBase.cpp index dd244e5b..2c2eadcf 100644 --- a/src/UPnPBase.cpp +++ b/src/UPnPBase.cpp @@ -824,6 +824,12 @@ m_WanService(NULL) // Null string at first std::ostringstream msg; + // Declare those here to avoid + // "jump to label ‘error’ [-fpermissive] crosses initialization + // of ‘char* ipAddress’" + unsigned short port; + char *ipAddress; + // Start UPnP int ret; ret = UpnpInit2(0, udpPort); @@ -831,8 +837,8 @@ m_WanService(NULL) msg << "error(UpnpInit2): Error code "; goto error; } - unsigned short port = UpnpGetServerPort(); - char *ipAddress = UpnpGetServerIpAddress(); + port = UpnpGetServerPort(); + ipAddress = UpnpGetServerIpAddress(); msg << "bound to " << ipAddress << ":" << port << "."; AddDebugLogLineN(logUPnP, msg); -- 2.11.4.GIT