Repository.mk                                           |    1 
 i18npool/CppunitTest_i18npool_transliteration.mk        |    3 
 i18npool/Library_i18npool.mk                            |    7 +
 i18npool/Library_index_data.mk                          |   19 ----
 i18npool/Module_i18npool.mk                             |    1 
 i18npool/inc/indexentrysupplier_asian.hxx               |   22 ++++-
 i18npool/inc/textToPronounce_zh.hxx                     |    8 -
 i18npool/source/collator/gencoll_rule.cxx               |    4 
 i18npool/source/indexentry/indexentrysupplier_asian.cxx |   68 +---------------
 i18npool/source/transliteration/textToPronounce_zh.cxx  |   44 ----------
 vcl/commonfuzzer.mk                                     |    1 
 11 files changed, 34 insertions(+), 144 deletions(-)

New commits:
commit de43ed10886ae041b3814f80ef0510f6ac18d515
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Feb 14 10:14:13 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Feb 15 08:58:34 2024 +0100

    merge index_data into i18npool
    
    (*) it is a small library
    (*) this avoids another dynamic symbol lookup
    (*) this unblocks more --enable-mergedlibs optimisation
    
    Change-Id: I9230230c3d72f4e9ce19408f4b5716452ccd4fad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163364
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/Repository.mk b/Repository.mk
index 8c9923bcc6c2..88d01380140c 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -701,7 +701,6 @@ $(eval $(call 
gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
 $(eval $(call gb_Helper_register_plugins_for_install,PLAINLIBS_OOO,ooo, \
     dict_ja \
     dict_zh \
-    index_data \
     localedata_en \
     localedata_es \
     localedata_euro \
diff --git a/i18npool/CppunitTest_i18npool_transliteration.mk 
b/i18npool/CppunitTest_i18npool_transliteration.mk
index 6c9f71916fef..45c2607d953a 100644
--- a/i18npool/CppunitTest_i18npool_transliteration.mk
+++ b/i18npool/CppunitTest_i18npool_transliteration.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_CppunitTest_use_components,i18npool_transliteration, \
 $(eval $(call gb_CppunitTest_use_libraries,i18npool_transliteration, \
     cppu \
     cppuhelper \
+    i18npool \
     sal \
 ))
 
@@ -27,6 +28,4 @@ $(eval $(call 
gb_CppunitTest_use_sdk_api,i18npool_transliteration))
 
 $(eval $(call gb_CppunitTest_use_ure,i18npool_transliteration))
 
-$(call gb_CppunitTest_get_target,i18npool_transliteration): $(call 
gb_Library_get_target,index_data)
-
 # vim: set noet sw=4 ts=4:
diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk
index b7f28f67d8f4..4c35c26047f9 100644
--- a/i18npool/Library_i18npool.mk
+++ b/i18npool/Library_i18npool.mk
@@ -159,4 +159,11 @@ $(eval $(call gb_Library_add_generated_cobjects,i18npool,\
        $(if $(filter GCC,$(COM)),-Wno-unused-macros) \
 ))
 
+# index data
+$(eval $(call gb_Library_add_generated_exception_objects,i18npool,\
+       $(foreach txt,$(wildcard 
$(SRCDIR)/i18npool/source/indexentry/data/*.txt),\
+               CustomTarget/i18npool/indexentry/$(notdir $(basename $(txt)))) \
+))
+
+
 # vim: set noet sw=4 ts=4:
diff --git a/i18npool/Library_index_data.mk b/i18npool/Library_index_data.mk
deleted file mode 100644
index b00ede9d50ab..000000000000
--- a/i18npool/Library_index_data.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_Library_Library,index_data))
-
-$(eval $(call gb_Library_set_plugin_for_nodep,index_data,i18npool))
-
-$(eval $(call gb_Library_add_generated_exception_objects,index_data,\
-       $(foreach txt,$(wildcard 
$(SRCDIR)/i18npool/source/indexentry/data/*.txt),\
-               CustomTarget/i18npool/indexentry/$(notdir $(basename $(txt)))) \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/i18npool/Module_i18npool.mk b/i18npool/Module_i18npool.mk
index 97c77a014389..69341fc744c0 100644
--- a/i18npool/Module_i18npool.mk
+++ b/i18npool/Module_i18npool.mk
@@ -20,7 +20,6 @@ $(eval $(call gb_Module_add_targets,i18npool,\
                Library_dict_zh) \
        Library_i18npool \
        Library_i18nsearch \
-       Library_index_data \
        Library_localedata_en \
        Library_localedata_es \
        Library_localedata_euro \
diff --git a/i18npool/inc/indexentrysupplier_asian.hxx 
b/i18npool/inc/indexentrysupplier_asian.hxx
index 52e452b17b01..8d733a0ce58b 100644
--- a/i18npool/inc/indexentrysupplier_asian.hxx
+++ b/i18npool/inc/indexentrysupplier_asian.hxx
@@ -21,7 +21,6 @@
 
 
 #include "indexentrysupplier_common.hxx"
-#include <osl/module.h>
 
 namespace i18npool {
 
@@ -44,12 +43,25 @@ public:
             const css::lang::Locale& rLocale2 ) override;
     OUString SAL_CALL getPhoneticCandidate( const OUString& rIndexEntry,
             const css::lang::Locale& rLocale ) override;
-#ifndef DISABLE_DYNLOADING
-private:
-    oslModule hModule;
-#endif
 };
 
 }
 
+extern "C" {
+
+const sal_uInt16** get_indexdata_ko_dict(sal_Int16&);
+const sal_uInt16** get_indexdata_zh_TW_radical(sal_Int16&);
+const sal_uInt16** get_indexdata_zh_TW_stroke(sal_Int16&);
+const sal_uInt16** get_indexdata_zh_pinyin(sal_Int16&);
+const sal_uInt16** get_indexdata_zh_radical(sal_Int16&);
+const sal_uInt16** get_indexdata_zh_stroke(sal_Int16&);
+const sal_uInt16** get_indexdata_zh_zhuyin(sal_Int16&);
+
+const sal_uInt16** get_ko_phonetic(sal_Int16&);
+const sal_uInt16** get_zh_pinyin(sal_Int16&);
+const sal_uInt16** get_zh_zhuyin(sal_Int16&);
+
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18npool/inc/textToPronounce_zh.hxx 
b/i18npool/inc/textToPronounce_zh.hxx
index b34398e608f8..02190673d8a3 100644
--- a/i18npool/inc/textToPronounce_zh.hxx
+++ b/i18npool/inc/textToPronounce_zh.hxx
@@ -20,25 +20,17 @@
 #pragma once
 
 #include "transliteration_Ignore.hxx"
-#include <osl/module.hxx>
 
 namespace i18npool {
 
 class TextToPronounce_zh : public transliteration_Ignore
 {
 protected:
-#ifndef DISABLE_DYNLOADING
-        oslModule hModule;
-#endif
         sal_uInt16 const **idx;
         const sal_Unicode* getPronounce(const sal_Unicode ch);
 
 public:
-#ifndef DISABLE_DYNLOADING
-        TextToPronounce_zh(const char* func_name);
-#else
         TextToPronounce_zh(sal_uInt16 const ** (*function)(sal_Int16 &));
-#endif
         virtual ~TextToPronounce_zh() override;
 
         OUString
diff --git a/i18npool/source/collator/gencoll_rule.cxx 
b/i18npool/source/collator/gencoll_rule.cxx
index d8254f46bb9d..76f8987e36d1 100644
--- a/i18npool/source/collator/gencoll_rule.cxx
+++ b/i18npool/source/collator/gencoll_rule.cxx
@@ -62,8 +62,8 @@ static void data_write(char* file, char* name, sal_uInt8 
*data, sal_Int32 len)
     }
     fprintf(fp, "
};

");
 
-    fprintf(fp, "SAL_DLLPUBLIC_EXPORT const sal_uInt8* get_collator_data_%s() 
{ return %s; }
", name, name);
-    fprintf(fp, "SAL_DLLPUBLIC_EXPORT size_t get_collator_data_%s_length() { 
return sizeof(%s); }
", name, name);
+    fprintf(fp, "const sal_uInt8* get_collator_data_%s() { return %s; }
", name, name);
+    fprintf(fp, "size_t get_collator_data_%s_length() { return sizeof(%s); }
", name, name);
     fprintf(fp, "
");
     fprintf (fp, "}
");
 
diff --git a/i18npool/source/indexentry/indexentrysupplier_asian.cxx 
b/i18npool/source/indexentry/indexentrysupplier_asian.cxx
index 98cadffe815e..97bae784b669 100644
--- a/i18npool/source/indexentry/indexentrysupplier_asian.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier_asian.cxx
@@ -30,66 +30,23 @@ using namespace ::com::sun::star::lang;
 
 namespace i18npool {
 
-#ifndef DISABLE_DYNLOADING
-
-extern "C" { static void thisModule() {} }
-
-#endif
-
 IndexEntrySupplier_asian::IndexEntrySupplier_asian(
     const Reference < XComponentContext >& rxContext ) : 
IndexEntrySupplier_Common(rxContext)
 {
     implementationName = "com.sun.star.i18n.IndexEntrySupplier_asian";
-#ifndef DISABLE_DYNLOADING
-    constexpr OUString lib( u"" SAL_MODULENAME( "index_data" ) ""_ustr );
-    hModule = osl_loadModuleRelative(
-        &thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
-#endif
 }
 
 IndexEntrySupplier_asian::~IndexEntrySupplier_asian()
 {
-#ifndef DISABLE_DYNLOADING
-    if (hModule) osl_unloadModule(hModule);
-#endif
-}
-
-#ifdef DISABLE_DYNLOADING
-
-extern "C" {
-
-sal_uInt16** get_indexdata_ko_dict(sal_Int16*);
-sal_uInt16** get_indexdata_zh_TW_radical(sal_Int16*);
-sal_uInt16** get_indexdata_zh_TW_stroke(sal_Int16*);
-sal_uInt16** get_indexdata_zh_pinyin(sal_Int16*);
-sal_uInt16** get_indexdata_zh_radical(sal_Int16*);
-sal_uInt16** get_indexdata_zh_stroke(sal_Int16*);
-sal_uInt16** get_indexdata_zh_zhuyin(sal_Int16*);
-
-sal_uInt16** get_ko_phonetic(sal_Int16*);
-sal_uInt16** get_zh_pinyin(sal_Int16*);
-sal_uInt16** get_zh_zhuyin(sal_Int16*);
-
 }
 
-#endif
-
 OUString SAL_CALL
 IndexEntrySupplier_asian::getIndexCharacter( const OUString& rIndexEntry,
     const Locale& rLocale, const OUString& rAlgorithm )
 {
     sal_uInt32 ch = 
rIndexEntry.iterateCodePoints(&o3tl::temporary(sal_Int32(0)), 0);
 
-    sal_uInt16** (*func)(sal_Int16*)=nullptr;
-#ifndef DISABLE_DYNLOADING
-    if (hModule) {
-        OUString get("get_indexdata_");
-        if ( rLocale.Language == "zh" && OUString( "TW HK MO" 
).indexOf(rLocale.Country) >= 0 )
-            func=reinterpret_cast<sal_uInt16** 
(*)(sal_Int16*)>(osl_getFunctionSymbol(hModule, 
OUString(get+rLocale.Language+"_TW_"+rAlgorithm).pData));
-        if (!func)
-            func=reinterpret_cast<sal_uInt16** 
(*)(sal_Int16*)>(osl_getFunctionSymbol(hModule, 
OUString(get+rLocale.Language+"_"+rAlgorithm).pData));
-    }
-#else
+    const sal_uInt16** (*func)(sal_Int16&)=nullptr;
     if ( rLocale.Language == "zh" && OUString( "TW HK MO" 
).indexOf(rLocale.Country) >= 0 ) {
         if ( rAlgorithm == "radical" )
             func = get_indexdata_zh_TW_radical;
@@ -111,17 +68,16 @@ IndexEntrySupplier_asian::getIndexCharacter( const 
OUString& rIndexEntry,
                 func = get_indexdata_zh_zhuyin;
         }
     }
-#endif
     if (func) {
         sal_Int16 max_index;
-        sal_uInt16** idx=func(&max_index);
+        const sal_uInt16** idx=func(max_index);
         if (static_cast<sal_Int16>(ch >> 8) <= max_index) {
             sal_uInt16 address=idx[0][ch >> 8];
             if (address != 0xFFFF) {
                 address=idx[1][address+(ch & 0xFF)];
                 return idx[2]
                     ? OUString(
-                        reinterpret_cast<sal_Unicode *>(&idx[2][address]))
+                        reinterpret_cast<const sal_Unicode 
*>(&idx[2][address]))
                     : OUString(sal_Unicode(address));
             }
         }
@@ -159,28 +115,16 @@ OUString SAL_CALL
 IndexEntrySupplier_asian::getPhoneticCandidate( const OUString& rIndexEntry,
         const Locale& rLocale )
 {
-    sal_uInt16 **(*func)(sal_Int16*)=nullptr;
-#ifndef DISABLE_DYNLOADING
-    if (hModule) {
-        const char *func_name=nullptr;
-        if ( rLocale.Language == "zh" )
-            func_name=(OUString("TW HK MO").indexOf(rLocale.Country) >= 0) ?  
"get_zh_zhuyin" : "get_zh_pinyin";
-        else if ( rLocale.Language == "ko" )
-            func_name="get_ko_phonetic";
-        if (func_name)
-            func=reinterpret_cast<sal_uInt16 
**(*)(sal_Int16*)>(osl_getFunctionSymbol(hModule, 
OUString::createFromAscii(func_name).pData));
-    }
-#else
+    sal_uInt16 const **(*func)(sal_Int16&)=nullptr;
     if ( rLocale.Language == "zh" )
         func = (OUString("TW HK MO").indexOf(rLocale.Country) >= 0) ?  
get_zh_zhuyin : get_zh_pinyin;
     else if ( rLocale.Language == "ko" )
         func = get_ko_phonetic;
 
-#endif
     if (func) {
         OUStringBuffer candidate;
         sal_Int16 max_index;
-        sal_uInt16** idx=func(&max_index);
+        sal_uInt16 const ** idx=func(max_index);
         for (sal_Int32 i=0,j=0; i < rIndexEntry.getLength(); i=j) {
             sal_uInt32 ch = rIndexEntry.iterateCodePoints(&j);
             if (static_cast<sal_Int16>(ch>>8) <= max_index) {
@@ -191,7 +135,7 @@ IndexEntrySupplier_asian::getPhoneticCandidate( const 
OUString& rIndexEntry,
                         candidate.append(" ");
                     if (idx[2])
                         candidate.append(
-                            reinterpret_cast<sal_Unicode *>(&idx[2][address]));
+                            reinterpret_cast<const sal_Unicode 
*>(&idx[2][address]));
                     else
                         candidate.append(sal_Unicode(address));
                 } else
diff --git a/i18npool/source/transliteration/textToPronounce_zh.cxx 
b/i18npool/source/transliteration/textToPronounce_zh.cxx
index 79e5eefda3b1..2057f8c43e28 100644
--- a/i18npool/source/transliteration/textToPronounce_zh.cxx
+++ b/i18npool/source/transliteration/textToPronounce_zh.cxx
@@ -26,6 +26,7 @@
 #include <rtl/ustrbuf.hxx>
 
 #include <textToPronounce_zh.hxx>
+#include <indexentrysupplier_asian.hxx>
 
 using namespace com::sun::star::i18n;
 using namespace com::sun::star::uno;
@@ -123,70 +124,27 @@ TextToPronounce_zh::equals( const OUString & str1, 
sal_Int32 pos1, sal_Int32 nCo
     return (nCount1 == nCount2);
 }
 
-#ifdef DISABLE_DYNLOADING
-
-extern "C" {
-
-sal_uInt16 const ** get_zh_zhuyin(sal_Int16 & max_index);
-sal_uInt16 const ** get_zh_pinyin(sal_Int16 & max_index);
-
-}
-
-#endif
-
 TextToPinyin_zh_CN::TextToPinyin_zh_CN() :
-#ifndef DISABLE_DYNLOADING
-    TextToPronounce_zh("get_zh_pinyin")
-#else
     TextToPronounce_zh(get_zh_pinyin)
-#endif
 {
         transliterationName = "ChineseCharacterToPinyin";
         implementationName = 
"com.sun.star.i18n.Transliteration.TextToPinyin_zh_CN";
 }
 
 TextToChuyin_zh_TW::TextToChuyin_zh_TW() :
-#ifndef DISABLE_DYNLOADING
-    TextToPronounce_zh("get_zh_zhuyin")
-#else
     TextToPronounce_zh(get_zh_zhuyin)
-#endif
 {
         transliterationName = "ChineseCharacterToChuyin";
         implementationName = 
"com.sun.star.i18n.Transliteration.TextToChuyin_zh_TW";
 }
 
-#ifndef DISABLE_DYNLOADING
-
-extern "C" { static void thisModule() {} }
-
-TextToPronounce_zh::TextToPronounce_zh(const char* func_name)
-{
-    constexpr OUString lib( u"" SAL_MODULENAME( "index_data" ) ""_ustr );
-    hModule = osl_loadModuleRelative(
-        &thisModule, lib.pData, SAL_LOADMODULE_DEFAULT );
-    idx=nullptr;
-    if (hModule) {
-        sal_uInt16 const ** (*function)(sal_Int16 &) = 
reinterpret_cast<sal_uInt16 const ** (*)(sal_Int16 
&)>(osl_getFunctionSymbol(hModule, OUString::createFromAscii(func_name).pData));
-        if (function)
-            idx=function(o3tl::temporary(sal_Int16()));
-    }
-}
-
-#else
-
 TextToPronounce_zh::TextToPronounce_zh(sal_uInt16 const ** 
(*function)(sal_Int16 &))
 {
     idx = function(o3tl::temporary(sal_Int16()));
 }
 
-#endif
-
 TextToPronounce_zh::~TextToPronounce_zh()
 {
-#ifndef DISABLE_DYNLOADING
-    if (hModule) osl_unloadModule(hModule);
-#endif
 }
 }
 
diff --git a/vcl/commonfuzzer.mk b/vcl/commonfuzzer.mk
index dc967773df91..b5341fc1aa04 100644
--- a/vcl/commonfuzzer.mk
+++ b/vcl/commonfuzzer.mk
@@ -150,7 +150,6 @@ fuzzer_core_libraries = \
     gcc3_uno \
     salhelper \
     sal \
-    index_data \
     localedata_en \
     localedata_others \
 

Reply via email to