summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-05-28 19:41:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-08-17 11:55:13 +0200
commit9881bea8d41997fb46579eb5f0314300159c96cc (patch)
treef52daa7055d2d28959e2d1ad576d963b7c0d3b2d /tools
parentec4034c4a4f23574401ba2a74b635d9ed4befbc8 (diff)
remove unnecessary use of OUString::getStr
Change-Id: I3d13e1c0bb6aa4a7aacc463198747c1368ebc9b4 Reviewed-on: https://gerrit.libreoffice.org/38114 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/qa/cppunit/test_inetmime.cxx12
-rw-r--r--tools/source/fsys/urlobj.cxx2
-rw-r--r--tools/source/inet/inetmime.cxx4
3 files changed, 10 insertions, 8 deletions
diff --git a/tools/qa/cppunit/test_inetmime.cxx b/tools/qa/cppunit/test_inetmime.cxx
index 0bd1fd90c13d..c28fa6885f99 100644
--- a/tools/qa/cppunit/test_inetmime.cxx
+++ b/tools/qa/cppunit/test_inetmime.cxx
@@ -64,14 +64,14 @@ namespace
OUString input
= "TEST/subTST; parm1=Value1; Parm2=\"unpacked value; %20\"";
// Just scan input for valid string:
- auto end = INetMIME::scanContentType(input.getStr(), input.getStr()+input.getLength());
+ auto end = INetMIME::scanContentType(input);
CPPUNIT_ASSERT(end != nullptr);
CPPUNIT_ASSERT_EQUAL(OUString(), OUString(end));
// Scan input and parse type, subType and parameters:
OUString type;
OUString subType;
INetContentTypeParameterList parameters;
- end = INetMIME::scanContentType(input.getStr(), input.getStr() + input.getLength(),
+ end = INetMIME::scanContentType(input,
&type, &subType, &parameters);
CPPUNIT_ASSERT(end != nullptr);
CPPUNIT_ASSERT_EQUAL(OUString(), OUString(end));
@@ -104,14 +104,14 @@ namespace
"Parm1*1*=of%2010;\t"
"parm1*2*=%20%3d%200.5";
// Just scan input for valid string:
- auto end = INetMIME::scanContentType(input.getStr(), input.getStr()+input.getLength());
+ auto end = INetMIME::scanContentType(input);
CPPUNIT_ASSERT(end != nullptr);
CPPUNIT_ASSERT_EQUAL(OUString(), OUString(end));
// Scan input and parse type, subType and parameters:
OUString type;
OUString subType;
INetContentTypeParameterList parameters;
- end = INetMIME::scanContentType(input.getStr(), input.getStr() + input.getLength(),
+ end = INetMIME::scanContentType(input,
&type, &subType, &parameters);
CPPUNIT_ASSERT(end != nullptr);
CPPUNIT_ASSERT_EQUAL(OUString(), OUString(end));
@@ -134,11 +134,11 @@ namespace
"parm1*1*=2"; // this parameter is a duplicate,
// the scan should end before this parameter
// Just scan input for valid string:
- end = INetMIME::scanContentType(input.getStr(), input.getStr()+input.getLength());
+ end = INetMIME::scanContentType(input);
CPPUNIT_ASSERT(end != nullptr);
CPPUNIT_ASSERT_EQUAL(OUString(";parm1*1*=2"), OUString(end)); // the invalid end of input
// Scan input and parse type, subType and parameters:
- end = INetMIME::scanContentType(input.getStr(), input.getStr() + input.getLength(),
+ end = INetMIME::scanContentType(input,
&type, &subType, &parameters);
CPPUNIT_ASSERT(end != nullptr);
CPPUNIT_ASSERT_EQUAL(OUString(";parm1*1*=2"), OUString(end)); // the invalid end of input
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 544ec38cbf0b..eeadb7df38d2 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -597,7 +597,7 @@ std::unique_ptr<SvMemoryStream> INetURLObject::getData()
}
OUString sURLPath = GetURLPath( DecodeMechanism::WithCharset, RTL_TEXTENCODING_ISO_8859_1 );
- sal_Unicode const * pSkippedMediatype = INetMIME::scanContentType( sURLPath.getStr(), sURLPath.getStr() + sURLPath.getLength() );
+ sal_Unicode const * pSkippedMediatype = INetMIME::scanContentType( sURLPath );
sal_Int32 nCharactersSkipped = pSkippedMediatype == nullptr
? 0 : pSkippedMediatype-sURLPath.getStr();
if (sURLPath.match(",", nCharactersSkipped))
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index a398aa79e3ca..0be1ee62d8b2 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -1088,9 +1088,11 @@ bool INetMIME::scanUnsigned(const sal_Unicode *& rBegin,
// static
sal_Unicode const * INetMIME::scanContentType(
- sal_Unicode const * pBegin, sal_Unicode const * pEnd, OUString * pType,
+ OUString const & rStr, OUString * pType,
OUString * pSubType, INetContentTypeParameterList * pParameters)
{
+ sal_Unicode const * pBegin = rStr.getStr();
+ sal_Unicode const * pEnd = pBegin + rStr.getLength();
sal_Unicode const * p = skipLinearWhiteSpaceComment(pBegin, pEnd);
sal_Unicode const * pTypeBegin = p;
while (p != pEnd && isTokenChar(*p))