Adjust all users of BUrl to new API

The old BUrl constructor with just a string is now private. The new one
has a default value for the second parameter, but C++ doesn't exclude
the private constructor from the candidate functions search. So, the
default argument for the new constructor needs to be explicitly
specified now.

Change-Id: Idb1915649ea3d2c59e344801a9d4fe201f8040e9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9236
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: nephele nephele <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
PulkoMandy
2025-05-27 10:43:12 +00:00
committed by Adrien Destugues
parent 1d242620b4
commit 0ec1d4526c
20 changed files with 33 additions and 33 deletions
@@ -287,7 +287,7 @@ void HttpURLConnection::getResponse()
{
const char *p = getHeaderField("Location");
if (p) {
BUrl trueUrl(p);
BUrl trueUrl(p, true);
url = trueUrl;
delete __response;
__response = NULL;
@@ -114,7 +114,7 @@ bool IppSetupView::UpdateViewData()
request->setURI("printer-uri", url->Text());
request->setDelimiter(IPP_END_OF_ATTRIBUTES_TAG);
IppURLConnection conn(BUrl(url->Text()));
IppURLConnection conn(BUrl(url->Text(), true));
conn.setIppRequest(request);
conn.setRequestProperty("Connection", "close");
@@ -97,7 +97,7 @@ IppTransport::~IppTransport()
__fs.seekg(0, ios::beg);
request->setRawData(__fs, fssize);
BUrl url(__url);
BUrl url(__url, true);
IppURLConnection conn(url);
conn.setIppRequest(request);
conn.setRequestProperty("Connection", "close");
@@ -23,7 +23,7 @@
#define USERAGENT_FALLBACK_VERSION "0.0.0"
BUrl ServerSettings::sBaseUrl = BUrl(BASEURL_DEFAULT);
BUrl ServerSettings::sBaseUrl = BUrl(BASEURL_DEFAULT, true);
BString ServerSettings::sUserAgent = BString();
pthread_once_t ServerSettings::sUserAgentInitOnce = PTHREAD_ONCE_INIT;
bool ServerSettings::sPreferCache = false;
+1 -1
View File
@@ -277,7 +277,7 @@ App::ArgvReceived(int32 argc, char* argv[])
break;
case WEB_APP_BASE_URL_SWITCH:
if (ServerSettings::SetBaseUrl(BUrl(argv[i + 1])) != B_OK) {
if (ServerSettings::SetBaseUrl(BUrl(argv[i + 1], true)) != B_OK) {
HDERROR("malformed web app base url; %s", argv[i + 1]);
Quit();
} else {
+1 -1
View File
@@ -777,7 +777,7 @@ public:
case MSG_VISIT_PUBLISHER_WEBSITE:
{
BUrl url(fWebsiteLinkView->Text());
BUrl url(fWebsiteLinkView->Text(), true);
url.OpenWithPreferredApplication();
break;
}
+1 -1
View File
@@ -218,7 +218,7 @@ MainApp::ArgvReceived(int32 argc, char** argv)
getcwd(cwd, sizeof(cwd));
for (int i = 1; i < argc; i++) {
BUrl url(argv[i]);
BUrl url(argv[i], true);
if (url.IsValid()) {
BMessage archivedUrl;
url.Archive(&archivedUrl);
+1 -1
View File
@@ -654,7 +654,7 @@ MainWin::MessageReceived(BMessage* msg)
BString urlString;
entry_ref fileRef;
for (int32 j = 0; msg->FindString("data", j, &urlString) == B_OK; j++) {
BUrl url(urlString);
BUrl url(urlString, true);
if (url.IsValid() && url.Protocol() != "file") {
UrlPlaylistItem* item = new UrlPlaylistItem(url);
if (!fPlaylist->AddItem(item, i + j)) {
+2 -2
View File
@@ -62,7 +62,7 @@ NetworkStreamWin::MessageReceived(BMessage* message)
switch(message->what) {
case M_OPEN_URL:
{
BUrl url(fTextControl->Text());
BUrl url(fTextControl->Text(), true);
if (!url.IsValid()) {
BAlert* alert = new BAlert(B_TRANSLATE("Bad URL"),
B_TRANSLATE("Invalid URL inserted!"),
@@ -137,7 +137,7 @@ NetworkStreamWin::_LookIntoClipboardForUrl()
// Before to set the text let's see if it's really
// a valid URL.
BUrl url(text);
BUrl url(text, true);
if (url.IsValid())
fTextControl->SetText(text);
}
@@ -52,7 +52,7 @@ PlaylistFileReader::_AppendItemToPlaylist(const BString& entry, Playlist* playli
if (err == B_OK)
item = new (nothrow) FilePlaylistItem(refPath);
else {
BUrl url(entry);
BUrl url(entry, true);
if (url.IsValid())
item = new (nothrow) UrlPlaylistItem(url);
else {
@@ -30,7 +30,7 @@ UrlPlaylistItem::UrlPlaylistItem(const BMessage* archive)
{
const char* url = NULL;
if (archive->FindString("mediaplayer:url", &url) == B_OK)
fUrl = BUrl(url);
fUrl = BUrl(url, true);
}
+2 -2
View File
@@ -119,7 +119,7 @@ CheckItOut::ArgvReceived(int32 argc, char** argv)
return;
}
BUrl url(argv[1]);
BUrl url(argv[1], true);
fUrlString = url;
BString full = BUrl(url).SetProtocol(BString()).UrlString();
@@ -158,7 +158,7 @@ CheckItOut::_DoCheckItOut(entry_ref *ref, const char *name)
const char* pausec = " ; read -p 'Press any key'";
char* args[] = { (char *)"/bin/sh", (char *)"-c", NULL, NULL};
BUrl url(fUrlString);
BUrl url(fUrlString, true);
BString full = BUrl(url).SetProtocol(BString()).UrlString();
BString proto = url.Protocol();
BString host = url.Host();
+1 -1
View File
@@ -58,7 +58,7 @@ int media_play(const char* uri)
BMediaFile* playFile;
if (get_ref_for_path(uri, &ref) != B_OK) {
url.SetUrlString(uri);
url.SetUrlString(uri, true);
if (url.IsValid()) {
playFile = new BMediaFile(url);
} else
+1 -1
View File
@@ -96,7 +96,7 @@ main(int argc, char** argv)
result = B_OK;
} else if (strchr(*argv, ':')) {
// try to open it as an URI
BUrl url(*argv);
BUrl url(*argv, true);
result = url.OpenWithPreferredApplication();
if (result == B_OK || result == B_ALREADY_RUNNING)
continue;
+1 -1
View File
@@ -89,7 +89,7 @@ AddRepoCommand::Execute(int argc, const char* const* argv)
status_t result;
for (int i = 0; i < urlCount; ++i) {
// Test if a valid URL has been supplied before attempting to add
BUrl repoURL(repoURLs[i]);
BUrl repoURL(repoURLs[i], true);
if (!repoURL.IsValid()) {
result = B_BAD_VALUE;
DIE(result, "request for adding repository \"%s\" failed",
+5 -5
View File
@@ -117,7 +117,7 @@ UrlWrapper::RefsReceived(BMessage* msg)
}
}
if (url.Length()) {
BUrl u(url.String());
BUrl u(url.String(), true);
args[1] = (char*)u.UrlString().String();
mimetype = kURLHandlerSigBase;
mimetype += u.Protocol();
@@ -196,7 +196,7 @@ UrlWrapper::RefsReceived(BMessage* msg)
}
}
if (url.Length()) {
BUrl u(url.String());
BUrl u(url.String(), true);
args[1] = (char*)u.UrlString().String();
mimetype = kURLHandlerSigBase;
mimetype += u.Protocol();
@@ -210,7 +210,7 @@ UrlWrapper::RefsReceived(BMessage* msg)
// NetPositive Bookmark or any file with a META:url attribute
if (f.ReadAttr("META:url", B_STRING_TYPE, 0LL, buff,
B_PATH_NAME_LENGTH) > 0) {
BUrl u(buff);
BUrl u(buff, true);
args[1] = (char*)u.UrlString().String();
mimetype = kURLHandlerSigBase;
mimetype += u.Protocol();
@@ -235,7 +235,7 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv)
char* args[] = { (char *)"/bin/sh", (char *)"-c", NULL, NULL};
status_t err;
BUrl url(argv[1]);
BUrl url(argv[1], true);
BString full = BUrl(url).SetProtocol(BString()).UrlString();
BString proto = url.Protocol();
@@ -520,7 +520,7 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv)
BString mimetype;
url << full;
BUrl u(url.String());
BUrl u(url.String(), true);
args[0] = const_cast<char*>("urlwrapper"); //XXX
args[1] = (char*)u.UrlString().String();
args[2] = NULL;
@@ -51,8 +51,8 @@ class GeolocationListener: public BUrlProtocolListener
BGeolocation::BGeolocation()
: fGeolocationService(kDefaultGeolocationService),
fGeocodingService(kDefaultGeocodingService)
: fGeolocationService(kDefaultGeolocationService, true),
fGeocodingService(kDefaultGeocodingService, true)
{
}
@@ -63,9 +63,9 @@ BGeolocation::BGeolocation(const BUrl& geolocationService,
fGeocodingService(geocodingService)
{
if (!fGeolocationService.IsValid())
fGeolocationService.SetUrlString(kDefaultGeolocationService);
fGeolocationService.SetUrlString(kDefaultGeolocationService, true);
if (!fGeocodingService.IsValid())
fGeocodingService.SetUrlString(kDefaultGeocodingService);
fGeocodingService.SetUrlString(kDefaultGeocodingService, true);
}
+1 -1
View File
@@ -1204,7 +1204,7 @@ void
BPackageInfo::Parser::UrlStringValidator::Validate(const BString& urlString,
const char* pos)
{
BUrl url(urlString);
BUrl url(urlString, true);
if (!url.IsValid())
throw ParseError("invalid url", pos);
@@ -82,7 +82,7 @@ AddRepoWindow::MessageReceived(BMessage* message)
BString url(fText->Text());
if (url != "") {
// URL must have a protocol
BUrl newRepoUrl(url);
BUrl newRepoUrl(url, true);
if (!newRepoUrl.IsValid()) {
BAlert* alert = new BAlert("error",
B_TRANSLATE_COMMENT("This is not a valid URL.",
@@ -129,7 +129,7 @@ AddRepoWindow::_GetClipboardData()
// The string must be a valid url
BString clipString(string, stringLen);
BUrl testUrl(clipString.String());
BUrl testUrl(clipString.String(), true);
if (!testUrl.IsValid())
return B_ERROR;
else
@@ -505,7 +505,7 @@ RepositoriesView::_UpdateFromRepoConfig(RepoRow* rowItem)
void
RepositoriesView::AddManualRepository(BString url)
{
BUrl newRepoUrl(url);
BUrl newRepoUrl(url, true);
if (!newRepoUrl.IsValid())
return;
@@ -514,7 +514,7 @@ RepositoriesView::AddManualRepository(BString url)
int32 listCount = fListView->CountRows();
for (index = 0; index < listCount; index++) {
RepoRow* repoItem = dynamic_cast<RepoRow*>(fListView->RowAt(index));
BUrl rowRepoUrl(repoItem->Url());
BUrl rowRepoUrl(repoItem->Url(), true);
// Find an already existing URL
if (newRepoUrl == rowRepoUrl) {
(new BAlert("duplicate",
@@ -637,7 +637,7 @@ RepoRow*
RepositoriesView::_AddRepo(BString name, BString url, bool enabled)
{
// URL must be valid
BUrl repoUrl(url);
BUrl repoUrl(url, true);
if (!repoUrl.IsValid())
return NULL;
int32 index;
@@ -645,7 +645,7 @@ RepositoriesView::_AddRepo(BString name, BString url, bool enabled)
// Find if the repo already exists in list
for (index = 0; index < listCount; index++) {
RepoRow* repoItem = dynamic_cast<RepoRow*>(fListView->RowAt(index));
BUrl itemUrl(repoItem->Url());
BUrl itemUrl(repoItem->Url(), true);
if (repoUrl == itemUrl) {
// update name and enabled values
if (name != repoItem->Name())