i18npool/CppunitTest_i18npool_test_languagetag.mk | 14 +++-------- i18npool/Library_i18nisolang1.mk | 3 -- i18npool/Module_i18npool.mk | 1 i18npool/qa/cppunit/test_languagetag.cxx | 12 +++++++--- i18npool/source/languagetag/languagetag.cxx | 16 ++++++++----- liblangtag/liblangtag-0.2-reg2xml-encoding-problem.patch | 18 +++++++++++++++ liblangtag/makefile.mk | 1 7 files changed, 44 insertions(+), 21 deletions(-)
New commits: commit 57c3b583f1f69edd32b2a54253850e1b3b202255 Author: Eike Rathke <er...@redhat.com> Date: Sat Aug 11 13:49:25 2012 +0200 langtag: libxml2 only used for liblangtag Change-Id: I4bf7bc4f58bac7675cf694dc206e6ba119a6354e diff --git a/i18npool/Library_i18nisolang1.mk b/i18npool/Library_i18nisolang1.mk index d082503..72134c2 100644 --- a/i18npool/Library_i18nisolang1.mk +++ b/i18npool/Library_i18nisolang1.mk @@ -58,8 +58,7 @@ ifeq ($(ENABLE_LIBLANGTAG),YES) $(eval $(call gb_Library_add_defs,i18nisolang1,-DENABLE_LIBLANGTAG)) $(eval $(call gb_Library_use_external,i18nisolang1,glib)) $(eval $(call gb_Library_use_external,i18nisolang1,liblangtag)) -endif - $(eval $(call gb_Library_use_external,i18nisolang1,libxml2)) +endif # vim: set noet sw=4 ts=4: commit 79ebfc9053c92c041e165aa0c8901b0e882c4f9e Author: Eike Rathke <er...@redhat.com> Date: Sat Aug 11 13:45:43 2012 +0200 langtag: enable languagetag unit test again Change-Id: Ia2ed3dc0d0e135913c25e1c389326ee3fbc39719 diff --git a/i18npool/Module_i18npool.mk b/i18npool/Module_i18npool.mk index bed175a..9214d00 100644 --- a/i18npool/Module_i18npool.mk +++ b/i18npool/Module_i18npool.mk @@ -63,6 +63,7 @@ endif $(eval $(call gb_Module_add_check_targets,i18npool,\ CppunitTest_i18npool_test_breakiterator \ CppunitTest_i18npool_test_characterclassification \ + CppunitTest_i18npool_test_languagetag \ )) # vim: set noet sw=4 ts=4: commit 4ff9a9958653666fb0b0ff333cac7f8d1b293117 Author: Eike Rathke <er...@redhat.com> Date: Sat Aug 11 13:29:50 2012 +0200 langtag: use ENABLE_LIBLANGTAG in unit test diff --git a/i18npool/CppunitTest_i18npool_test_languagetag.mk b/i18npool/CppunitTest_i18npool_test_languagetag.mk index 467a36b..fd7c604 100644 --- a/i18npool/CppunitTest_i18npool_test_languagetag.mk +++ b/i18npool/CppunitTest_i18npool_test_languagetag.mk @@ -23,23 +23,17 @@ $(eval $(call gb_CppunitTest_use_libraries,i18npool_test_languagetag,\ $(gb_STDLIBS) \ )) -ifneq ($(OS),ANDROID) -ifneq ($(OS),IOS) +ifeq ($(ENABLE_LIBLANGTAG),YES) $(eval $(call gb_CppunitTest_use_externals,i18npool_test_languagetag,\ liblangtag \ glib \ -)) -endif -endif - -$(eval $(call gb_CppunitTest_use_externals,i18npool_test_languagetag,\ libxml2 \ )) +$(eval $(call gb_CppunitTest_add_defs,i18npool_test_languagetag,-DENABLE_LIBLANGTAG)) ifeq ($(SYSTEM_LIBLANGTAG),YES) -$(eval $(call gb_CppunitTest_add_cxxflags,i18npool_test_languagetag,\ - -DSYSTEM_LIBLANGTAG \ -)) +$(eval $(call gb_CppunitTest_add_defs,i18npool_test_languagetag,-DSYSTEM_LIBLANGTAG)) +endif endif $(eval $(call gb_CppunitTest_set_include,i18npool_test_languagetag,\ diff --git a/i18npool/qa/cppunit/test_languagetag.cxx b/i18npool/qa/cppunit/test_languagetag.cxx index c8a5f7c..4569e81 100644 --- a/i18npool/qa/cppunit/test_languagetag.cxx +++ b/i18npool/qa/cppunit/test_languagetag.cxx @@ -26,7 +26,11 @@ using namespace com::sun::star; // To test the replacement code add '&& 0' and also in // source/languagetag/languagetag.cxx -#define USE_LIBLANGTAG (!defined(ANDROID) && !defined(IOS)) +#if defined(ENABLE_LIBLANGTAG) +#define USE_LIBLANGTAG 1 +#else +#define USE_LIBLANGTAG 0 +#endif namespace { diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx index 68474d8..9eae6ea 100644 --- a/i18npool/source/languagetag/languagetag.cxx +++ b/i18npool/source/languagetag/languagetag.cxx @@ -15,7 +15,7 @@ //#define erDEBUG -#ifdef ENABLE_LIBLANGTAG +#if defined(ENABLE_LIBLANGTAG) #include <liblangtag/langtag.h> #else /* Replacement code for LGPL phobic and Android systems. commit d724f64703eaa0b0595fc4983e42875f2b439e88 Author: Eike Rathke <er...@redhat.com> Date: Sat Aug 11 12:50:11 2012 +0200 langtag: pass system path as data path instead of file URL diff --git a/i18npool/qa/cppunit/test_languagetag.cxx b/i18npool/qa/cppunit/test_languagetag.cxx index fee5769..c8a5f7c 100644 --- a/i18npool/qa/cppunit/test_languagetag.cxx +++ b/i18npool/qa/cppunit/test_languagetag.cxx @@ -54,12 +54,14 @@ void TestLanguageTag::testInit() const char* pEnv = getenv("OUTDIR"); CPPUNIT_ASSERT_MESSAGE("No $OUTDIR", pEnv); aBuf.append( "file:///").append( OStringToOUString( pEnv, RTL_TEXTENCODING_UTF8)).append( "/share/liblangtag"); - OUString aPath( aBuf.makeStringAndClear()); - OUString aData( aPath); + OUString aURL( aBuf.makeStringAndClear()); + OUString aData( aURL); aData += "/language-subtag-registry.xml"; osl::DirectoryItem aDirItem; CPPUNIT_ASSERT_MESSAGE("liblangtag data not found", osl::DirectoryItem::get( aData, aDirItem) == osl::DirectoryItem::E_None); + OUString aPath; + CPPUNIT_ASSERT( osl::FileBase::getSystemPathFromFileURL( aURL, aPath) == osl::FileBase::E_None); LanguageTag::overrideDataPath( aPath); #endif } diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx index 4192374..68474d8 100644 --- a/i18npool/source/languagetag/languagetag.cxx +++ b/i18npool/source/languagetag/languagetag.cxx @@ -113,19 +113,23 @@ void LiblantagDataRef::presetDataPath( const rtl::OUString& rPath ) void LiblantagDataRef::setupDataPath() { // maDataPath is assumed to be empty here. - OUString aPath; - if (!rtl::Bootstrap::get( "BRAND_BASE_DIR", aPath)) + OUString aURL; + if (!rtl::Bootstrap::get( "BRAND_BASE_DIR", aURL)) OSL_FAIL( "LiblantagDataRef: can't get BRAND_BASE_DIR"); else { // Check if data is in our own installation, else assume system // installation. - aPath += "/share/liblangtag"; - OUString aData( aPath); + aURL += "/share/liblangtag"; + OUString aData( aURL); aData += "/language-subtag-registry.xml"; osl::DirectoryItem aDirItem; if (osl::DirectoryItem::get( aData, aDirItem) == osl::DirectoryItem::E_None) - maDataPath = OUStringToOString( aPath, RTL_TEXTENCODING_UTF8); + { + OUString aPath; + if (osl::FileBase::getSystemPathFromFileURL( aURL, aPath) == osl::FileBase::E_None) + maDataPath = OUStringToOString( aPath, RTL_TEXTENCODING_UTF8); + } } if (maDataPath.isEmpty()) maDataPath = "|"; // assume system commit 15e7f34a2134b1a4d892f4e4d945b9cb547202ac Author: Eike Rathke <er...@redhat.com> Date: Sat Aug 11 12:50:11 2012 +0200 langtag: worked around reg2xml libxml2 encoding problem libxml2 has a problem when a document encoding is specified, even though documentation says that all internal representation would be in UTF-8 and language-subtag-registry data already is passed in UTF-8, when specifying the document encoding to be UTF-8 the output to language-subtag-registry.xml is conversion garbage, '?' on Linux UTF-8 locale, ISO-8859-1 on Windows. If no document encoding is specified at all no conversion happens and non-ASCII values are correctly written as entities. diff --git a/liblangtag/liblangtag-0.2-reg2xml-encoding-problem.patch b/liblangtag/liblangtag-0.2-reg2xml-encoding-problem.patch new file mode 100644 index 0000000..cae5df5 --- /dev/null +++ b/liblangtag/liblangtag-0.2-reg2xml-encoding-problem.patch @@ -0,0 +1,18 @@ +# libxml2 has a problem when a document encoding is specified, even though +# documentation says that all internal representation would be in UTF-8 and +# language-subtag-registry data already is passed in UTF-8, when specifying the +# document encoding to be UTF-8 the output to language-subtag-registry.xml is +# conversion garbage, '?' on Linux UTF-8 locale, ISO-8859-1 on Windows. If no +# document encoding is specified at all no conversion happens and non-ASCII +# values are correctly written as entities. + +--- misc/liblangtag-0.2/data/reg2xml.c 2012-01-30 13:20:57.000000000 +0100 ++++ misc/build/liblangtag-0.2/data/reg2xml.c 2012-08-11 02:30:39.147779753 +0200 +@@ -144,7 +144,6 @@ + gboolean retval; + + doc = xmlNewDoc((const xmlChar *)"1.0"); +- doc->encoding = xmlStrdup((const xmlChar *)"UTF-8"); + root = xmlNewDocNode(doc, NULL, + (const xmlChar *)"registry", + NULL); diff --git a/liblangtag/makefile.mk b/liblangtag/makefile.mk index 6acd160..f318f8e 100644 --- a/liblangtag/makefile.mk +++ b/liblangtag/makefile.mk @@ -41,6 +41,7 @@ PATCH_FILES+=liblangtag-0.2-0002-Fix-invalid-memory-access.patch PATCH_FILES+=liblangtag-0.2-configure.patch PATCH_FILES+=liblangtag-0.2-datadir.patch PATCH_FILES+=liblangtag-0.2-msvc-warning.patch +PATCH_FILES+=liblangtag-0.2-reg2xml-encoding-problem.patch CONFIGURE_DIR=. BUILD_DIR=$(CONFIGURE_DIR) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits