helpcompiler/source/HelpLinker.cxx | 54 ++++++++-------- i18nlangtag/source/languagetag/languagetag.cxx | 84 ++++++++++++------------- 2 files changed, 69 insertions(+), 69 deletions(-)
New commits: commit 0cd436ca0f769329ce23dc7c5fdd41877931ae87 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Apr 7 20:01:46 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Apr 8 08:48:59 2020 +0200 loplugin:flatten in i18nlangtag Change-Id: I52124d0ca56da3769810c8fce2684267f6c25156 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91845 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 403981a30768..1463ca8aef50 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -536,28 +536,28 @@ LanguageTag::LanguageTag( const OUString& rBcp47, const OUString& rLanguage, mbInitializedLangID( false), mbIsFallback( false) { - if (!mbSystemLocale && !mbInitializedBcp47) + if (mbSystemLocale || mbInitializedBcp47) + return; + + if (rScript.isEmpty()) { - if (rScript.isEmpty()) - { - maBcp47 = rLanguage + "-" + rCountry; - mbInitializedBcp47 = true; - maLocale.Language = rLanguage; - maLocale.Country = rCountry; - mbInitializedLocale = true; - } + maBcp47 = rLanguage + "-" + rCountry; + mbInitializedBcp47 = true; + maLocale.Language = rLanguage; + maLocale.Country = rCountry; + mbInitializedLocale = true; + } + else + { + if (rCountry.isEmpty()) + maBcp47 = rLanguage + "-" + rScript; else - { - if (rCountry.isEmpty()) - maBcp47 = rLanguage + "-" + rScript; - else - maBcp47 = rLanguage + "-" + rScript + "-" + rCountry; - mbInitializedBcp47 = true; - maLocale.Language = I18NLANGTAG_QLT; - maLocale.Country = rCountry; - maLocale.Variant = maBcp47; - mbInitializedLocale = true; - } + maBcp47 = rLanguage + "-" + rScript + "-" + rCountry; + mbInitializedBcp47 = true; + maLocale.Language = I18NLANGTAG_QLT; + maLocale.Country = rCountry; + maLocale.Variant = maBcp47; + mbInitializedLocale = true; } } @@ -1508,31 +1508,31 @@ void LanguageTag::convertFromRtlLocale() // Variant: [.codeset][@modifier] // Variant effectively contains anything that follows the territory, not // looking for '.' dot delimiter or '@' modifier content. - if (!maLocale.Variant.isEmpty()) - { - OString aStr = OUStringToOString( maLocale.Language + "_" + maLocale.Country + maLocale.Variant, - RTL_TEXTENCODING_UTF8); - /* FIXME: let liblangtag parse this entirely with - * lt_tag_convert_from_locale() but that needs a patch to pass the - * string. */ + if (maLocale.Variant.isEmpty()) + return; + + OString aStr = OUStringToOString( maLocale.Language + "_" + maLocale.Country + maLocale.Variant, + RTL_TEXTENCODING_UTF8); + /* FIXME: let liblangtag parse this entirely with + * lt_tag_convert_from_locale() but that needs a patch to pass the + * string. */ #if 0 - myLtError aError; - theDataRef::get().init(); - mpImplLangtag = lt_tag_convert_from_locale( aStr.getStr(), &aError.p); - maBcp47 = OStringToOUString( lt_tag_get_string( mpImplLangtag), RTL_TEXTENCODING_UTF8); - mbInitializedBcp47 = true; + myLtError aError; + theDataRef::get().init(); + mpImplLangtag = lt_tag_convert_from_locale( aStr.getStr(), &aError.p); + maBcp47 = OStringToOUString( lt_tag_get_string( mpImplLangtag), RTL_TEXTENCODING_UTF8); + mbInitializedBcp47 = true; #else - mnLangID = MsLangId::convertUnxByteStringToLanguage( aStr); - if (mnLangID == LANGUAGE_DONTKNOW) - { - SAL_WARN( "i18nlangtag", "LanguageTag(rtl_Locale) - unknown: " << aStr); - mnLangID = LANGUAGE_ENGLISH_US; // we need _something_ here - } - mbInitializedLangID = true; -#endif - maLocale = lang::Locale(); - mbInitializedLocale = false; + mnLangID = MsLangId::convertUnxByteStringToLanguage( aStr); + if (mnLangID == LANGUAGE_DONTKNOW) + { + SAL_WARN( "i18nlangtag", "LanguageTag(rtl_Locale) - unknown: " << aStr); + mnLangID = LANGUAGE_ENGLISH_US; // we need _something_ here } + mbInitializedLangID = true; +#endif + maLocale = lang::Locale(); + mbInitializedLocale = false; } commit 4eb75e416e7245e4cb0291ea186e7e5a40bdfe60 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Apr 7 20:03:33 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Apr 8 08:48:54 2020 +0200 loplugin:flatten in helpcompiler Change-Id: I5d6b83b6976c115426f186958b749e48c60ba8f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91847 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index ecd85044d238..46a9fac2edf2 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -104,22 +104,22 @@ void IndexerPreProcessor::processDocument xmlFreeDoc(resCaption); } - if( m_xsltStylesheetPtrContent ) + if( !m_xsltStylesheetPtrContent ) + return; + + xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, nullptr ); + xmlNodePtr pResNodeContent = resContent->xmlChildrenNode; + if( pResNodeContent ) { - xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, nullptr ); - xmlNodePtr pResNodeContent = resContent->xmlChildrenNode; - if( pResNodeContent ) + fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; + FILE* pFile_docURL = fopen_impl( fsContentPureTextFile_docURL, "w" ); + if( pFile_docURL ) { - fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; - FILE* pFile_docURL = fopen_impl( fsContentPureTextFile_docURL, "w" ); - if( pFile_docURL ) - { - fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); - fclose( pFile_docURL ); - } + fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); + fclose( pFile_docURL ); } - xmlFreeDoc(resContent); } + xmlFreeDoc(resContent); } namespace { @@ -462,25 +462,25 @@ void HelpLinker::link() helpKeyword.dump_DBHelp( keyWordFileName_DBHelp); - if( !bExtensionMode ) + if( bExtensionMode ) + return; + + // New index + for (auto const& additionalFile : additionalFiles) { - // New index - for (auto const& additionalFile : additionalFiles) - { - const std::string &additionalFileName = additionalFile.second; - const std::string &additionalFileKey = additionalFile.first; + const std::string &additionalFileName = additionalFile.second; + const std::string &additionalFileKey = additionalFile.first; - fs::path fsAdditionalFileName( additionalFileName, fs::native ); - HCDBG({ - std::string aNativeStr = fsAdditionalFileName.native_file_string(); - const char* pStr = aNativeStr.c_str(); - std::cerr << pStr << std::endl; - }); + fs::path fsAdditionalFileName( additionalFileName, fs::native ); + HCDBG({ + std::string aNativeStr = fsAdditionalFileName.native_file_string(); + const char* pStr = aNativeStr.c_str(); + std::cerr << pStr << std::endl; + }); - fs::path fsTargetName( indexDirParentName / additionalFileKey ); + fs::path fsTargetName( indexDirParentName / additionalFileKey ); - fs::copy( fsAdditionalFileName, fsTargetName ); - } + fs::copy( fsAdditionalFileName, fsTargetName ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits