Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libupnpp for openSUSE:Factory checked in at 2022-08-13 22:37:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libupnpp (Old) and /work/SRC/openSUSE:Factory/.libupnpp.new.1521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libupnpp" Sat Aug 13 22:37:15 2022 rev:5 rq:994886 version:0.22.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libupnpp/libupnpp.changes 2022-03-20 20:55:53.318555818 +0100 +++ /work/SRC/openSUSE:Factory/.libupnpp.new.1521/libupnpp.changes 2022-08-13 22:37:16.506737024 +0200 @@ -1,0 +2,17 @@ +Sat Aug 13 10:34:18 UTC 2022 - Michael Pujos <pujos.mich...@gmail.com> + +- Update to version 0.22.2: + * Adapt to the npupnp Upnp_SID type change +- Update to version 0.22.1: + * Allow absolute eventSubURLs in the description. + UPnP 1.1 is ambiguous on this point. They are used by some renderers + (e.g. LMS UPnP renderer plugin), which made them incompatible with + libupnpp +- Update to version 0.22.0: + * Improved logging of action errors: show what we were doing. + Ajust other log message levels + * Small stylistic changes + * Interface of Songcast API had incompatible change, forced a new + package name + +------------------------------------------------------------------- Old: ---- libupnpp-0.21.0.tar.gz libupnpp-0.21.0.tar.gz.asc New: ---- libupnpp-0.22.2.tar.gz libupnpp-0.22.2.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libupnpp.spec ++++++ --- /var/tmp/diff_new_pack.QNvILL/_old 2022-08-13 22:37:16.966738186 +0200 +++ /var/tmp/diff_new_pack.QNvILL/_new 2022-08-13 22:37:16.974738207 +0200 @@ -16,9 +16,9 @@ # -%define so_ver 11 +%define so_ver 12 Name: libupnpp -Version: 0.21.0 +Version: 0.22.2 Release: 0 Summary: Library providing a higher level API over libnpupnp or libupnp License: GPL-2.0-or-later @@ -31,7 +31,7 @@ BuildRequires: pkgconfig BuildRequires: pkgconfig(expat) BuildRequires: pkgconfig(libcurl) -BuildRequires: pkgconfig(libnpupnp) +BuildRequires: pkgconfig(libnpupnp) >= 5.0.0 %description Libupnpp is a C++ wrapper for libupnp a.k.a Portable UPnP (up to branch 0.17), ++++++ libupnpp-0.21.0.tar.gz -> libupnpp-0.22.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/Makefile.am new/libupnpp-0.22.2/Makefile.am --- old/libupnpp-0.21.0/Makefile.am 2020-12-19 14:01:00.000000000 +0100 +++ new/libupnpp-0.22.2/Makefile.am 2022-07-05 17:16:04.000000000 +0200 @@ -159,9 +159,13 @@ dist-hook: if LINUX - nm -g --defined-only --demangle .libs/libupnpp.so | grep ' T ' | \ - awk '{print $$3}' | diff - $(top_srcdir)/symbols-reference + if test -z "$(NOTAG)";then \ + nm -g --defined-only --demangle .libs/libupnpp.so | grep ' T ' | \ + awk '{print $$3}' | diff $(top_srcdir)/symbols-reference - || exit 1;\ + fi endif - test -z "`git status -s | egrep -v '?? libupnpp-.*/|?? libupnpputil.a'`" - vers=`echo $(VERSION) | sed -e 's/~/_/g'`;\ - git tag -a libupnpp-v$$vers -m "version $$vers" + if test -z "$(NOTAG)";then \ + test -z "`git status -s | egrep -v '?? libupnpp-.*/|?? libupnpputil.a'`" || exit 1;\ + vers=`echo $(VERSION) | sed -e 's/~/_/g'`;\ + git tag -a libupnpp-v$$vers -m "version $$vers";\ + fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/Makefile.in new/libupnpp-0.22.2/Makefile.in --- old/libupnpp-0.21.0/Makefile.in 2021-03-13 13:58:06.000000000 +0100 +++ new/libupnpp-0.22.2/Makefile.in 2022-08-12 12:34:18.000000000 +0200 @@ -1674,11 +1674,15 @@ dist-hook: -@LINUX_TRUE@ nm -g --defined-only --demangle .libs/libupnpp.so | grep ' T ' | \ -@LINUX_TRUE@ awk '{print $$3}' | diff - $(top_srcdir)/symbols-reference - test -z "`git status -s | egrep -v '?? libupnpp-.*/|?? libupnpputil.a'`" - vers=`echo $(VERSION) | sed -e 's/~/_/g'`;\ - git tag -a libupnpp-v$$vers -m "version $$vers" +@LINUX_TRUE@ if test -z "$(NOTAG)";then \ +@LINUX_TRUE@ nm -g --defined-only --demangle .libs/libupnpp.so | grep ' T ' | \ +@LINUX_TRUE@ awk '{print $$3}' | diff $(top_srcdir)/symbols-reference - || exit 1;\ +@LINUX_TRUE@ fi + if test -z "$(NOTAG)";then \ + test -z "`git status -s | egrep -v '?? libupnpp-.*/|?? libupnpputil.a'`" || exit 1;\ + vers=`echo $(VERSION) | sed -e 's/~/_/g'`;\ + git tag -a libupnpp-v$$vers -m "version $$vers";\ + fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/aclocal.m4 new/libupnpp-0.22.2/aclocal.m4 --- old/libupnpp-0.21.0/aclocal.m4 2021-03-13 13:58:05.000000000 +0100 +++ new/libupnpp-0.22.2/aclocal.m4 2022-08-12 12:34:17.000000000 +0200 @@ -1055,8 +1055,8 @@ _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF @@ -1506,7 +1506,7 @@ m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} -: ${AR_FLAGS=cru} +: ${AR_FLAGS=cr} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) @@ -4718,6 +4718,12 @@ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -9069,7 +9075,7 @@ m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29) +dnl serial 11 (pkg-config-0.29.1) dnl dnl Copyright ?? 2004 Scott James Remnant <sc...@netsplit.com>. dnl Copyright ?? 2012-2015 Dan Nicholson <dbn.li...@gmail.com> @@ -9111,7 +9117,7 @@ dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29]) +[m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/configure new/libupnpp-0.22.2/configure --- old/libupnpp-0.21.0/configure 2021-03-13 13:58:07.000000000 +0100 +++ new/libupnpp-0.22.2/configure 2022-08-12 12:34:18.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libupnpp 0.21.0. +# Generated by GNU Autoconf 2.69 for libupnpp 0.22.2. # # Report bugs to <j...@lesbonscomptes.com>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='libupnpp' PACKAGE_TARNAME='libupnpp' -PACKAGE_VERSION='0.21.0' -PACKAGE_STRING='libupnpp 0.21.0' +PACKAGE_VERSION='0.22.2' +PACKAGE_STRING='libupnpp 0.22.2' PACKAGE_BUGREPORT='j...@lesbonscomptes.com' PACKAGE_URL='http://www.lesbonscomptes.com/upmpdcli' @@ -1362,7 +1362,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libupnpp 0.21.0 to adapt to many kinds of systems. +\`configure' configures libupnpp 0.22.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1433,7 +1433,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libupnpp 0.21.0:";; + short | recursive ) echo "Configuration of libupnpp 0.22.2:";; esac cat <<\_ACEOF @@ -1559,7 +1559,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libupnpp configure 0.21.0 +libupnpp configure 0.22.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2012,7 +2012,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libupnpp $as_me 0.21.0, which was +It was created by libupnpp $as_me 0.22.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2376,7 +2376,7 @@ # - If any interfaces have been removed or changed since the last public # release, then set age to 0 and change the package name if multiple # versions need to be co-installed. -VERSION_INFO=11:0:0 +VERSION_INFO=12:0:0 @@ -3004,7 +3004,7 @@ # Define the identity of the package. PACKAGE='libupnpp' - VERSION='0.21.0' + VERSION='0.22.2' # Some tools Automake needs. @@ -5759,7 +5759,7 @@ fi : ${AR=ar} -: ${AR_FLAGS=cru} +: ${AR_FLAGS=cr} @@ -7480,8 +7480,8 @@ _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 + echo "$AR cr libconftest.a conftest.o" >&5 + $AR cr libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF @@ -8576,6 +8576,12 @@ lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -16928,7 +16934,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libupnpp $as_me 0.21.0, which was +This file was extended by libupnpp $as_me 0.22.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16995,7 +17001,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libupnpp config.status 0.21.0 +libupnpp config.status 0.22.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/configure.ac new/libupnpp-0.22.2/configure.ac --- old/libupnpp-0.21.0/configure.ac 2021-01-24 18:20:31.000000000 +0100 +++ new/libupnpp-0.22.2/configure.ac 2022-08-12 12:34:07.000000000 +0200 @@ -4,7 +4,7 @@ # occur with revision (3rd number) changes. # !!!! When changing the version, also change the defines in upnpplib.hxx !!! -AC_INIT([libupnpp], [0.21.0], [j...@lesbonscomptes.com], +AC_INIT([libupnpp], [0.22.2], [j...@lesbonscomptes.com], [libupnpp], [http://www.lesbonscomptes.com/upmpdcli]) # Lib version info. See: @@ -22,7 +22,7 @@ # - If any interfaces have been removed or changed since the last public # release, then set age to 0 and change the package name if multiple # versions need to be co-installed. -VERSION_INFO=11:0:0 +VERSION_INFO=12:0:0 AC_PREREQ([2.53]) AC_CONFIG_SRCDIR([libupnpp/upnpplib.hxx]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/control/avtransport.cxx new/libupnpp-0.22.2/libupnpp/control/avtransport.cxx --- old/libupnpp-0.21.0/libupnpp/control/avtransport.cxx 2020-11-13 11:53:22.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/control/avtransport.cxx 2021-12-26 09:25:46.000000000 +0100 @@ -77,7 +77,7 @@ return AVTransport::NoMediaPresent; } else { LOGINF("AVTransport event: bad value for TransportState: " - << s << endl); + << s << "\n"); return AVTransport::Unknown; } } @@ -90,7 +90,7 @@ return AVTransport::TPS_Error; } else { LOGERR("AVTransport event: bad value for TransportStatus: " - << s << endl); + << s << "\n"); return AVTransport::TPS_Unknown; } } @@ -111,7 +111,7 @@ return AVTransport::PM_Direct1; } else { LOGERR("AVTransport event: bad value for PlayMode: " - << s << endl); + << s << "\n"); return AVTransport::PM_Unknown; } } @@ -119,27 +119,24 @@ void AVTransport::evtCallback( const std::unordered_map<std::string, std::string>& props) { - LOGDEB1("AVTransport::evtCallback:" << endl); + LOGDEB1("AVTransport::evtCallback:" << "\n"); auto reporter = getReporter(); if (nullptr == reporter) { - LOGDEB1("AVTransport::evtCallback: " << varchg.first << " -> " - << varchg.second << endl); + LOGDEB1("AVTransport::evtCallback: " << varchg.first << " -> " << varchg.second << "\n"); return; } for (const auto& prop : props) { if (prop.first.compare("LastChange")) { LOGINF("AVTransport:event: var not lastchange: " - << prop.first << " -> " << prop.second << endl); + << prop.first << " -> " << prop.second << "\n"); continue; } - LOGDEB1("AVTransport:event: " - << prop.first << " -> " << prop.second << endl); + LOGDEB1("AVTransport:event: " << prop.first << " -> " << prop.second << "\n"); std::unordered_map<std::string, std::string> changes; if (!decodeAVLastChange(prop.second, changes)) { - LOGERR("AVTransport::evtCallback: bad LastChange value: " - << prop.second << endl); + LOGERR("AVTransport::evtCallback: bad LastChange value: " << prop.second << "\n"); return; } for (const auto& varchg : changes) { @@ -184,11 +181,9 @@ !varnm.compare("CurrentTrackMetaData")) { UPnPDirContent meta; if (!varvalue.empty() && !meta.parse(varvalue)) { - LOGERR("AVTransport event: bad metadata: [" << - varvalue << "]" << endl); + LOGERR("AVTransport event: bad metadata: [" << varvalue << "]" << "\n"); } else { - LOGDEB1("AVTransport event: good metadata: [" << - varvalue << "]" << endl); + LOGDEB1("AVTransport event: good metadata: [" << varvalue << "]" << "\n"); if (meta.m_items.size() > 0) { reporter->changed(varnm.c_str(), meta.m_items[0]); } @@ -204,7 +199,7 @@ } else { LOGDEB1("AVTransport event: unknown variable: name [" << - varnm << "] value [" << varvalue << endl); + varnm << "] value [" << varvalue << "\n"); reporter->changed(varnm.c_str(), varvalue.c_str()); } } @@ -215,11 +210,10 @@ int AVTransport::setURI(const string& uri, const string& metadata, int instanceID, bool next) { - SoapOutgoing args(getServiceType(), next ? "SetNextAVTransportURI" : - "SetAVTransportURI"); + SoapOutgoing args(getServiceType(), next ? "SetNextAVTransportURI" : "SetAVTransportURI"); args("InstanceID", SoapHelp::i2s(instanceID)) - (next ? "NextURI" : "CurrentURI", uri) - (next ? "NextURIMetaData" : "CurrentURIMetaData", metadata); + (next ? "NextURI" : "CurrentURI", uri) + (next ? "NextURIMetaData" : "CurrentURIMetaData", metadata); SoapIncoming data; return runAction(args, data); @@ -254,7 +248,7 @@ } args("InstanceID", SoapHelp::i2s(instanceID)) - ("NewPlayMode", playmode); + ("NewPlayMode", playmode); SoapIncoming data; return runAction(args, data); @@ -329,8 +323,7 @@ if (meta.m_items.size() > 0) { info.trackmeta = meta.m_items[0]; LOGDEB1("AVTransport::getPositionInfo: size " << - meta.m_items.size() << " current title: " - << meta.m_items[0].m_title << endl); + meta.m_items.size() << " current title: " << meta.m_items[0].m_title << "\n"); } } data.get("TrackURI", &info.trackuri); @@ -385,8 +378,7 @@ } string actions; if (!data.get("Actions", &actions)) { - LOGERR("AVTransport:getCurrentTransportActions: no actions in answer" - << endl); + LOGERR("AVTransport:getCurrentTransportActions: no actions in answer" << "\n"); return UPNP_E_BAD_RESPONSE; } return CTAStringToBits(actions, iacts); @@ -396,8 +388,7 @@ { vector<string> sacts; if (!csvToStrings(actions, sacts)) { - LOGERR("AVTransport::CTAStringToBits: bad actions string:" - << actions << endl); + LOGERR("AVTransport::CTAStringToBits: bad actions string:" << actions << "\n"); return UPNP_E_BAD_RESPONSE; } iacts = 0; @@ -421,8 +412,8 @@ } else if (act.empty()) { continue; } else { - LOGERR("AVTransport::CTAStringToBits: unknown action in " << - actions << " : [" << act << "]" << endl); + LOGINF("AVTransport::CTAStringToBits: unknown action in " << + actions << " : [" << act << "]" << "\n"); } } return 0; @@ -448,7 +439,7 @@ { SoapOutgoing args(getServiceType(), "Play"); args("InstanceID", SoapHelp::i2s(instanceID)) - ("Speed", SoapHelp::i2s(speed)); + ("Speed", SoapHelp::i2s(speed)); SoapIncoming data; return runAction(args, data); } @@ -490,8 +481,8 @@ SoapOutgoing args(getServiceType(), "Seek"); args("InstanceID", SoapHelp::i2s(instanceID)) - ("Unit", sm) - ("Target", value); + ("Unit", sm) + ("Target", value); SoapIncoming data; return runAction(args, data); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/control/device.cxx new/libupnpp-0.22.2/libupnpp/control/device.cxx --- old/libupnpp-0.21.0/libupnpp/control/device.cxx 2020-06-23 12:43:30.000000000 +0200 +++ new/libupnpp-0.22.2/libupnpp/control/device.cxx 2022-06-23 15:47:45.000000000 +0200 @@ -34,26 +34,20 @@ Device::Device() + : m(new Internal()) { - if ((m = new Internal()) == 0) { - LOGERR("Device::Device: out of memory" << endl); - return; - } } Device::Device(const UPnPDeviceDesc& desc) + : m(new Internal()) { - if ((m = new Internal()) == 0) { - LOGERR("Device::Device: out of memory" << endl); - return; - } m->desc = desc; } const UPnPDeviceDesc *Device::desc() const { - return m ? &m->desc : 0; + return m ? &m->desc : nullptr; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/control/discovery.cxx new/libupnpp-0.22.2/libupnpp/control/discovery.cxx --- old/libupnpp-0.21.0/libupnpp/control/discovery.cxx 2020-09-18 10:42:08.000000000 +0200 +++ new/libupnpp-0.22.2/libupnpp/control/discovery.cxx 2022-06-23 14:59:21.000000000 +0200 @@ -22,6 +22,7 @@ #include <stdio.h> #include <upnp.h> +#include <netif.h> #include <unordered_set> #include <map> @@ -142,9 +143,8 @@ } // Get rid of unused warnings (the func is only used conditionally) - (void)cluDiscoveryToStr; - LOGDEB1("discovery:cllb:SearchRes/Alive: " << - cluDiscoveryToStr(disco) << endl); + (void)&cluDiscoveryToStr; + LOGDEB1("discovery:cllb:SearchRes/Alive: " << cluDiscoveryToStr(disco) << endl); // Device signals its existence and well-being. Perform the // UPnP "description" phase by downloading and decoding the @@ -158,19 +158,26 @@ // simultaneous downloads of a slow one, to avoid // tying up threads. std::unique_lock<std::mutex> lock(o_downloading_mutex); - pair<std::unordered_set<string>::iterator,bool> res = - o_downloading.insert(tp->url); + pair<std::unordered_set<string>::iterator,bool> res = o_downloading.insert(tp->url); if (!res.second) { - LOGDEB1("discovery:cllb: already downloading " << - tp->url << endl); + LOGDEB1("discovery:cllb: already downloading " << tp->url << endl); delete tp; return UPNP_E_SUCCESS; } } +#undef ONLY_IPV6 +#ifdef ONLY_IPV6 + struct sockaddr *claddr = + reinterpret_cast<struct sockaddr*>(UpnpDiscovery_get_DestAddr(disco)); + if (claddr->sa_family != AF_INET6) { + delete tp; + return UPNP_E_SUCCESS; + } +#endif + LOGDEB1("discovery:cluCallback:: downloading " << tp->url << endl); - if (!downloadUrlWithCurl( - tp->url, tp->description,DISCO_HTTP_TIMEOUT, &disco->DestAddr)) { + if (!downloadUrlWithCurl(tp->url, tp->description,DISCO_HTTP_TIMEOUT, &disco->DestAddr)) { LOGERR("discovery:cllb: downloadUrlWithCurl error for: " << tp->url << endl); { std::unique_lock<std::mutex> lock(o_downloading_mutex); @@ -246,11 +253,8 @@ public: DeviceDescriptor(const string& url, const string& description, std::chrono::steady_clock::time_point last, int exp) - : device(url, description), last_seen(last), - expires(std::chrono::seconds(exp)) - {} - DeviceDescriptor() - {} + : device(url, description), last_seen(last), expires(std::chrono::seconds(exp)) {} + DeviceDescriptor() {} UPnPDeviceDesc device; std::chrono::steady_clock::time_point last_seen; std::chrono::seconds expires; // seconds valid @@ -290,17 +294,15 @@ auto it = o_pool.m_devices.find(tsk->deviceId); if (it != o_pool.m_devices.end()) { o_pool.m_devices.erase(it); - //LOGDEB("discoExplorer: delete " << tsk->deviceId.c_str() << - // endl); + LOGDEB2("discoExplorer: delete " << tsk->deviceId.c_str() << endl); } } else { // Update or insert the device - DeviceDescriptor d(tsk->url, tsk->description, - std::chrono::steady_clock::now(), - tsk->expires); + DeviceDescriptor d( + tsk->url, tsk->description, std::chrono::steady_clock::now(), tsk->expires); if (!d.device.ok) { - LOGERR("discoExplorer: description parse failed for " << - tsk->deviceId << endl); + LOGERR("discoExplorer: description parse failed for " << tsk->deviceId << endl); + LOGINF("discoExplorer: description data: [" << tsk->description << "]\n"); delete tsk; continue; } @@ -377,10 +379,8 @@ return; } lib->m->registerHandler(UPNP_DISCOVERY_SEARCH_RESULT, cluCallBack, this); - lib->m->registerHandler(UPNP_DISCOVERY_ADVERTISEMENT_ALIVE, - cluCallBack, this); - lib->m->registerHandler(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE, - cluCallBack, this); + lib->m->registerHandler(UPNP_DISCOVERY_ADVERTISEMENT_ALIVE, cluCallBack, this); + lib->m->registerHandler(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE, cluCallBack, this); o_ok = search(); } @@ -421,8 +421,7 @@ std::this_thread::sleep_for(std::chrono::milliseconds(100)); } LOGDEB1("UPnPDeviceDirectory::search: calling upnpsearchasync" << endl); - int code1 = UpnpSearchAsync(lib->m->getclh(), - (int)o_searchTimeout, cp, lib); + int code1 = UpnpSearchAsync(lib->m->getclh(), (int)o_searchTimeout, cp, lib); if (code1 != UPNP_E_SUCCESS) { o_reason = LibUPnP::errAsString("UpnpSearchAsync", code1); LOGERR("UPnPDeviceDirectory::search: UpnpSearchAsync failed: " << @@ -553,9 +552,8 @@ // Lookup a device in the pool. If not found and a search is active, // use a cond_wait to wait for device events (awaken by deviceFound). -static bool getDevBySelector( - bool cmp(const UPnPDeviceDesc& ddesc, const string&), - const string& value, UPnPDeviceDesc& ddesc) +static bool getDevBySelector(bool cmp(const UPnPDeviceDesc& ddesc, const string&), + const string& value, UPnPDeviceDesc& ddesc) { // Has locking, do it before our own lock expireDevices(); @@ -593,8 +591,7 @@ return ddesc.friendlyName.compare(fname) != 0; } -bool UPnPDeviceDirectory::getDevByFName(const string& fname, - UPnPDeviceDesc& ddesc) +bool UPnPDeviceDirectory::getDevByFName(const string& fname, UPnPDeviceDesc& ddesc) { return getDevBySelector(cmpFName, fname, ddesc); } @@ -604,27 +601,23 @@ return ddesc.UDN.compare(value) != 0; } -bool UPnPDeviceDirectory::getDevByUDN(const string& value, - UPnPDeviceDesc& ddesc) +bool UPnPDeviceDirectory::getDevByUDN(const string& value, UPnPDeviceDesc& ddesc) { return getDevBySelector(cmpUDN, value, ddesc); } bool UPnPDeviceDirectory::getDescriptionDocuments( - const string &uidOrFriendly, string& deviceXML, - unordered_map<string, string>& srvsXML) + const string &uidOrFriendly, string& deviceXML, unordered_map<string, string>& srvsXML) { UPnPDeviceDesc ddesc; - if (!getDevByUDN(uidOrFriendly, ddesc) && - !getDevByFName(uidOrFriendly, ddesc)) { + if (!getDevByUDN(uidOrFriendly, ddesc) && !getDevByFName(uidOrFriendly, ddesc)) { return false; } deviceXML = ddesc.XMLText; for (const auto& entry : ddesc.services) { srvsXML[entry.serviceId] = ""; UPnPServiceDesc::Parsed parsed; - entry.fetchAndParseDesc(ddesc.URLBase, parsed, - &srvsXML[entry.serviceId]); + entry.fetchAndParseDesc(ddesc.URLBase, parsed, &srvsXML[entry.serviceId]); } return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/control/linnsongcast.cxx new/libupnpp-0.22.2/libupnpp/control/linnsongcast.cxx --- old/libupnpp-0.21.0/libupnpp/control/linnsongcast.cxx 2020-06-23 12:43:30.000000000 +0200 +++ new/libupnpp-0.22.2/libupnpp/control/linnsongcast.cxx 2021-04-08 19:36:57.000000000 +0200 @@ -323,7 +323,7 @@ } } -bool setReceiverPlaying(ReceiverState st) +bool setReceiverPlaying(ReceiverState& st) { if (!st.rcv || !st.prod) { string uuid = st.UDN; @@ -346,7 +346,7 @@ return true; } -bool setReceiverPlaying(ReceiverState st, +bool setReceiverPlaying(ReceiverState& st, const string& uri, const string& meta) { if (!st.rcv || !st.prod) { @@ -374,7 +374,7 @@ return true; } -bool stopReceiver(ReceiverState st) +bool stopReceiver(ReceiverState& st) { LOGDEB("stopReceiver: st.nm " << st.nm << " st.UDN " << st.UDN << endl); if (!st.rcv || !st.prod) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/control/linnsongcast.hxx new/libupnpp-0.22.2/libupnpp/control/linnsongcast.hxx --- old/libupnpp-0.21.0/libupnpp/control/linnsongcast.hxx 2020-09-21 09:27:39.000000000 +0200 +++ new/libupnpp-0.22.2/libupnpp/control/linnsongcast.hxx 2021-04-08 19:36:57.000000000 +0200 @@ -136,11 +136,11 @@ /** Get status for all found Receiver services */ void UPNPP_API listReceivers(std::vector<ReceiverState>& vscs); -bool UPNPP_API setReceiverPlaying(ReceiverState st); -bool UPNPP_API setReceiverPlaying(ReceiverState st, +bool UPNPP_API setReceiverPlaying(ReceiverState& st); +bool UPNPP_API setReceiverPlaying(ReceiverState& st, const std::string& uri, const std::string& meta); -bool UPNPP_API stopReceiver(ReceiverState st); +bool UPNPP_API stopReceiver(ReceiverState& st); void UPNPP_API setReceiversFromSender(const std::string& sendernm, const std::vector<std::string>& rcvnms); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/control/service.cxx new/libupnpp-0.22.2/libupnpp/control/service.cxx --- old/libupnpp-0.21.0/libupnpp/control/service.cxx 2021-01-03 14:21:22.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/control/service.cxx 2022-08-12 11:16:01.000000000 +0200 @@ -52,10 +52,9 @@ std::string friendlyName; std::string manufacturer; std::string modelName; - Upnp_SID SID{0}; /* Subscription Id */ + Upnp_SID SID; /* Subscription Id */ - void initFromDeviceAndService(const UPnPDeviceDesc& devdesc, - const UPnPServiceDesc& servdesc) { + void initFromDeviceAndService(const UPnPDeviceDesc& devdesc, const UPnPServiceDesc& servdesc) { actionURL = caturl(devdesc.URLBase, servdesc.controlURL); eventURL = caturl(devdesc.URLBase, servdesc.eventSubURL); serviceType = servdesc.serviceType; @@ -81,17 +80,12 @@ Service::Service(const UPnPDeviceDesc& devdesc, const UPnPServiceDesc& servdesc) + : m(new Internal()) { - if ((m = new Internal()) == 0) { - LOGERR("Device::Device: out of memory" << endl); - return; - } - m->initFromDeviceAndService(devdesc, servdesc); // Only does anything the first time initEvents(); - // serviceInit() will be called from the derived class constructor - // if needed + // serviceInit() will be called from the derived class constructor if needed } bool Service::initFromDescription(const UPnPDeviceDesc& devdesc) @@ -112,11 +106,8 @@ } Service::Service() + : m(new Internal()) { - if ((m = new Internal()) == 0) { - LOGERR("Device::Device: out of memory" << endl); - return; - } } Service::~Service() @@ -124,7 +115,7 @@ LOGDEB1("Service::~Service: " << m->eventURL << " SID " << m->SID << endl); unregisterCallback(); delete m; - m = 0; + m = nullptr; } const string& Service::getFriendlyName() const @@ -166,23 +157,19 @@ } UpnpClient_Handle hdl = lib->m->getclh(); - LOGDEB1("Service::runAction: url [" << m->actionURL << - " serviceType " << m->serviceType << - " rqst: [" << "TBD SOME REQUEST" << "]" << endl); - std::vector<std::pair<std::string, std::string>> response; int errcode; std::string errdesc; int ret = UpnpSendAction(hdl, "", m->actionURL, m->serviceType, - args.m->name, args.m->data, response, &errcode, - errdesc); + args.m->name, args.m->data, response, &errcode, errdesc); if (ret != UPNP_E_SUCCESS) { - LOGINF("Service::runAction: UpnpSendAction returned " << ret << endl); + LOGINF("Service::runAction: UpnpSendAction error " << ret << " for service: " << + args.m->serviceType << " action: " << args.m->name << " args: " << + SoapHelp::argsToStr(args.m->data.begin(), args.m->data.end()) << "\n"); if (ret < 0) { LOGINF(" error message: " << UpnpGetErrorMessage(ret) << endl); } else { - LOGINF(" Response errorCode: " << errcode << - " errorDescription: " << errdesc << endl); + LOGINF(" Response errorCode: " << errcode << " errorDescription: " << errdesc<<"\n"); } return ret; } @@ -197,9 +184,8 @@ return runAction(args, data); } -template <class T> int Service::runSimpleGet(const std::string& actnm, - const std::string& valnm, - T *valuep) +template <class T> int Service::runSimpleGet( + const std::string& actnm, const std::string& valnm, T *valuep) { SoapOutgoing args(m->serviceType, actnm); SoapIncoming data; @@ -208,16 +194,14 @@ return ret; } if (!data.get(valnm.c_str(), valuep)) { - LOGERR("Service::runSimpleAction: " << actnm << - " missing " << valnm << " in response" << std::endl); + LOGERR("Service::runSimpleAction: " << actnm << " missing " << valnm <<" in response"<<"\n"); return UPNP_E_BAD_RESPONSE; } return 0; } -template <class T> int Service::runSimpleAction(const std::string& actnm, - const std::string& valnm, - T value) +template <class T> int Service::runSimpleAction( + const std::string& actnm, const std::string& valnm, T value) { SoapOutgoing args(m->serviceType, actnm); args(valnm, SoapHelp::val2s(value)); @@ -230,12 +214,15 @@ { std::unique_lock<std::mutex> lock(cblock); - // All event types begin with a SID field + // All event types have a SID field const char *sid = UpnpEvent_get_SID_cstr((UpnpEvent*)vevp); LOGDEB0("Service:srvCB: " << evTypeAsString(et) << " SID " << sid << endl); auto it = o_calls.find(sid); + if (it == o_calls.end()) { + LOGINF("Service::srvCB: no callback found for SID " << sid << "\n"); + } switch (et) { case UPNP_EVENT_AUTORENEWAL_FAILED: @@ -248,23 +235,19 @@ case UPNP_EVENT_RECEIVED: { UpnpEvent *evp = (UpnpEvent *)vevp; - LOGDEB1("Service:srvCB: var change event: SID " << sid << - " EventKey " << UpnpEvent_get_EventKey(evp) << " changed " << - SoapHelp::argsToString(evp->ChangedVariables.begin(), - evp->ChangedVariables.end()) << "\n"); + LOGDEB1("Service:srvCB: var change event: SID " << sid << " EventKey " << + UpnpEvent_get_EventKey(evp) << " changed " << + SoapHelp::argsToStr(evp->ChangedVariables.begin(), + evp->ChangedVariables.end()) << "\n"); if (it != o_calls.end()) { (it->second)(evp->ChangedVariables); - } else { - LOGINF("Service::srvCB: no callback found for SID " << sid << "\n"); } break; } default: - // Ignore other events for now - LOGDEB("Service:srvCB: unprocessed evt type: [" << - evTypeAsString(et) << "]" << "\n"); + LOGDEB("Service:srvCB: unprocessed evt type: [" << evTypeAsString(et) << "]" << "\n"); break; } @@ -303,14 +286,13 @@ return false; } int timeout = lib->m->getSubsTimeout(); - int ret = UpnpSubscribe(lib->m->getclh(), eventURL.c_str(), - &timeout, SID); + int ret = UpnpSubscribe(lib->m->getclh(), eventURL.c_str(), &timeout, SID); if (ret != UPNP_E_SUCCESS) { - LOGERR("Service:subscribe: failed: " << ret << " : " << + LOGERR("Service:subscribe: " << eventURL << " failed: " << ret << " : " << UpnpGetErrorMessage(ret) << endl); return false; } - LOGDEB1("Service::subs: " << eventURL << " SID " << SID << endl); + LOGDEB("Service::subscribe: " << eventURL << " SID " << SID << endl); return true; } @@ -322,11 +304,11 @@ LOGINF("Service::unSubscribe: no lib" << endl); return false; } - if (SID[0]) { + if (!SID.empty()) { int ret = UpnpUnSubscribe(lib->m->getclh(), SID); if (ret != UPNP_E_SUCCESS) { LOGERR("Service:unSubscribe: failed: " << ret << " : " << - UpnpGetErrorMessage(ret) << endl); + UpnpGetErrorMessage(ret) << " for SID [" << SID << "]\n"); return false; } // Let the caller erase m->SID[] because there may be other @@ -342,21 +324,19 @@ return false; } std::unique_lock<std::mutex> lock(cblock); - LOGDEB1("Service::registerCallback: " << m->eventURL << " SID " << - m->SID << endl); + LOGDEB1("Service::registerCallback: " << m->eventURL << " SID " << m->SID << endl); o_calls[m->SID] = c; return true; } void Service::unregisterCallback() { - LOGDEB1("Service::unregisterCallback: " << m->eventURL << " SID " << - m->SID << endl); - if (m->SID[0]) { + LOGDEB1("Service::unregisterCallback: " << m->eventURL << " SID " << m->SID << endl); + if (!m->SID.empty()) { m->unSubscribe(); std::unique_lock<std::mutex> lock(cblock); o_calls.erase(m->SID); - m->SID[0] = 0; + m->SID.clear(); } } @@ -380,7 +360,7 @@ bool Service::reSubscribe() { LOGDEB("Service::reSubscribe()\n"); - if (m->SID[0] == 0) { + if (m->SID.empty()) { LOGINF("Service::reSubscribe: no subscription (null SID)\n"); return false; } @@ -389,8 +369,7 @@ std::unique_lock<std::mutex> lock(cblock); auto it = o_calls.find(m->SID); if (it == o_calls.end()) { - LOGINF("Service::reSubscribe: no callback found for m->SID " << - m->SID << endl); + LOGINF("Service::reSubscribe: no callback found for m->SID " << m->SID << endl); return false; } c = it->second; @@ -401,8 +380,7 @@ } template int Service::runSimpleAction<int>(string const&, string const&, int); -template int Service::runSimpleAction<string>(string const&, string const&, - string); +template int Service::runSimpleAction<string>(string const&, string const&, string); template int Service::runSimpleGet<int>(string const&, string const&, int*); template int Service::runSimpleGet<bool>(string const&, string const&, bool*); template int Service::runSimpleAction<bool>(string const&, string const&, bool); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/control/typedservice.cxx new/libupnpp-0.22.2/libupnpp/control/typedservice.cxx --- old/libupnpp-0.21.0/libupnpp/control/typedservice.cxx 2020-07-28 13:25:22.000000000 +0200 +++ new/libupnpp-0.22.2/libupnpp/control/typedservice.cxx 2022-06-28 07:48:31.000000000 +0200 @@ -47,8 +47,8 @@ }; TypedService::TypedService(const string& tp) + : m(new Internal()) { - m = new Internal; string::size_type colon = tp.find_last_of(":"); m->servicetype = tp.substr(0, colon); if (colon != string::npos && colon != tp.size() -1) { @@ -56,8 +56,7 @@ } else { m->version = 0; } - LOGDEB2("TypedService::TypedService: tp " << m->servicetype << - " version " << m->version << endl); + LOGDEB2("TypedService::TypedService: tp " << m->servicetype <<" version " << m->version << endl); }; TypedService::~TypedService() @@ -78,14 +77,12 @@ } -bool TypedService::serviceInit(const UPnPDeviceDesc& device, - const UPnPServiceDesc& service) +bool TypedService::serviceInit(const UPnPDeviceDesc& device, const UPnPServiceDesc& service) { return service.fetchAndParseDesc(device.URLBase, m->proto); } -int TypedService::runAction(const string& actnm, vector<string> args, - map<string, string>& data) +int TypedService::runAction(const string& actnm, vector<string> args, map<string, string>& data) { auto it = m->proto.actionList.find(actnm); if (it == m->proto.actionList.end()) { @@ -129,8 +126,7 @@ LOGDEB1("TypedService::evtCallback: reporter: " << reporter << endl); for (const auto& ent : props) { if (!reporter) { - LOGDEB1("TypedService::evtCallback: " << ent.first << " -> " - << ent.second << endl); + LOGDEB1("TypedService::evtCallback: " << ent.first << " -> " << ent.second << endl); } else { reporter->changed(ent.first.c_str(), ent.second.c_str()); } @@ -164,12 +160,11 @@ bool visit(const UPnPDeviceDesc& dev, const UPnPServiceDesc& serv) { LOGDEB2("findTypedService:visit: got " << dev.friendlyName << " " << dev.UDN << " " << serv.serviceType << endl); - bool matched = !dev.UDN.compare(dvname) || - !stringlowercmp(ldvname, dev.friendlyName); + bool matched = !dev.UDN.compare(dvname) || !stringlowercmp(ldvname, dev.friendlyName); if (matched) { if (fuzzy) { string ltp = stringtolower(serv.serviceType); - matched = matched && (ltp.find(stype) != string::npos); + matched = matched && (ltp.find(stype) != string::npos); } else { matched = matched && !stype.compare(serv.serviceType); } @@ -185,9 +180,8 @@ } }; -TypedService *findTypedService(const std::string& devname, - const std::string& servicetype, - bool fuzzy) +TypedService *findTypedService( + const std::string& devname, const std::string& servicetype, bool fuzzy) { UPnPDeviceDirectory *superdir = UPnPDeviceDirectory::getTheDir(); if (superdir == 0) { @@ -231,8 +225,7 @@ // string sdesc = cb.founddev.dump(); return service; } - LOGDEB("Service not found: " << devname << "/" << servicetype << - " fuzzy " << fuzzy << endl); + LOGDEB("Service not found: " << devname << "/" << servicetype << " fuzzy " << fuzzy << endl); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/device/device.cxx new/libupnpp-0.22.2/libupnpp/device/device.cxx --- old/libupnpp-0.21.0/libupnpp/device/device.cxx 2021-02-09 16:01:04.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/device/device.cxx 2022-08-10 14:40:16.000000000 +0200 @@ -781,6 +781,10 @@ m->evloopcond.notify_all(); } +// It does not seem right to unregister the device before the event loop returns. I think that this +// sometimes causes INVALID_HANDLE errors from upnpNotify() calls if the timing is bad. So we should +// probably first set needExit, then join the event loop, then close the device. Otoh, this does not +// seem to cause significant issues, so leave it alone for now. void UpnpDevice::shouldExit() { if (nullptr == m->rootdev) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/md5.cpp new/libupnpp-0.22.2/libupnpp/md5.cpp --- old/libupnpp-0.21.0/libupnpp/md5.cpp 2020-10-23 10:39:46.000000000 +0200 +++ new/libupnpp-0.22.2/libupnpp/md5.cpp 2022-04-24 08:30:00.000000000 +0200 @@ -26,9 +26,12 @@ #include "md5.h" #include <cstring> +#include <cstdint> + +namespace MedocUtils { #define PUT_BIT_LE(i, cp, value) do { \ - (cp)[i] = (uint8_t)(((value) >> 8 * i) & 0xFF); \ + (cp)[i] = uint8_t(((value) >> 8 * i) & 0xFF); \ } while (0) #define PUT_64BIT_LE(cp, value) do { \ @@ -281,6 +284,14 @@ return out; } +std::string MD5Hex(const std::string& data) +{ + std::string digest, out; + MD5String(data, digest); + MD5HexPrint(digest, out); + return out; +} + string& MD5HexScan(const string& xdigest, string& digest) { digest.erase(); @@ -297,3 +308,5 @@ } return digest; } + +} // End namespace MedocUtils diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/md5.h new/libupnpp-0.22.2/libupnpp/md5.h --- old/libupnpp-0.21.0/libupnpp/md5.h 2020-07-14 15:03:50.000000000 +0200 +++ new/libupnpp-0.22.2/libupnpp/md5.h 2022-04-24 08:30:28.000000000 +0200 @@ -17,6 +17,9 @@ #include <stddef.h> #include <stdint.h> +#include <string> + +namespace MedocUtils { #define MD5_BLOCK_LENGTH 64 #define MD5_DIGEST_LENGTH 16 @@ -33,10 +36,14 @@ void MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH]); /** md5 c++ utility wrappers */ -#include <string> extern void MD5Final(std::string& digest, MD5_CTX *); extern std::string& MD5String(const std::string& data, std::string& digest); extern std::string& MD5HexPrint(const std::string& digest, std::string& out); extern std::string& MD5HexScan(const std::string& xdigest, std::string& digest); +extern std::string MD5Hex(const std::string& data); + +} // End namespace MedocUtils + +using namespace MedocUtils; #endif /* _MD5_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/smallut.cpp new/libupnpp-0.22.2/libupnpp/smallut.cpp --- old/libupnpp-0.21.0/libupnpp/smallut.cpp 2021-02-11 10:01:13.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/smallut.cpp 2022-04-24 08:31:48.000000000 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2020 J.F.Dockes +/* Copyright (C) 2006-2022 J.F.Dockes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -53,6 +53,8 @@ using namespace std; +namespace MedocUtils { + int stringicmp(const string& s1, const string& s2) { return strcasecmp(s1.c_str(), s2.c_str()); @@ -294,25 +296,18 @@ return out; } -template <class T> void stringsToCSV(const T& tokens, string& s, - char sep) +template <class T> void stringsToCSV(const T& tokens, string& s, char sep) { s.erase(); - for (auto it = tokens.begin(); - it != tokens.end(); it++) { + for (const auto& tok : tokens) { bool needquotes = false; - if (it->empty() || - it->find_first_of(string(1, sep) + "\"\n") != string::npos) { + if (tok.empty() || tok.find_first_of(string(1, sep) + "\"\n") != string::npos) { needquotes = true; } - if (it != tokens.begin()) { - s.append(1, sep); - } if (needquotes) { s.append(1, '"'); } - for (unsigned int i = 0; i < it->length(); i++) { - char car = it->at(i); + for (auto&& car : tok) { if (car == '"') { s.append(2, '"'); } else { @@ -322,7 +317,35 @@ if (needquotes) { s.append(1, '"'); } + s.append(1, sep); } + // Remove last separator. + if (!s.empty()) + s.pop_back(); +} + +template <class T> std::string commonprefix(const T& values) +{ + if (values.empty()) + return std::string(); + if (values.size() == 1) + return *values.begin(); + unsigned int i = 0; + for (;;i++) { + auto it = values.begin(); + if (it->size() <= i) { + goto out; + } + auto val = (*it)[i]; + it++; + for (;it < values.end(); it++) { + if (it->size() <= i || (*it)[i] != val) { + goto out; + } + } + } +out: + return values.begin()->substr(0, i); } #ifdef SMALLUT_EXTERNAL_INSTANTIATIONS @@ -345,12 +368,12 @@ template string stringsToString<set<string> >(const set<string>&); template string stringsToString<unordered_set<string> >(const unordered_set<string>&); template void stringsToCSV<list<string> >(const list<string>&, string&, char); -template void stringsToCSV<vector<string> >(const vector<string>&, string&, - char); +template void stringsToCSV<vector<string> >(const vector<string>&, string&, char); +template string commonprefix<vector<string>>(const vector<string>&values); #endif void stringToTokens(const string& str, vector<string>& tokens, - const string& delims, bool skipinit) + const string& delims, bool skipinit, bool allowempty) { string::size_type startPos = 0, pos; @@ -370,7 +393,7 @@ } if (pos == startPos) { // Dont' push empty tokens after first - if (tokens.empty()) { + if (allowempty || tokens.empty()) { tokens.emplace_back(); } startPos = ++pos; @@ -574,7 +597,6 @@ return out; } - // Substitute printf-like percent cmds inside a string bool pcSubst(const string& in, string& out, const map<char, string>& subs) { @@ -954,7 +976,7 @@ return false; } - vector<string>::const_iterator it = vs.begin(); + auto it = vs.cbegin(); if (*it == "P" || *it == "p") { it++; if (!parseperiod(it, vs.end(), &p1)) { @@ -1224,7 +1246,7 @@ const std::string& in, const std::string& repl) { if (!ok()) { - return std::string(); + return {}; } int err; @@ -1259,7 +1281,7 @@ string SimpleRegexp::getMatch(const string& val, int i) const { if (i > m->nmatch) { - return string(); + return {}; } return val.substr(m->matches[i].rm_so, m->matches[i].rm_eo - m->matches[i].rm_so); @@ -1332,3 +1354,5 @@ void smallut_init_mt() { } + +} // End namespace MedocUtils diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/smallut.h new/libupnpp-0.22.2/libupnpp/smallut.h --- old/libupnpp-0.21.0/libupnpp/smallut.h 2021-02-09 16:01:16.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/smallut.h 2022-04-24 08:31:38.000000000 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 2006-2016 J.F.Dockes +/* Copyright (C) 2006-2022 J.F.Dockes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,10 @@ #include <vector> #include <map> +struct tm; + +namespace MedocUtils { + // Miscellaneous mostly string-oriented small utilities // Note that none of the following code knows about utf-8. @@ -136,13 +140,16 @@ template <class T> void stringsToCSV(const T& tokens, std::string& s, char sep = ','); +/** Find longest common prefix for bunch of strings */ +template <class T> std::string commonprefix(const T& values); + /** * Split input string. No handling of quoting. */ extern void stringToTokens(const std::string& s, std::vector<std::string>& tokens, const std::string& delims = " \t", - bool skipinit = true); + bool skipinit = true, bool allowempty = false); /** Like toTokens but with multichar separator */ extern void stringSplitString(const std::string& str, @@ -203,7 +210,6 @@ /** Portable timegm. MS C has _mkgmtime, but there is a bug in Gminw which * makes it inaccessible */ -struct tm; time_t portable_timegm(struct tm *tm); inline void leftzeropad(std::string& s, unsigned len) @@ -227,6 +233,8 @@ /// @param nmatch must be >= the number of parenthesed subexp in exp SimpleRegexp(const std::string& exp, int flags, int nmatch = 0); ~SimpleRegexp(); + SimpleRegexp(const SimpleRegexp&) = delete; + SimpleRegexp& operator=(const SimpleRegexp&) = delete; /// Match input against exp, return true if matches bool simpleMatch(const std::string& val) const; /// After simpleMatch success, get nth submatch, 0 is the whole @@ -270,4 +278,8 @@ /// Translate a value into a name extern std::string valToString(const std::vector<CharFlags>&, unsigned int val); +} // End namespace MedocUtils + +using namespace MedocUtils; + #endif /* _SMALLUT_H_INCLUDED_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/upnpplib.cxx new/libupnpp-0.22.2/libupnpp/upnpplib.cxx --- old/libupnpp-0.21.0/libupnpp/upnpplib.cxx 2021-03-01 15:17:38.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/upnpplib.cxx 2022-08-10 14:41:15.000000000 +0200 @@ -433,17 +433,21 @@ /////////////////////// Small global helpers -string caturl(const string& s1, const string& s2) +string caturl(const string& base, const string& rel) { - string out(s1); + // If the url to be concatenated is actually absolute, return it + if (rel.find("://") != string::npos) + return rel; + + string out(base); if (out[out.size()-1] == '/') { - if (s2[0] == '/') + if (rel[0] == '/') out.erase(out.size()-1); } else { - if (s2[0] != '/') + if (rel[0] != '/') out.push_back('/'); } - out += s2; + out += rel; return out; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/upnpplib.hxx new/libupnpp-0.22.2/libupnpp/upnpplib.hxx --- old/libupnpp-0.21.0/libupnpp/upnpplib.hxx 2021-01-18 19:05:20.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/upnpplib.hxx 2022-08-01 16:16:34.000000000 +0200 @@ -25,8 +25,8 @@ /** Version components. */ #define LIBUPNPP_VERSION_MAJOR 0 -#define LIBUPNPP_VERSION_MINOR 21 -#define LIBUPNPP_VERSION_REVISION 0 +#define LIBUPNPP_VERSION_MINOR 22 +#define LIBUPNPP_VERSION_REVISION 1 /// Got this from Xapian... #define LIBUPNPP_AT_LEAST(A,B,C) \ (LIBUPNPP_VERSION_MAJOR > (A) || \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/libupnpp/workqueue.h new/libupnpp-0.22.2/libupnpp/workqueue.h --- old/libupnpp-0.21.0/libupnpp/workqueue.h 2021-01-01 22:36:00.000000000 +0100 +++ new/libupnpp-0.22.2/libupnpp/workqueue.h 2021-12-10 08:49:55.000000000 +0100 @@ -71,6 +71,8 @@ setTerminateAndWait(); } } + WorkQueue(const WorkQueue&) = delete; + WorkQueue& operator=(const WorkQueue&) = delete; /** Task deleter * If put() is called with the flush option, and the tasks allocate memory, @@ -82,6 +84,12 @@ m_taskfreefunc = func; } + /// Forbid inputting new tasks. This is mostly useful for abnormal terminations as some data will + /// probably be lost, depending on how the upstream handles the put() error. + void closeShop() { + m_openforbusiness = false; + } + /** Start the worker threads. * * @param nworkers number of threads copies to start. @@ -112,10 +120,12 @@ */ bool put(T t, bool flushprevious = false) { std::unique_lock<std::mutex> lock(m_mutex); - if (!ok()) { - LOGERR("WorkQueue::put:" << m_name << ": !ok\n"); + if (!ok() || !m_openforbusiness) { + LOGERR("WorkQueue::put: " << m_name << ": ok: " << ok() << " openforbusiness " << + m_openforbusiness << "\n"); return false; } + LOGDEB2("WorkQueue::put: " << m_name << "\n"); while (ok() && m_high > 0 && m_queue.size() >= m_high) { m_clientsleeps++; @@ -152,7 +162,7 @@ /** Wait until the queue is inactive. Called from client. * * Waits until the task queue is empty and the workers are all - * back sleeping. Used by the client to wait for all current work + * back sleeping (or exited). Used by the client to wait for all current work * to be completed, when it needs to perform work that couldn't be * done in parallel with the worker's tasks, or before shutting * down. Work can be resumed after calling this. Note that the @@ -167,15 +177,14 @@ */ bool waitIdle() { std::unique_lock<std::mutex> lock(m_mutex); - if (!ok()) { - LOGERR("WorkQueue::waitIdle:" << m_name << ": not ok\n"); - return false; - } - - // We're done when the queue is empty AND all workers are back - // waiting for a task. - while (ok() && (m_queue.size() > 0 || - m_workers_waiting != m_worker_threads.size())) { + // We're not done while: + // - the queue is not empty and we have some workers left + // - OR some workers are working (not exited or back waiting for a task). + while (((m_queue.size() > 0 && m_workers_exited < m_worker_threads.size()) || + (m_workers_waiting + m_workers_exited) < m_worker_threads.size())) { + LOGDEB0("waitIdle: " << m_name << " qsz " << m_queue.size() << + " wwaiting " << m_workers_waiting << " wexit " << m_workers_exited << " nthr " << + m_worker_threads.size() << "\n"); m_clients_waiting++; m_ccond.wait(lock); m_clients_waiting--; @@ -350,6 +359,9 @@ // Status bool m_ok; + // Accepting new tasks + bool m_openforbusiness{true}; + // Our threads. std::list<Worker> m_worker_threads; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libupnpp-0.21.0/ltmain.sh new/libupnpp-0.22.2/ltmain.sh --- old/libupnpp-0.21.0/ltmain.sh 2021-03-13 13:58:05.000000000 +0100 +++ new/libupnpp-0.22.2/ltmain.sh 2022-08-12 12:34:17.000000000 +0200 @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-9" +VERSION="2.4.6 Debian-2.4.6-14" package_revision=2.4.6 @@ -387,7 +387,7 @@ # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # -# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: @@ -2141,7 +2141,7 @@ compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname $scriptversion Debian-2.4.6-9 + version: $progname $scriptversion Debian-2.4.6-14 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` @@ -7368,10 +7368,12 @@ # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer # -fuse-ld=* Linker select flags for GCC + # -static-* direct GCC to link specific libraries statically + # -fcilkplus Cilk Plus language extension features for C/C++ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*|-fuse-ld=*) + -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg"