[vlc-commits] [Git][videolan/vlc][master] vlc_url: make psz_protocol const
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Nov 6 09:17:30 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
eef04531 by Steve Lhomme at 2026-11-06T08:52:58+00:00
vlc_url: make psz_protocol const
We never write into that string and it's only set const strings that
are unsafely casted.
- - - - -
5 changed files:
- include/vlc_url.h
- modules/access/satip.c
- modules/access/webdav.c
- modules/demux/adaptive/http/ConnectionParams.cpp
- modules/stream_out/chromecast/chromecast_communication.cpp
Changes:
=====================================
include/vlc_url.h
=====================================
@@ -143,7 +143,7 @@ VLC_API char *vlc_uri_fixup(const char *) VLC_MALLOC;
struct vlc_url_t
{
- char *psz_protocol;
+ const char *psz_protocol;
char *psz_username;
char *psz_password;
char *psz_host;
=====================================
modules/access/satip.c
=====================================
@@ -700,7 +700,7 @@ static int satip_open(vlc_object_t *obj)
if( setup_url.psz_protocol == NULL ||
strncasecmp( setup_url.psz_protocol, "satip", 5 ) == 0 )
{
- setup_url.psz_protocol = (char *)"rtsp";
+ setup_url.psz_protocol = "rtsp";
}
char *psz_setup_url = vlc_uri_compose(&setup_url);
=====================================
modules/access/webdav.c
=====================================
@@ -86,7 +86,7 @@ vlc_module_end()
static char *BuildChildUrl(access_sys_t *sys, const char *href)
{
vlc_url_t base = {
- .psz_protocol = sys->secure ? (char *)"webdavs" : (char *)"webdav",
+ .psz_protocol = sys->secure ? "webdavs" : "webdav",
.psz_host = sys->host,
.i_port = sys->port,
.psz_path = sys->path,
@@ -529,7 +529,7 @@ static int Open(vlc_object_t *obj)
if (sys->manager == NULL)
goto clean;
- sys->url.psz_protocol = sys->secure ? (char *)"https" : (char *)"http";
+ sys->url.psz_protocol = sys->secure ? "https" : "http";
vlc_credential crd;
vlc_credential_init(&crd, &sys->url);
=====================================
modules/demux/adaptive/http/ConnectionParams.cpp
=====================================
@@ -64,7 +64,7 @@ void ConnectionParams::setPath(const std::string &path_)
vlc_url_t url_components{};
char *uri_str;
- url_components.psz_protocol = const_cast<char *>(scheme.c_str());
+ url_components.psz_protocol = scheme.c_str();
url_components.psz_path = const_cast<char *>(path_.c_str());
url_components.i_port = 0;
=====================================
modules/stream_out/chromecast/chromecast_communication.cpp
=====================================
@@ -290,7 +290,7 @@ std::string ChromecastCommunication::getServerBaseURL() const
{
vlc_url_t url_comps{};
- url_comps.psz_protocol = (char*)"http";
+ url_comps.psz_protocol = "http";
url_comps.psz_host = (char*)m_serverIp.c_str();
url_comps.i_port = m_serverPort;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eef04531c23e5cace0f55541049a38d98e06613f
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/eef04531c23e5cace0f55541049a38d98e06613f
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list