diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-24 11:37:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-24 18:04:50 +0200 |
commit | 5c1561561a859c561fb2321420f1abb7f1cedde3 (patch) | |
tree | 7a96cf8b32bd4c088298df3c4067f0d81f549057 /comphelper | |
parent | 5e6d8efbf3fb456ca370df04b21d2e340d9831ad (diff) |
loplugin:unnecessarygetstr extend to more std::string checking
suggested by mike kaganski
Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/sequenceashashmap.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index 50a4e0216cd0..270c005db259 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.c_str()).toBoolean(); + aAny <<= OString(rValue).toBoolean(); 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.c_str()).toFloat(); + aAny <<= OString(rValue).toFloat(); else if (aTypeClass == uno::TypeClass_DOUBLE) aAny <<= o3tl::toDouble(rValue); else if (aTypeClass == uno::TypeClass_STRING) @@ -312,7 +312,7 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson { std::vector<beans::PropertyValue> aArguments; boost::property_tree::ptree aTree, aNodeNull, aNodeValue; - std::stringstream aStream(rJson.getStr()); + std::stringstream aStream((std::string(rJson))); boost::property_tree::read_json(aStream, aTree); for (const auto& rPair : aTree) @@ -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.c_str()).toBoolean(); + aValue.Value <<= OString(rValue).toBoolean(); else if (rType == "float") - aValue.Value <<= OString(rValue.c_str()).toFloat(); + aValue.Value <<= OString(rValue).toFloat(); 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.c_str()).toUInt64(); + aValue.Value <<= OString(rValue).toUInt64(); else if (rType == "uint32") aValue.Value <<= o3tl::toUInt32(rValue); else if (rType == "uint16") @@ -372,7 +372,7 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson aNodeValue = rPair.second.get_child("value", aNodeNull); std::stringstream s; boost::property_tree::write_json(s, aNodeValue); - std::vector<beans::PropertyValue> aPropertyValues = JsonToPropertyValues(s.str().c_str()); + std::vector<beans::PropertyValue> aPropertyValues = JsonToPropertyValues(OString(s.str())); aValue.Value <<= comphelper::containerToSequence(aPropertyValues); } else if (rType == "[][]com.sun.star.beans.PropertyValue") @@ -383,7 +383,7 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson { std::stringstream s; boost::property_tree::write_json(s, rItem.second); - std::vector<beans::PropertyValue> aPropertyValues = JsonToPropertyValues(s.str().c_str()); + std::vector<beans::PropertyValue> aPropertyValues = JsonToPropertyValues(OString(s.str())); aSeqs.push_back(comphelper::containerToSequence(aPropertyValues)); } aValue.Value <<= comphelper::containerToSequence(aSeqs); |