summaryrefslogtreecommitdiff
path: root/unoxml/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-17 11:18:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-18 07:41:51 +0100
commit5e69b3619d3a2b05930c5b8b8521d7f2938c709d (patch)
tree2bcfb4244223b7fe570e9b0bcee2f7dd3928e226 /unoxml/source
parent1d097883541b9d244e50ced7fe49a4d7a0f65cfd (diff)
loplugin:flatten in toolkit..writerfilter
Change-Id: I4da2a768b6b55869c3a3d6f8a8d50dc018709acd Reviewed-on: https://gerrit.libreoffice.org/44865 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml/source')
-rw-r--r--unoxml/source/dom/characterdata.cxx135
1 files changed, 69 insertions, 66 deletions
diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx
index ca29f993cfe1..3813a72899d0 100644
--- a/unoxml/source/dom/characterdata.cxx
+++ b/unoxml/source/dom/characterdata.cxx
@@ -82,30 +82,31 @@ namespace DOM
{
::osl::ClearableMutexGuard guard(m_rMutex);
- if (m_aNodePtr != nullptr)
- {
- // get current data
- std::shared_ptr<xmlChar const> const pContent(
- xmlNodeGetContent(m_aNodePtr), xmlFree);
- OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
- OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8));
- if (offset > tmp.getLength() || offset < 0 || count < 0) {
- DOMException e;
- e.Code = DOMExceptionType_INDEX_SIZE_ERR;
- throw e;
- }
- if ((offset+count) > tmp.getLength())
- count = tmp.getLength() - offset;
+ if (m_aNodePtr == nullptr)
+ return;
+
+ // get current data
+ std::shared_ptr<xmlChar const> const pContent(
+ xmlNodeGetContent(m_aNodePtr), xmlFree);
+ OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
+ OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8));
+ if (offset > tmp.getLength() || offset < 0 || count < 0) {
+ DOMException e;
+ e.Code = DOMExceptionType_INDEX_SIZE_ERR;
+ throw e;
+ }
+ if ((offset+count) > tmp.getLength())
+ count = tmp.getLength() - offset;
- OUString tmp2 = tmp.copy(0, offset);
- tmp2 += tmp.copy(offset+count);
- OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
- xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
- OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+ OUString tmp2 = tmp.copy(0, offset);
+ tmp2 += tmp.copy(offset+count);
+ OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+ xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
+ OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+
+ guard.clear(); // release mutex before calling event handlers
+ dispatchEvent_Impl(oldValue, newValue);
- guard.clear(); // release mutex before calling event handlers
- dispatchEvent_Impl(oldValue, newValue);
- }
}
@@ -152,29 +153,30 @@ namespace DOM
{
::osl::ClearableMutexGuard guard(m_rMutex);
- if (m_aNodePtr != nullptr)
- {
- // get current data
- std::shared_ptr<xmlChar const> const pContent(
- xmlNodeGetContent(m_aNodePtr), xmlFree);
- OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
- OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8));
- if (offset > tmp.getLength() || offset < 0) {
- DOMException e;
- e.Code = DOMExceptionType_INDEX_SIZE_ERR;
- throw e;
- }
+ if (m_aNodePtr == nullptr)
+ return;
+
+ // get current data
+ std::shared_ptr<xmlChar const> const pContent(
+ xmlNodeGetContent(m_aNodePtr), xmlFree);
+ OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
+ OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8));
+ if (offset > tmp.getLength() || offset < 0) {
+ DOMException e;
+ e.Code = DOMExceptionType_INDEX_SIZE_ERR;
+ throw e;
+ }
- OUString tmp2 = tmp.copy(0, offset);
- tmp2 += arg;
- tmp2 += tmp.copy(offset);
- OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
- xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
- OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+ OUString tmp2 = tmp.copy(0, offset);
+ tmp2 += arg;
+ tmp2 += tmp.copy(offset);
+ OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+ xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
+ OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+
+ guard.clear(); // release mutex before calling event handlers
+ dispatchEvent_Impl(oldValue, newValue);
- guard.clear(); // release mutex before calling event handlers
- dispatchEvent_Impl(oldValue, newValue);
- }
}
@@ -186,31 +188,32 @@ namespace DOM
{
::osl::ClearableMutexGuard guard(m_rMutex);
- if (m_aNodePtr != nullptr)
- {
- // get current data
- std::shared_ptr<xmlChar const> const pContent(
- xmlNodeGetContent(m_aNodePtr), xmlFree);
- OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
- OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8));
- if (offset > tmp.getLength() || offset < 0 || count < 0){
- DOMException e;
- e.Code = DOMExceptionType_INDEX_SIZE_ERR;
- throw e;
- }
- if ((offset+count) > tmp.getLength())
- count = tmp.getLength() - offset;
+ if (m_aNodePtr == nullptr)
+ return;
+
+ // get current data
+ std::shared_ptr<xmlChar const> const pContent(
+ xmlNodeGetContent(m_aNodePtr), xmlFree);
+ OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
+ OUString tmp(OStringToOUString(aData, RTL_TEXTENCODING_UTF8));
+ if (offset > tmp.getLength() || offset < 0 || count < 0){
+ DOMException e;
+ e.Code = DOMExceptionType_INDEX_SIZE_ERR;
+ throw e;
+ }
+ if ((offset+count) > tmp.getLength())
+ count = tmp.getLength() - offset;
- OUString tmp2 = tmp.copy(0, offset);
- tmp2 += arg;
- tmp2 += tmp.copy(offset+count);
- OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
- xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
- OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+ OUString tmp2 = tmp.copy(0, offset);
+ tmp2 += arg;
+ tmp2 += tmp.copy(offset+count);
+ OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+ xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
+ OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
+
+ guard.clear(); // release mutex before calling event handlers
+ dispatchEvent_Impl(oldValue, newValue);
- guard.clear(); // release mutex before calling event handlers
- dispatchEvent_Impl(oldValue, newValue);
- }
}
/**