[vlc-devel] [PATCH] upnp: Correct top directory url formatting
    dev.asenat at posteo.net 
    dev.asenat at posteo.net
       
    Wed Nov 18 19:32:27 CET 2020
    
    
  
From: Alaric Senat <dev.asenat at posteo.net>
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.
---
 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;
 
-- 
2.26.2
    
    
More information about the vlc-devel
mailing list