summaryrefslogtreecommitdiff
path: root/indra/llcommon/lluriparser.cpp
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-05-22 19:04:52 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-05-22 19:04:52 +0200
commit1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch)
treeab243607f74f78200787bba5b9b88f07ef1b966f /indra/llcommon/lluriparser.cpp
parent6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff)
parente1623bb276f83a43ce7a197e388720c05bdefe61 (diff)
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts: # autobuild.xml # indra/cmake/CMakeLists.txt # indra/cmake/GoogleMock.cmake # indra/llaudio/llaudioengine_fmodstudio.cpp # indra/llaudio/llaudioengine_fmodstudio.h # indra/llaudio/lllistener_fmodstudio.cpp # indra/llaudio/lllistener_fmodstudio.h # indra/llaudio/llstreamingaudio_fmodstudio.cpp # indra/llaudio/llstreamingaudio_fmodstudio.h # indra/llcharacter/llmultigesture.cpp # indra/llcharacter/llmultigesture.h # indra/llimage/llimage.cpp # indra/llimage/llimagepng.cpp # indra/llimage/llimageworker.cpp # indra/llimage/tests/llimageworker_test.cpp # indra/llmessage/tests/llmockhttpclient.h # indra/llprimitive/llgltfmaterial.h # indra/llrender/llfontfreetype.cpp # indra/llui/llcombobox.cpp # indra/llui/llfolderview.cpp # indra/llui/llfolderviewmodel.h # indra/llui/lllineeditor.cpp # indra/llui/lllineeditor.h # indra/llui/lltextbase.cpp # indra/llui/lltextbase.h # indra/llui/lltexteditor.cpp # indra/llui/lltextvalidate.cpp # indra/llui/lltextvalidate.h # indra/llui/lluictrl.h # indra/llui/llview.cpp # indra/llwindow/llwindowmacosx.cpp # indra/newview/app_settings/settings.xml # indra/newview/llappearancemgr.cpp # indra/newview/llappearancemgr.h # indra/newview/llavatarpropertiesprocessor.cpp # indra/newview/llavatarpropertiesprocessor.h # indra/newview/llbreadcrumbview.cpp # indra/newview/llbreadcrumbview.h # indra/newview/llbreastmotion.cpp # indra/newview/llbreastmotion.h # indra/newview/llconversationmodel.h # indra/newview/lldensityctrl.cpp # indra/newview/lldensityctrl.h # indra/newview/llface.inl # indra/newview/llfloatereditsky.cpp # indra/newview/llfloatereditwater.cpp # indra/newview/llfloateremojipicker.h # indra/newview/llfloaterimsessiontab.cpp # indra/newview/llfloaterprofiletexture.cpp # indra/newview/llfloaterprofiletexture.h # indra/newview/llgesturemgr.cpp # indra/newview/llgesturemgr.h # indra/newview/llimpanel.cpp # indra/newview/llimpanel.h # indra/newview/llinventorybridge.cpp # indra/newview/llinventorybridge.h # indra/newview/llinventoryclipboard.cpp # indra/newview/llinventoryclipboard.h # indra/newview/llinventoryfunctions.cpp # indra/newview/llinventoryfunctions.h # indra/newview/llinventorygallery.cpp # indra/newview/lllistbrowser.cpp # indra/newview/lllistbrowser.h # indra/newview/llpanelobjectinventory.cpp # indra/newview/llpanelprofile.cpp # indra/newview/llpanelprofile.h # indra/newview/llpreviewgesture.cpp # indra/newview/llsavedsettingsglue.cpp # indra/newview/llsavedsettingsglue.h # indra/newview/lltooldraganddrop.cpp # indra/newview/llurllineeditorctrl.cpp # indra/newview/llvectorperfoptions.cpp # indra/newview/llvectorperfoptions.h # indra/newview/llviewerparceloverlay.cpp # indra/newview/llviewertexlayer.cpp # indra/newview/llviewertexturelist.cpp # indra/newview/macmain.h # indra/test/test.cpp
Diffstat (limited to 'indra/llcommon/lluriparser.cpp')
-rw-r--r--indra/llcommon/lluriparser.cpp234
1 files changed, 117 insertions, 117 deletions
diff --git a/indra/llcommon/lluriparser.cpp b/indra/llcommon/lluriparser.cpp
index f79a98a56d..2ebb7fc742 100644
--- a/indra/llcommon/lluriparser.cpp
+++ b/indra/llcommon/lluriparser.cpp
@@ -1,4 +1,4 @@
-/**
+/**
* @file lluriparser.cpp
* @author Protey
* @date 2014-10-07
@@ -7,21 +7,21 @@
* $LicenseInfo:firstyear=2014&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2014, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,129 +36,129 @@
LLUriParser::LLUriParser(const std::string& u) : mTmpScheme(false), mNormalizedTmp(false), mRes(0)
{
- if (u.find("://") == std::string::npos)
- {
- mNormalizedUri = "http://";
- mTmpScheme = true;
- }
+ if (u.find("://") == std::string::npos)
+ {
+ mNormalizedUri = "http://";
+ mTmpScheme = true;
+ }
- mNormalizedUri += u.c_str();
+ mNormalizedUri += u.c_str();
- mRes = parse();
+ mRes = parse();
}
LLUriParser::~LLUriParser()
{
- uriFreeUriMembersA(&mUri);
+ uriFreeUriMembersA(&mUri);
}
S32 LLUriParser::parse()
{
- mRes = uriParseSingleUriA(&mUri, mNormalizedUri.c_str(), NULL);
- return mRes;
+ mRes = uriParseSingleUriA(&mUri, mNormalizedUri.c_str(), NULL);
+ return mRes;
}
const char * LLUriParser::scheme() const
{
- return mScheme.c_str();
+ return mScheme.c_str();
}
void LLUriParser::sheme(const std::string& s)
{
- mTmpScheme = !s.size();
- mScheme = s;
+ mTmpScheme = !s.size();
+ mScheme = s;
}
const char * LLUriParser::port() const
{
- return mPort.c_str();
+ return mPort.c_str();
}
void LLUriParser::port(const std::string& s)
{
- mPort = s;
+ mPort = s;
}
const char * LLUriParser::host() const
{
- return mHost.c_str();
+ return mHost.c_str();
}
void LLUriParser::host(const std::string& s)
{
- mHost = s;
+ mHost = s;
}
const char * LLUriParser::path() const
{
- return mPath.c_str();
+ return mPath.c_str();
}
void LLUriParser::path(const std::string& s)
{
- mPath = s;
+ mPath = s;
}
const char * LLUriParser::query() const
{
- return mQuery.c_str();
+ return mQuery.c_str();
}
void LLUriParser::query(const std::string& s)
{
- mQuery = s;
+ mQuery = s;
}
const char * LLUriParser::fragment() const
{
- return mFragment.c_str();
+ return mFragment.c_str();
}
void LLUriParser::fragment(const std::string& s)
{
- mFragment = s;
+ mFragment = s;
}
void LLUriParser::textRangeToString(UriTextRangeA& textRange, std::string& str)
{
- if (textRange.first != NULL && textRange.afterLast != NULL && textRange.first < textRange.afterLast)
- {
- const ptrdiff_t len = textRange.afterLast - textRange.first;
- str.assign(textRange.first, static_cast<std::string::size_type>(len));
- }
- else
- {
- str = LLStringUtil::null;
- }
+ if (textRange.first != NULL && textRange.afterLast != NULL && textRange.first < textRange.afterLast)
+ {
+ const ptrdiff_t len = textRange.afterLast - textRange.first;
+ str.assign(textRange.first, static_cast<std::string::size_type>(len));
+ }
+ else
+ {
+ str = LLStringUtil::null;
+ }
}
void LLUriParser::extractParts()
{
- if (mTmpScheme || mNormalizedTmp)
- {
- mScheme.clear();
- }
- else
- {
- textRangeToString(mUri.scheme, mScheme);
- }
-
- textRangeToString(mUri.hostText, mHost);
- textRangeToString(mUri.portText, mPort);
- textRangeToString(mUri.query, mQuery);
- textRangeToString(mUri.fragment, mFragment);
-
- UriPathSegmentA * pathHead = mUri.pathHead;
- while (pathHead)
- {
- std::string partOfPath;
- textRangeToString(pathHead->text, partOfPath);
-
- mPath += '/';
- mPath += partOfPath;
-
- pathHead = pathHead->next;
- }
+ if (mTmpScheme || mNormalizedTmp)
+ {
+ mScheme.clear();
+ }
+ else
+ {
+ textRangeToString(mUri.scheme, mScheme);
+ }
+
+ textRangeToString(mUri.hostText, mHost);
+ textRangeToString(mUri.portText, mPort);
+ textRangeToString(mUri.query, mQuery);
+ textRangeToString(mUri.fragment, mFragment);
+
+ UriPathSegmentA * pathHead = mUri.pathHead;
+ while (pathHead)
+ {
+ std::string partOfPath;
+ textRangeToString(pathHead->text, partOfPath);
+
+ mPath += '/';
+ mPath += partOfPath;
+
+ pathHead = pathHead->next;
+ }
}
#if LL_DARWIN
@@ -177,14 +177,14 @@ void uri_signal_handler(int signal)
S32 LLUriParser::normalize()
{
- mNormalizedTmp = mTmpScheme;
- if (!mRes)
- {
+ mNormalizedTmp = mTmpScheme;
+ if (!mRes)
+ {
#if LL_DARWIN
sighandler_t last_sigill_handler, last_sigbus_handler;
- last_sigill_handler = signal(SIGILL, &uri_signal_handler); // illegal instruction
+ last_sigill_handler = signal(SIGILL, &uri_signal_handler); // illegal instruction
last_sigbus_handler = signal(SIGBUS, &uri_signal_handler);
-
+
if (setjmp(return_to_normalize))
{
// Issue: external library crashed via signal
@@ -230,79 +230,79 @@ S32 LLUriParser::normalize()
}
}
}
- }
+ }
- if(mTmpScheme && mNormalizedUri.size() > 7)
- {
- mNormalizedUri = mNormalizedUri.substr(7);
- mTmpScheme = false;
- }
+ if(mTmpScheme && mNormalizedUri.size() > 7)
+ {
+ mNormalizedUri = mNormalizedUri.substr(7);
+ mTmpScheme = false;
+ }
- return mRes;
+ return mRes;
}
void LLUriParser::glue(std::string& uri) const
{
- std::string first_part;
- glueFirst(first_part);
+ std::string first_part;
+ glueFirst(first_part);
- std::string second_part;
- glueSecond(second_part);
+ std::string second_part;
+ glueSecond(second_part);
- uri = first_part + second_part;
+ uri = first_part + second_part;
}
void LLUriParser::glueFirst(std::string& uri, bool use_scheme) const
{
- if (use_scheme && mScheme.size())
- {
- uri = mScheme;
- uri += "://";
- }
- else
- {
- uri.clear();
- }
-
- uri += mHost;
+ if (use_scheme && mScheme.size())
+ {
+ uri = mScheme;
+ uri += "://";
+ }
+ else
+ {
+ uri.clear();
+ }
+
+ uri += mHost;
}
void LLUriParser::glueSecond(std::string& uri) const
{
- if (mPort.size())
- {
- uri = ':';
- uri += mPort;
- }
- else
- {
- uri.clear();
- }
-
- uri += mPath;
-
- if (mQuery.size())
- {
- uri += '?';
- uri += mQuery;
- }
-
- if (mFragment.size())
- {
- uri += '#';
- uri += mFragment;
- }
+ if (mPort.size())
+ {
+ uri = ':';
+ uri += mPort;
+ }
+ else
+ {
+ uri.clear();
+ }
+
+ uri += mPath;
+
+ if (mQuery.size())
+ {
+ uri += '?';
+ uri += mQuery;
+ }
+
+ if (mFragment.size())
+ {
+ uri += '#';
+ uri += mFragment;
+ }
}
bool LLUriParser::test() const
{
- std::string uri;
- glue(uri);
+ std::string uri;
+ glue(uri);
- return uri == mNormalizedUri;
+ return uri == mNormalizedUri;
}
const char * LLUriParser::normalizedUri() const
{
- return mNormalizedUri.c_str();
+ return mNormalizedUri.c_str();
}