[vlc-commits] upnp: Correct top directory url formatting

Alaric Senat git at videolan.org
Wed Nov 25 11:00:15 CET 2020


vlc | branch: master | Alaric Senat <dev.asenat at posteo.net> | Wed Nov 18 19:32:27 2020 +0100| [f5f5a0d0ddb6c96ab08a6b3ca1115dcbd2ae2c77] | committer: Thomas Guillem

upnp: Correct top directory url formatting

As pointed out in #25055 the choice of url option delimiter is probably
meant to be that way. std::string.find() returns std::string::npos (aka
-1) in case of no match.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f5f5a0d0ddb6c96ab08a6b3ca1115dcbd2ae2c77
---

 modules/services_discovery/upnp.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 054a5d1910..a249e3b4d2 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -407,7 +407,7 @@ bool MediaServerList::addServer( MediaServerDesc* desc )
     } else {
         char* psz_mrl;
         // We might already have some options specified in the location.
-        char opt_delim = desc->location.find( '?' ) == 0 ? '?' : '&';
+        char opt_delim = desc->location.find( '?' ) == std::string::npos ? '?' : '&';
         if( asprintf( &psz_mrl, "upnp://%s%cObjectID=0", desc->location.c_str(), opt_delim ) < 0 )
             return false;
 



More information about the vlc-commits mailing list