summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/source/misc/sequenceashashmap.cxx10
-rw-r--r--configmgr/source/valueparser.cxx33
-rw-r--r--oox/source/drawingml/customshapepresetdata.cxx12
-rw-r--r--vcl/qt5/QtGraphics_GDI.cxx4
-rw-r--r--vcl/qt5/QtSvpGraphics.cxx4
-rw-r--r--vcl/source/filter/FilterConfigCache.cxx4
-rw-r--r--vcl/source/filter/ixbm/xbmread.cxx6
-rw-r--r--vcl/source/window/builder.cxx2
-rw-r--r--vcl/unx/generic/app/saldisp.cxx4
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx4
-rw-r--r--vcl/unx/gtk3/salnativewidgets-gtk.cxx4
11 files changed, 48 insertions, 39 deletions
diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx
index 270c005db259..db2c99a7a814 100644
--- a/comphelper/source/misc/sequenceashashmap.cxx
+++ b/comphelper/source/misc/sequenceashashmap.cxx
@@ -77,7 +77,7 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
else if (aTypeClass == uno::TypeClass_BYTE)
aAny <<= static_cast<sal_Int8>(o3tl::toInt32(rValue));
else if (aTypeClass == uno::TypeClass_BOOLEAN)
- aAny <<= OString(rValue).toBoolean();
+ aAny <<= rtl_str_toBoolean(rValue.c_str());
else if (aTypeClass == uno::TypeClass_SHORT)
aAny <<= static_cast<sal_Int16>(o3tl::toInt32(rValue));
else if (aTypeClass == uno::TypeClass_UNSIGNED_SHORT)
@@ -87,7 +87,7 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
else if (aTypeClass == uno::TypeClass_UNSIGNED_LONG)
aAny <<= static_cast<sal_uInt32>(o3tl::toInt32(rValue));
else if (aTypeClass == uno::TypeClass_FLOAT)
- aAny <<= OString(rValue).toFloat();
+ aAny <<= rtl_str_toFloat(rValue.c_str());
else if (aTypeClass == uno::TypeClass_DOUBLE)
aAny <<= o3tl::toDouble(rValue);
else if (aTypeClass == uno::TypeClass_STRING)
@@ -325,9 +325,9 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson
if (rType == "string")
aValue.Value <<= OUString::fromUtf8(rValue);
else if (rType == "boolean")
- aValue.Value <<= OString(rValue).toBoolean();
+ aValue.Value <<= rtl_str_toBoolean(rValue.c_str());
else if (rType == "float")
- aValue.Value <<= OString(rValue).toFloat();
+ aValue.Value <<= rtl_str_toFloat(rValue.c_str());
else if (rType == "long")
aValue.Value <<= o3tl::toInt32(rValue);
else if (rType == "short")
@@ -341,7 +341,7 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson
else if (rType == "int16")
aValue.Value <<= sal_Int16(o3tl::toInt32(rValue));
else if (rType == "uint64")
- aValue.Value <<= OString(rValue).toUInt64();
+ aValue.Value <<= rtl_str_toUInt64(rValue.c_str(), 10);
else if (rType == "uint32")
aValue.Value <<= o3tl::toUInt32(rValue);
else if (rType == "uint16")
diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx
index 6b9faf6edbe0..c81d975e474c 100644
--- a/configmgr/source/valueparser.cxx
+++ b/configmgr/source/valueparser.cxx
@@ -80,15 +80,21 @@ bool parseValue(xmlreader::Span const & text, sal_Bool * value) {
bool parseValue(xmlreader::Span const & text, sal_Int16 * value) {
assert(text.is() && value != nullptr);
// For backwards compatibility, support hexadecimal values:
- sal_Int32 n =
+ bool bStartWithHexPrefix =
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
text.begin, text.length, RTL_CONSTASCII_STRINGPARAM("0X"),
- RTL_CONSTASCII_LENGTH("0X")) == 0 ?
- static_cast< sal_Int32 >(
- OString(
+ RTL_CONSTASCII_LENGTH("0X")) == 0;
+ sal_Int32 n;
+ if (bStartWithHexPrefix)
+ {
+ std::string_view sView(
text.begin + RTL_CONSTASCII_LENGTH("0X"),
- text.length - RTL_CONSTASCII_LENGTH("0X")).toUInt32(16)) :
- OString(text.begin, text.length).toInt32();
+ text.length - RTL_CONSTASCII_LENGTH("0X"));
+ n = o3tl::toUInt32(sView, 16);
+ }
+ else
+ n = o3tl::toInt32(std::string_view(text.begin, text.length));
+
//TODO: check valid lexical representation
if (n >= SAL_MIN_INT16 && n <= SAL_MAX_INT16) {
*value = static_cast< sal_Int16 >(n);
@@ -122,15 +128,18 @@ bool parseValue(xmlreader::Span const & text, sal_Int32 * value) {
bool parseValue(xmlreader::Span const & text, sal_Int64 * value) {
assert(text.is() && value != nullptr);
// For backwards compatibility, support hexadecimal values:
- *value =
+ bool bStartWithHexPrefix =
rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
text.begin, text.length, RTL_CONSTASCII_STRINGPARAM("0X"),
- RTL_CONSTASCII_LENGTH("0X")) == 0 ?
- static_cast< sal_Int64 >(
- OString(
+ RTL_CONSTASCII_LENGTH("0X")) == 0;
+ if (bStartWithHexPrefix)
+ {
+ OString sSuffix(
text.begin + RTL_CONSTASCII_LENGTH("0X"),
- text.length - RTL_CONSTASCII_LENGTH("0X")).toUInt64(16)) :
- OString(text.begin, text.length).toInt64();
+ text.length - RTL_CONSTASCII_LENGTH("0X"));
+ *value = static_cast< sal_Int64 >(sSuffix.toUInt64(16));
+ }
+ else *value = o3tl::toInt64(std::string_view(text.begin, text.length));
//TODO: check valid lexical representation
return true;
}
diff --git a/oox/source/drawingml/customshapepresetdata.cxx b/oox/source/drawingml/customshapepresetdata.cxx
index 3215b9834a42..6f9d2acffd1b 100644
--- a/oox/source/drawingml/customshapepresetdata.cxx
+++ b/oox/source/drawingml/customshapepresetdata.cxx
@@ -35,20 +35,20 @@ void lcl_parseAdjustmentValue(
drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue;
do
{
- OString aToken(o3tl::trim(o3tl::getToken(rValue, 0, ',', nIndex)));
+ std::string_view aToken(o3tl::trim(o3tl::getToken(rValue, 0, ',', nIndex)));
static const char aNamePrefix[] = "Name = \"";
static const char aValuePrefix[] = "Value = (any) { (long) ";
if (o3tl::starts_with(aToken, aNamePrefix))
{
- OString aName = aToken.copy(strlen(aNamePrefix),
- aToken.getLength() - strlen(aNamePrefix) - strlen("\""));
+ std::string_view aName = aToken.substr(
+ strlen(aNamePrefix), aToken.size() - strlen(aNamePrefix) - strlen("\""));
aAdjustmentValue.Name = OUString::fromUtf8(aName);
}
else if (o3tl::starts_with(aToken, aValuePrefix))
{
- OString aValue = aToken.copy(strlen(aValuePrefix),
- aToken.getLength() - strlen(aValuePrefix) - strlen(" }"));
- aAdjustmentValue.Value <<= aValue.toInt32();
+ std::string_view aValue = aToken.substr(
+ strlen(aValuePrefix), aToken.size() - strlen(aValuePrefix) - strlen(" }"));
+ aAdjustmentValue.Value <<= o3tl::toInt32(aValue);
}
else if (!o3tl::starts_with(aToken, "State = "))
SAL_WARN("oox", "lcl_parseAdjustmentValue: unexpected prefix: " << aToken);
diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index 2005de80f7ba..87c7fb85725b 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -32,6 +32,7 @@
#include <numeric>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <o3tl/string_view.hxx>
QtGraphicsBackend::QtGraphicsBackend(QtFrame* pFrame, QImage* pQImage)
: m_pFrame(pFrame)
@@ -694,8 +695,7 @@ void QtGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
char* pForceDpi;
if ((pForceDpi = getenv("SAL_FORCEDPI")))
{
- OString sForceDPI(pForceDpi);
- rDPIX = rDPIY = sForceDPI.toInt32();
+ rDPIX = rDPIY = o3tl::toInt32(std::string_view(pForceDpi));
return;
}
diff --git a/vcl/qt5/QtSvpGraphics.cxx b/vcl/qt5/QtSvpGraphics.cxx
index 903fee1f56a4..7d0715be33c5 100644
--- a/vcl/qt5/QtSvpGraphics.cxx
+++ b/vcl/qt5/QtSvpGraphics.cxx
@@ -10,6 +10,7 @@
#include <sal/config.h>
#include <sal/log.hxx>
#include <salbmp.hxx>
+#include <o3tl/string_view.hxx>
#include <config_cairo_canvas.h>
@@ -98,8 +99,7 @@ void QtSvpGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
char* pForceDpi;
if ((pForceDpi = getenv("SAL_FORCEDPI")))
{
- OString sForceDPI(pForceDpi);
- rDPIX = rDPIY = sForceDPI.toInt32();
+ rDPIX = rDPIY = o3tl::toInt32(std::string_view(pForceDpi));
return;
}
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index 5b49f30f678b..a00b7996f5ed 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -20,6 +20,7 @@
#include "FilterConfigCache.hxx"
#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <vcl/graphicfilter.hxx>
#include <comphelper/configuration.hxx>
#include <tools/svlibrary.h>
@@ -247,8 +248,7 @@ void FilterConfigCache::ImplInitSmart()
aEntry.sType = sExtension;
aEntry.sUIName = sExtension;
- OString sFlags( *pPtr++ );
- aEntry.nFlags = sFlags.toInt32();
+ aEntry.nFlags = o3tl::toInt32(std::string_view(*pPtr++));
OUString sUserData( OUString::createFromAscii( *pPtr ) );
aEntry.CreateFilterName( sUserData );
diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx
index ceb942d20392..11fded73ffd4 100644
--- a/vcl/source/filter/ixbm/xbmread.cxx
+++ b/vcl/source/filter/ixbm/xbmread.cxx
@@ -20,7 +20,7 @@
#include <memory>
#include <sal/config.h>
#include <tools/stream.hxx>
-
+#include <o3tl/string_view.hxx>
#include <rtl/character.hxx>
#include <vcl/BitmapWriteAccess.hxx>
@@ -181,11 +181,11 @@ int XBMReader::ParseDefine( const char* pDefine )
if( ( pTmp[0] == '0' ) && ( ( pTmp[1] == 'X' ) || ( pTmp[1] == 'x' ) ) )
{
pTmp += 2;
- nRet = OString(pTmp, strlen(pTmp)).toInt32(16);
+ nRet = o3tl::toInt32(std::string_view(pTmp), 16);
}
else // read decimal
{
- nRet = OString(pTmp, strlen(pTmp)).toInt32();
+ nRet = o3tl::toInt32(std::string_view(pTmp));
}
return nRet;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index bc307ba85561..b4c96baf6595 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2976,7 +2976,7 @@ void VclBuilder::handleRow(xmlreader::XmlReader &reader, const OUString &rID)
if (name == "id")
{
name = reader.getAttributeValue(false);
- nId = OString(name.begin, name.length).toUInt32();
+ nId = o3tl::toUInt32(std::string_view(name.begin, name.length));
}
else if (nId == 0 && name == "translatable" && reader.getAttributeValue(false) == "yes")
{
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 6733e483239a..a5f9c2f42e5d 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -60,6 +60,7 @@
#include <unx/sm.hxx>
#include <unx/wmadaptor.hxx>
#include <unx/glyphcache.hxx>
+#include <o3tl/string_view.hxx>
#include <poll.h>
#include <memory>
@@ -503,8 +504,7 @@ void SalDisplay::Init()
const char* pValStr = XGetDefault( pDisp_, "Xft", "dpi" );
if( pValStr != nullptr )
{
- const OString aValStr( pValStr );
- const tools::Long nDPI = static_cast<tools::Long>(aValStr.toDouble());
+ const tools::Long nDPI = static_cast<tools::Long>(o3tl::toDouble(std::string_view(pValStr)));
// guard against insane resolution
if( sal_ValidDPI(nDPI) )
{
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index f296e3cf34a4..39ded2207cd3 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -38,6 +38,7 @@
#include <vcl/sysdata.hxx>
#include <vcl/virdev.hxx>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include <unx/salunx.h>
#include <unx/saldisp.hxx>
@@ -157,8 +158,7 @@ void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // cons
char* pForceDpi;
if ((pForceDpi = getenv("SAL_FORCEDPI")))
{
- OString sForceDPI(pForceDpi);
- rDPIX = rDPIY = sForceDPI.toInt32();
+ rDPIX = rDPIY = o3tl::toInt32(std::string_view(pForceDpi));
return;
}
diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
index bfdeed423846..5dfaf24420c2 100644
--- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
@@ -22,6 +22,7 @@
#include <vcl/decoview.hxx>
#include <vcl/settings.hxx>
#include <unx/fontmanager.hxx>
+#include <o3tl/string_view.hxx>
#include "gtkcairo.hxx"
#include <optional>
@@ -3061,8 +3062,7 @@ void GtkSalGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
char* pForceDpi;
if ((pForceDpi = getenv("SAL_FORCEDPI")))
{
- OString sForceDPI(pForceDpi);
- rDPIX = rDPIY = sForceDPI.toInt32();
+ rDPIX = rDPIY = o3tl::toInt32(std::string_view(pForceDpi));
return;
}