summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-28 14:12:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-29 08:53:22 +0200
commitd3849255b76e92a42f653c266b88945708984c4f (patch)
treeff1eab21b9e5a1ea00e1573db4b4595ba51b0098 /tools
parentf9b6bd6336b35de060f6f5bdd91517caf5e9a56e (diff)
use more string_view in INetURLObject
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/qa/cppunit/test_urlobj.cxx86
-rw-r--r--tools/source/fsys/urlobj.cxx32
-rw-r--r--tools/source/inet/inetmsg.cxx32
3 files changed, 76 insertions, 74 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index abcd2fe1417b..8402fae5ed55 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -48,7 +48,7 @@ namespace tools_urlobj
// this is only demonstration code
void urlobjTest_001( )
{
- INetURLObject aUrl( OUString( "file://10.10.1.1/sampledir/sample.file" ) );
+ INetURLObject aUrl( u"file://10.10.1.1/sampledir/sample.file" );
CPPUNIT_ASSERT_EQUAL(INetProtocol::File, aUrl.GetProtocol());
CPPUNIT_ASSERT_EQUAL(OUString("10.10.1.1"),
aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
@@ -62,7 +62,7 @@ namespace tools_urlobj
void urlobjTest_004( )
{
- INetURLObject aUrl( OUString( "smb://10.10.1.1/sampledir/sample.file" ) );
+ INetURLObject aUrl( u"smb://10.10.1.1/sampledir/sample.file" );
CPPUNIT_ASSERT_EQUAL( INetProtocol::Smb, aUrl.GetProtocol( ) );
CPPUNIT_ASSERT_EQUAL(OUString("10.10.1.1"),
aUrl.GetHost(INetURLObject::DecodeMechanism::NONE));
@@ -77,7 +77,7 @@ namespace tools_urlobj
{
// Test with a username part
{
- INetURLObject aUrl( OUString( "vnd.libreoffice.cmis://username@http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) );
+ INetURLObject aUrl( u"vnd.libreoffice.cmis://username@http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" );
CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ),
OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DecodeMechanism::WithCharset ) ) );
CPPUNIT_ASSERT_EQUAL( std::string( "username" ), OUSTR_TO_STDSTR( aUrl.GetUser( ) ) );
@@ -88,8 +88,8 @@ namespace tools_urlobj
// Test without a username part
{
- INetURLObject aUrl( OUString(
- "vnd.libreoffice.cmis://http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) );
+ INetURLObject aUrl(
+ u"vnd.libreoffice.cmis://http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" );
CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ),
OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DecodeMechanism::WithCharset ) ) );
CPPUNIT_ASSERT( !aUrl.HasUserData() );
@@ -101,18 +101,18 @@ namespace tools_urlobj
void urlobjTest_emptyPath() {
{
- INetURLObject url(OUString("http://example.com"));
+ INetURLObject url(u"http://example.com");
CPPUNIT_ASSERT_EQUAL(INetProtocol::Http, url.GetProtocol());
CPPUNIT_ASSERT_EQUAL(OUString("example.com"), url.GetHost());
CPPUNIT_ASSERT_EQUAL(OUString("/"), url.GetURLPath());
}
{
// This is an invalid http URL per RFC 2616:
- INetURLObject url(OUString("http://example.com?query"));
+ INetURLObject url(u"http://example.com?query");
CPPUNIT_ASSERT(url.HasError());
}
{
- INetURLObject url(OUString("http://example.com#fragment"));
+ INetURLObject url(u"http://example.com#fragment");
CPPUNIT_ASSERT_EQUAL(INetProtocol::Http, url.GetProtocol());
CPPUNIT_ASSERT_EQUAL(OUString("example.com"), url.GetHost());
CPPUNIT_ASSERT_EQUAL(OUString("/"), url.GetURLPath());
@@ -125,19 +125,19 @@ namespace tools_urlobj
std::unique_ptr<SvMemoryStream> strm;
unsigned char const * buf;
- url = INetURLObject("data:");
+ url = INetURLObject(u"data:");
//TODO: CPPUNIT_ASSERT(url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(!strm);
- url = INetURLObject("data:,");
+ url = INetURLObject(u"data:,");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(strm != nullptr);
CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize());
strm.reset();
- url = INetURLObject("data:,,%C3%A4%90");
+ url = INetURLObject(u"data:,,%C3%A4%90");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(strm != nullptr);
@@ -149,26 +149,26 @@ namespace tools_urlobj
CPPUNIT_ASSERT_EQUAL(0x90, int(buf[3]));
strm.reset();
- url = INetURLObject("data:base64,");
+ url = INetURLObject(u"data:base64,");
//TODO: CPPUNIT_ASSERT(url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(!strm);
- url = INetURLObject("data:;base64,");
+ url = INetURLObject(u"data:;base64,");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(strm != nullptr);
CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize());
strm.reset();
- url = INetURLObject("data:;bAsE64,");
+ url = INetURLObject(u"data:;bAsE64,");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(strm != nullptr);
CPPUNIT_ASSERT_EQUAL(sal_uInt64(0), strm->GetSize());
strm.reset();
- url = INetURLObject("data:;base64,YWJjCg==");
+ url = INetURLObject(u"data:;base64,YWJjCg==");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(strm != nullptr);
@@ -180,17 +180,17 @@ namespace tools_urlobj
CPPUNIT_ASSERT_EQUAL(0x0A, int(buf[3]));
strm.reset();
- url = INetURLObject("data:;base64,YWJjCg=");
+ url = INetURLObject(u"data:;base64,YWJjCg=");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(!strm);
- url = INetURLObject("data:;base64,YWJ$Cg==");
+ url = INetURLObject(u"data:;base64,YWJ$Cg==");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(!strm);
- url = INetURLObject("data:text/plain;param=%22;base64,%22,YQ==");
+ url = INetURLObject(u"data:text/plain;param=%22;base64,%22,YQ==");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(strm != nullptr);
@@ -202,7 +202,7 @@ namespace tools_urlobj
CPPUNIT_ASSERT_EQUAL(0x3D, int(buf[3]));
strm.reset();
- url = INetURLObject("http://example.com");
+ url = INetURLObject(u"http://example.com");
CPPUNIT_ASSERT(!url.HasError());
strm = url.getData();
CPPUNIT_ASSERT(!strm);
@@ -212,62 +212,62 @@ namespace tools_urlobj
CPPUNIT_ASSERT(INetURLObject().isSchemeEqualTo(INetProtocol::NotValid));
CPPUNIT_ASSERT(!INetURLObject().isSchemeEqualTo(u""));
CPPUNIT_ASSERT(
- INetURLObject("http://example.org").isSchemeEqualTo(
+ INetURLObject(u"http://example.org").isSchemeEqualTo(
INetProtocol::Http));
CPPUNIT_ASSERT(
- !INetURLObject("http://example.org").isSchemeEqualTo(
+ !INetURLObject(u"http://example.org").isSchemeEqualTo(
INetProtocol::Https));
CPPUNIT_ASSERT(
- INetURLObject("http://example.org").isSchemeEqualTo(u"Http"));
+ INetURLObject(u"http://example.org").isSchemeEqualTo(u"Http"));
CPPUNIT_ASSERT(
- !INetURLObject("http://example.org").isSchemeEqualTo(u"dav"));
+ !INetURLObject(u"http://example.org").isSchemeEqualTo(u"dav"));
CPPUNIT_ASSERT(
- INetURLObject("dav://example.org").isSchemeEqualTo(u"dav"));
+ INetURLObject(u"dav://example.org").isSchemeEqualTo(u"dav"));
}
void urlobjTest_isAnyKnownWebDAVScheme() {
CPPUNIT_ASSERT(
- INetURLObject("http://example.org").isAnyKnownWebDAVScheme());
+ INetURLObject(u"http://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- INetURLObject("https://example.org").isAnyKnownWebDAVScheme());
+ INetURLObject(u"https://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- INetURLObject("vnd.sun.star.webdav://example.org").isAnyKnownWebDAVScheme());
+ INetURLObject(u"vnd.sun.star.webdav://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- INetURLObject("vnd.sun.star.webdavs://example.org").isAnyKnownWebDAVScheme());
+ INetURLObject(u"vnd.sun.star.webdavs://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- !INetURLObject("ftp://example.org").isAnyKnownWebDAVScheme());
+ !INetURLObject(u"ftp://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- !INetURLObject("file://example.org").isAnyKnownWebDAVScheme());
+ !INetURLObject(u"file://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- !INetURLObject("dav://example.org").isAnyKnownWebDAVScheme());
+ !INetURLObject(u"dav://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- !INetURLObject("davs://example.org").isAnyKnownWebDAVScheme());
+ !INetURLObject(u"davs://example.org").isAnyKnownWebDAVScheme());
CPPUNIT_ASSERT(
- !INetURLObject("vnd.sun.star.pkg://example.org").isAnyKnownWebDAVScheme());
+ !INetURLObject(u"vnd.sun.star.pkg://example.org").isAnyKnownWebDAVScheme());
}
void testSetName() {
{
- INetURLObject obj("file:///");
+ INetURLObject obj(u"file:///");
bool ok = obj.setName(u"foo");
CPPUNIT_ASSERT(!ok);
}
{
- INetURLObject obj("file:///foo");
+ INetURLObject obj(u"file:///foo");
bool ok = obj.setName(u"bar");
CPPUNIT_ASSERT(ok);
CPPUNIT_ASSERT_EQUAL(
OUString("file:///bar"), obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
}
{
- INetURLObject obj("file:///foo/");
+ INetURLObject obj(u"file:///foo/");
bool ok = obj.setName(u"bar");
CPPUNIT_ASSERT(ok);
CPPUNIT_ASSERT_EQUAL(
OUString("file:///bar/"), obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
}
{
- INetURLObject obj("file:///foo/bar");
+ INetURLObject obj(u"file:///foo/bar");
bool ok = obj.setName(u"baz");
CPPUNIT_ASSERT(ok);
CPPUNIT_ASSERT_EQUAL(
@@ -275,7 +275,7 @@ namespace tools_urlobj
obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
}
{
- INetURLObject obj("file:///foo/bar/");
+ INetURLObject obj(u"file:///foo/bar/");
bool ok = obj.setName(u"baz");
CPPUNIT_ASSERT(ok);
CPPUNIT_ASSERT_EQUAL(
@@ -285,7 +285,7 @@ namespace tools_urlobj
}
void testSetExtension() {
- INetURLObject obj("file:///foo/bar.baz/");
+ INetURLObject obj(u"file:///foo/bar.baz/");
bool ok = obj.setExtension(
u"other", INetURLObject::LAST_SEGMENT, false);
CPPUNIT_ASSERT(ok);
@@ -295,7 +295,7 @@ namespace tools_urlobj
}
void testChangeScheme() {
- INetURLObject obj("unknown://example.com/foo/bar");
+ INetURLObject obj(u"unknown://example.com/foo/bar");
CPPUNIT_ASSERT(!obj.HasError());
obj.changeScheme(INetProtocol::Http);
CPPUNIT_ASSERT_EQUAL(
@@ -312,7 +312,7 @@ namespace tools_urlobj
}
void testTd146382() {
- INetURLObject obj("file://share.allotropia.de@SSL/DavWWWRoot/remote.php");
+ INetURLObject obj(u"file://share.allotropia.de@SSL/DavWWWRoot/remote.php");
CPPUNIT_ASSERT(!obj.HasError());
CPPUNIT_ASSERT_EQUAL(
OUString("file://share.allotropia.de@SSL/DavWWWRoot/remote.php"),
@@ -323,7 +323,7 @@ namespace tools_urlobj
{
{
// host:port must not be misinterpreted as scheme:path
- INetURLObject obj("example.com:8080/foo", INetProtocol::Http);
+ INetURLObject obj(u"example.com:8080/foo", INetProtocol::Http);
CPPUNIT_ASSERT(!obj.HasError());
CPPUNIT_ASSERT_EQUAL(OUString("http://example.com:8080/foo"),
obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
@@ -334,7 +334,7 @@ namespace tools_urlobj
}
{
// port may only contain decimal digits, so this must be treated as unknown scheme
- INetURLObject obj("example.com:80a0/foo", INetProtocol::Http);
+ INetURLObject obj(u"example.com:80a0/foo", INetProtocol::Http);
CPPUNIT_ASSERT(!obj.HasError());
CPPUNIT_ASSERT_EQUAL(OUString("example.com:80a0/foo"),
obj.GetMainURL(INetURLObject::DecodeMechanism::NONE));
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index a4bc5ab0922d..4d7a73999e7f 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -719,14 +719,14 @@ OUString parseScheme(
}
-bool INetURLObject::setAbsURIRef(OUString const & rTheAbsURIRef,
+bool INetURLObject::setAbsURIRef(std::u16string_view rTheAbsURIRef,
EncodeMechanism eMechanism,
rtl_TextEncoding eCharset,
bool bSmart,
FSysStyle eStyle)
{
- sal_Unicode const * pPos = rTheAbsURIRef.getStr();
- sal_Unicode const * pEnd = pPos + rTheAbsURIRef.getLength();
+ sal_Unicode const * pPos = rTheAbsURIRef.data();
+ sal_Unicode const * pEnd = pPos + rTheAbsURIRef.size();
setInvalid();
@@ -3200,13 +3200,13 @@ failed:
return false;
}
-bool INetURLObject::setPath(OUString const & rThePath,
+bool INetURLObject::setPath(std::u16string_view rThePath,
EncodeMechanism eMechanism,
rtl_TextEncoding eCharset)
{
OUStringBuffer aSynPath(256);
- sal_Unicode const * p = rThePath.getStr();
- sal_Unicode const * pEnd = p + rThePath.getLength();
+ sal_Unicode const * p = rThePath.data();
+ sal_Unicode const * pEnd = p + rThePath.size();
if (!parsePath(m_eScheme, &p, pEnd, eMechanism, eCharset, false,
'/', 0x80000000, 0x80000000, 0x80000000, aSynPath)
|| p != pEnd)
@@ -3773,7 +3773,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
std::u16string_view rThePassword,
std::u16string_view rTheHost,
sal_uInt32 nThePort,
- OUString const & rThePath)
+ std::u16string_view rThePath)
{
setInvalid();
m_eScheme = eTheScheme;
@@ -3885,8 +3885,8 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
}
}
OUStringBuffer aSynPath(256);
- sal_Unicode const * p = rThePath.getStr();
- sal_Unicode const * pEnd = p + rThePath.getLength();
+ sal_Unicode const * p = rThePath.data();
+ sal_Unicode const * pEnd = p + rThePath.size();
if (!parsePath(m_eScheme, &p, pEnd, EncodeMechanism::WasEncoded, RTL_TEXTENCODING_UTF8, false, '/',
0x80000000, 0x80000000, 0x80000000, aSynPath)
|| p != pEnd)
@@ -3900,7 +3900,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
}
// static
-OUString INetURLObject::GetAbsURL(OUString const & rTheBaseURIRef,
+OUString INetURLObject::GetAbsURL(std::u16string_view rTheBaseURIRef,
OUString const & rTheRelURIRef,
EncodeMechanism eEncodeMechanism,
DecodeMechanism eDecodeMechanism,
@@ -4102,9 +4102,9 @@ bool INetURLObject::setName(std::u16string_view rTheName, EncodeMechanism eMecha
++p;
return setPath(
- std::u16string_view(pPathBegin, pSegBegin - pPathBegin)
+ rtl::OUStringConcatenation(std::u16string_view(pPathBegin, pSegBegin - pPathBegin)
+ encodeText(rTheName, PART_PCHAR, eMechanism, eCharset, true)
- + std::u16string_view(p, pPathEnd - p),
+ + std::u16string_view(p, pPathEnd - p)),
EncodeMechanism::NotCanonical,
RTL_TEXTENCODING_UTF8);
}
@@ -4179,9 +4179,9 @@ bool INetURLObject::setBase(std::u16string_view rTheBase, sal_Int32 nIndex,
pExtension = p;
return setPath(
- std::u16string_view(pPathBegin, pSegBegin - pPathBegin)
+ rtl::OUStringConcatenation(std::u16string_view(pPathBegin, pSegBegin - pPathBegin)
+ encodeText(rTheBase, PART_PCHAR, eMechanism, eCharset, true)
- + std::u16string_view(pExtension, pPathEnd - pExtension),
+ + std::u16string_view(pExtension, pPathEnd - pExtension)),
EncodeMechanism::NotCanonical,
RTL_TEXTENCODING_UTF8);
}
@@ -4239,9 +4239,9 @@ bool INetURLObject::setExtension(std::u16string_view rTheExtension,
pExtension = p;
return setPath(
- OUString::Concat(std::u16string_view(pPathBegin, pExtension - pPathBegin)) + "."
+ rtl::OUStringConcatenation(OUString::Concat(std::u16string_view(pPathBegin, pExtension - pPathBegin)) + "."
+ encodeText(rTheExtension, PART_PCHAR, EncodeMechanism::WasEncoded, eCharset, true)
- + std::u16string_view(p, pPathEnd - p),
+ + std::u16string_view(p, pPathEnd - p)),
EncodeMechanism::NotCanonical,
RTL_TEXTENCODING_UTF8);
}
diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx
index bb8a700d16f1..d58581e74200 100644
--- a/tools/source/inet/inetmsg.cxx
+++ b/tools/source/inet/inetmsg.cxx
@@ -22,6 +22,8 @@
#include <tools/inetmsg.hxx>
#include <comphelper/string.hxx>
#include <rtl/character.hxx>
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <map>
@@ -52,32 +54,32 @@ static const char *months[12] =
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
-static sal_uInt16 ParseNumber(const OString& rStr, sal_Int32& nIndex)
+static sal_uInt16 ParseNumber(std::string_view rStr, size_t& nIndex)
{
- sal_Int32 n = nIndex;
- while ((n < rStr.getLength())
+ size_t n = nIndex;
+ while ((n < rStr.size())
&& rtl::isAsciiDigit(static_cast<unsigned char>(rStr[n])))
n++;
- OString aNum(rStr.copy(nIndex, (n - nIndex)));
+ std::string_view aNum(rStr.substr(nIndex, (n - nIndex)));
nIndex = n;
- return static_cast<sal_uInt16>(aNum.toInt32());
+ return static_cast<sal_uInt16>(o3tl::toInt32(aNum));
}
-static sal_uInt16 ParseMonth(const OString& rStr, sal_Int32& nIndex)
+static sal_uInt16 ParseMonth(std::string_view rStr, size_t& nIndex)
{
- sal_Int32 n = nIndex;
- while ((n < rStr.getLength())
+ size_t n = nIndex;
+ while ((n < rStr.size())
&& rtl::isAsciiAlpha(static_cast<unsigned char>(rStr[n])))
n++;
- OString aMonth(rStr.copy(nIndex, 3));
+ std::string_view aMonth(rStr.substr(nIndex, 3));
nIndex = n;
sal_uInt16 i;
for (i = 0; i < 12; i++)
- if (aMonth.equalsIgnoreAsciiCase(months[i])) break;
+ if (o3tl::equalsIgnoreAsciiCase(aMonth, months[i])) break;
return (i + 1);
}
@@ -92,20 +94,20 @@ bool INetMIMEMessage::ParseDateField (
if (aDateField.indexOf(':') != -1)
{
// Some DateTime format.
- sal_Int32 nIndex = 0;
+ size_t nIndex = 0;
// Skip over <Wkd> or <Weekday>, leading and trailing space.
- while ((nIndex < aDateField.getLength()) &&
+ while ((nIndex < o3tl::make_unsigned(aDateField.getLength())) &&
(aDateField[nIndex] == ' '))
nIndex++;
while (
- (nIndex < aDateField.getLength()) &&
+ (nIndex < o3tl::make_unsigned(aDateField.getLength())) &&
(rtl::isAsciiAlpha (static_cast<unsigned char>(aDateField[nIndex])) ||
(aDateField[nIndex] == ',') ))
nIndex++;
- while ((nIndex < aDateField.getLength()) &&
+ while ((nIndex < o3tl::make_unsigned(aDateField.getLength())) &&
(aDateField[nIndex] == ' '))
nIndex++;
@@ -143,7 +145,7 @@ bool INetMIMEMessage::ParseDateField (
rDateTime.SetSec (ParseNumber (aDateField, nIndex)); nIndex++;
rDateTime.SetNanoSec (0);
- const char cPossiblePlusMinus = nIndex < aDateField.getLength() ? aDateField[nIndex] : 0;
+ const char cPossiblePlusMinus = nIndex < o3tl::make_unsigned(aDateField.getLength()) ? aDateField[nIndex] : 0;
if (cPossiblePlusMinus == '+' || cPossiblePlusMinus == '-')
{
// Offset from GMT: "(+|-)HHMM".