diff options
-rw-r--r-- | l10ntools/source/treemerge.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx index f6af92791662..47bfec04ef46 100644 --- a/l10ntools/source/treemerge.cxx +++ b/l10ntools/source/treemerge.cxx @@ -67,13 +67,14 @@ namespace helper::xmlStrToOString( pID ); xmlFree( pID ); - const sal_Int32 nFirstSlash = sID.indexOf('/'); + const std::string_view::size_type nFirstSlash = sID.indexOf('/'); + const auto nAfterSlash = (nFirstSlash != std::string_view::npos) ? (nFirstSlash + 1) : 0; // Update id attribute of topic { OString sNewID = - OString::Concat(sID.subView( 0, nFirstSlash + 1 )) + + OString::Concat(sID.subView( 0, nAfterSlash )) + rXhpRoot.substr( rXhpRoot.rfind('/') + 1 ) + - sID.subView( sID.indexOf( '/', nFirstSlash + 1 ) ); + sID.subView( sID.indexOf( '/', nAfterSlash ) ); xmlSetProp( pReturn, reinterpret_cast<const xmlChar*>("id"), reinterpret_cast<const xmlChar*>(sNewID.getStr())); @@ -81,7 +82,7 @@ namespace const OString sXhpPath = OString::Concat(rXhpRoot) + - sID.subView(sID.indexOf('/', nFirstSlash + 1)); + sID.subView(sID.indexOf('/', nAfterSlash)); xmlDocPtr pXhpFile = xmlParseFile( sXhpPath.getStr() ); // if xhpfile is missing than put this topic into comment if ( !pXhpFile ) |