include/xmlreader/xmlreader.hxx | 2 + scp2/inc/macros.inc | 8 ++--- scp2/macros/macro.pl | 16 +++++++++++ scp2/source/ooo/file_library_ooo.scp | 2 - scp2/source/ooo/file_ooo.scp | 40 ++++++++++++++-------------- scp2/source/ooo/ure.scp | 4 +- scp2/source/python/file_python.scp | 2 - solenv/bin/modules/installer/scriptitems.pm | 2 - solenv/gbuild/UIConfig.mk | 31 +++++++++++---------- solenv/gbuild/Zip.mk | 29 ++++++++++++++++---- vcl/source/window/builder.cxx | 35 ++++++++++++++++++++---- xmlreader/source/xmlreader.cxx | 14 +++++++++ 12 files changed, 131 insertions(+), 54 deletions(-)
New commits: commit 56fdec9d62826380e954dfdcef28cb2139a47af5 Author: Matúš Kukan <[email protected]> Date: Wed Dec 4 17:09:33 2013 +0100 Do not compress .ui translations in .zip files. Using zip files reduce the file count in installer. Uncompressed zip files can be compressed better by packaging, thus we reduce the size of final package. Change-Id: Id7c5ee9e302de325a29702b4e64301dc7102b2cf Reviewed-on: https://gerrit.libreoffice.org/6938 Reviewed-by: Andras Timar <[email protected]> Tested-by: Andras Timar <[email protected]> diff --git a/solenv/gbuild/UIConfig.mk b/solenv/gbuild/UIConfig.mk index 14d05c6..282b5f9 100644 --- a/solenv/gbuild/UIConfig.mk +++ b/solenv/gbuild/UIConfig.mk @@ -228,6 +228,7 @@ endef define gb_UIConfig__UIConfig_for_lang $(call gb_Zip_Zip_internal,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2)),$(gb_UILocalizeTarget_WORKDIR)/$(1)) +$(call gb_Zip_add_commandoptions,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2)),--suffixes .ui) $(call gb_Zip_get_target,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2))) : $(SRCDIR)/solenv/gbuild/UIConfig.mk endef commit 3503e9c048a9755b74f57ec91eeb4495476089b5 Author: Matúš Kukan <[email protected]> Date: Fri Dec 6 15:30:36 2013 +0100 scp2: hopefully fix Windows build Change-Id: Ib4ead1d64dc6b8e76bf2c7bf0f007e8962acb1e2 diff --git a/scp2/source/ooo/ure.scp b/scp2/source/ooo/ure.scp index 3e9983b..3cf19c2 100644 --- a/scp2/source/ooo/ure.scp +++ b/scp2/source/ooo/ure.scp @@ -404,7 +404,7 @@ End File gid_File_Lib_Cli_Cppuhelper_Assembly TXT_FILE_BODY; Styles = (PACKED, ASSEMBLY); - Name = "assembly/cli_cppuhelper.dll"; + Name = "cli_cppuhelper.dll"; Dir = SCP2_URE_DL_DIR; Assemblyname = "cli_cppuhelper"; PublicKeyToken = "ce2cb7e279207b9e"; diff --git a/scp2/source/python/file_python.scp b/scp2/source/python/file_python.scp index e4d5336..66e590d 100644 --- a/scp2/source/python/file_python.scp +++ b/scp2/source/python/file_python.scp @@ -60,7 +60,7 @@ End File gid_File_Py_Bin_Python BIN_FILE_BODY; #ifdef WNT - Name = EXENAME(pyuno/python); + Name = EXENAME(python); Dir = gid_Brand_Dir_Program; Styles = (PACKED); #else commit 7fe9808f009af2f0a4da58663eacd2caccdcaafe Author: Matúš Kukan <[email protected]> Date: Tue Dec 3 08:19:36 2013 +0100 Zip .ui translations per UIConfig target. Fix installer / scp2 to not ignore directory prefix in 'Name'. Change-Id: Ib319363c8be73a72029f1ba3833e518e15c55e29 Reviewed-on: https://gerrit.libreoffice.org/6915 Reviewed-by: David Tardon <[email protected]> Tested-by: David Tardon <[email protected]> diff --git a/include/xmlreader/xmlreader.hxx b/include/xmlreader/xmlreader.hxx index e895d8d..4ffc84e 100644 --- a/include/xmlreader/xmlreader.hxx +++ b/include/xmlreader/xmlreader.hxx @@ -39,6 +39,8 @@ namespace xmlreader { class OOO_DLLPUBLIC_XMLREADER XmlReader: private boost::noncopyable { public: + XmlReader(char const *sStr, size_t nLength); + explicit XmlReader(OUString const & fileUrl) SAL_THROW(( com::sun::star::container::NoSuchElementException, diff --git a/scp2/inc/macros.inc b/scp2/inc/macros.inc index 2f605a9..d95c364 100755 --- a/scp2/inc/macros.inc +++ b/scp2/inc/macros.inc @@ -481,12 +481,12 @@ End #include <langmacros.inc> -#define UI_FILELIST_ALL_LANG(name, file, ext) \ +#define UI_FILELIST_ALL_LANG(name, file) \ File CONCAT3(gid_File_Share_Config_Sofficecfg_uiconfig_, name, _Lang) \ TXT_FILE_BODY; \ - Styles = (FILELIST); \ - Dir = FILELIST_DIR; \ - EXTRA_ALL_LANG_BUT_EN_US(file, ext); \ + Styles = (PACKED); \ + Dir = gid_Dir_Share_Config_Sofficecfg; \ + UI_ALL_LANG_BUT_EN_US(file); \ End #define URE_PRIVATE_LIB(id,name) \ diff --git a/scp2/macros/macro.pl b/scp2/macros/macro.pl index 3ebeabe..3e7e415 100644 --- a/scp2/macros/macro.pl +++ b/scp2/macros/macro.pl @@ -50,6 +50,7 @@ write_DIR_ISOLANGUAGE_ALL_LANG(); write_DIR_ISOLANGUAGE_ALL_LANG_LPROJ(); write_EXTRA_ALL_LANG(); write_EXTRA_ALL_LANG_BUT_EN_US(); +write_UI_ALL_LANG_BUT_EN_US(); write_EXTRA_ALL_GOOD_HELP_LOCALIZATIONS_LANG(); write_RESFILE_ALL_LANG(); write_README_ALL_LANG(); @@ -166,6 +167,21 @@ sub write_EXTRA_ALL_LANG_BUT_EN_US print OUTFILE "\n\n"; } +sub write_UI_ALL_LANG_BUT_EN_US +{ + print OUTFILE "#define UI_ALL_LANG_BUT_EN_US(name) "; + my $first = 1; + foreach $lang (@completelangiso) { + if ($lang ne "en-US") { + print OUTFILE "; " unless $first; + $first = 0; + print OUTFILE + "\\\n\tName ($lang) = STRING(CONCAT2(name,/ui/res/$lang.zip))"; + } + } + print OUTFILE "\n\n"; +} + sub write_EXTRA_ALL_GOOD_HELP_LOCALIZATIONS_LANG { my $first = 1; diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp index c01b777..5a54ff8 100644 --- a/scp2/source/ooo/file_library_ooo.scp +++ b/scp2/source/ooo/file_library_ooo.scp @@ -323,7 +323,7 @@ SPECIAL_LIB_FILE(gid_File_Lib_Sqlite3,sqlite3) #else #if !defined(MACOSX) File gid_File_Lib_Sqlite3 - Name = "sqlite/" SPECIAL_NAME(sqlite3); + Name = SPECIAL_NAME(sqlite3); PACKED_LIB_FILE_BODY; End #endif //!defined(MACOSX) diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index 08ed086..5597fe5 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -611,31 +611,31 @@ UI_FILELIST(uui, "UIConfig/uui.filelist") UI_FILELIST(vcl, "UIConfig/vcl.filelist") UI_FILELIST(xmlsec, "UIConfig/xmlsec.filelist") -UI_FILELIST_ALL_LANG(basicide, UIConfig/modules/BasicIDE, filelist) -UI_FILELIST_ALL_LANG(cui, UIConfig/cui, filelist) +UI_FILELIST_ALL_LANG(basicide, modules/BasicIDE) +UI_FILELIST_ALL_LANG(cui, cui) #ifdef DBCONNECTIVITY -UI_FILELIST_ALL_LANG(dbaccess, UIConfig/dbaccess, filelist) -#endif -UI_FILELIST_ALL_LANG(desktop, UIConfig/desktop, filelist) -UI_FILELIST_ALL_LANG(filter, UIConfig/filter, filelist) -UI_FILELIST_ALL_LANG(scalc, UIConfig/modules/scalc, filelist) -UI_FILELIST_ALL_LANG(schart, UIConfig/modules/schart, filelist) -UI_FILELIST_ALL_LANG(sdraw, UIConfig/modules/sdraw, filelist) -UI_FILELIST_ALL_LANG(sfx, UIConfig/sfx, filelist) -UI_FILELIST_ALL_LANG(simpress, UIConfig/modules/simpress, filelist) -UI_FILELIST_ALL_LANG(smath, UIConfig/modules/smath, filelist) +UI_FILELIST_ALL_LANG(dbaccess, dbaccess) +#endif +UI_FILELIST_ALL_LANG(desktop, desktop) +UI_FILELIST_ALL_LANG(filter, filter) +UI_FILELIST_ALL_LANG(scalc, modules/scalc) +UI_FILELIST_ALL_LANG(schart, modules/schart) +UI_FILELIST_ALL_LANG(sdraw, modules/sdraw) +UI_FILELIST_ALL_LANG(sfx, sfx) +UI_FILELIST_ALL_LANG(simpress, modules/simpress) +UI_FILELIST_ALL_LANG(smath, modules/smath) #ifdef GUIBASE_UNX -UI_FILELIST_ALL_LANG(spa, UIConfig/spa, filelist) +UI_FILELIST_ALL_LANG(spa, spa) #endif -UI_FILELIST_ALL_LANG(svt, UIConfig/svt, filelist) -UI_FILELIST_ALL_LANG(svx, UIConfig/svx, filelist) -UI_FILELIST_ALL_LANG(swriter, UIConfig/modules/swriter, filelist) +UI_FILELIST_ALL_LANG(svt, svt) +UI_FILELIST_ALL_LANG(svx, svx) +UI_FILELIST_ALL_LANG(swriter, modules/swriter) #ifdef ENABLE_TELEPATHY -UI_FILELIST_ALL_LANG(tubes, UIConfig/tubes, filelist) +UI_FILELIST_ALL_LANG(tubes, tubes) #endif -UI_FILELIST_ALL_LANG(uui, UIConfig/uui, filelist) -UI_FILELIST_ALL_LANG(vcl, UIConfig/vcl, filelist) -UI_FILELIST_ALL_LANG(xmlsec, UIConfig/xmlsec, filelist) +UI_FILELIST_ALL_LANG(uui, uui) +UI_FILELIST_ALL_LANG(vcl, vcl) +UI_FILELIST_ALL_LANG(xmlsec, xmlsec) #ifdef WNT diff --git a/scp2/source/ooo/ure.scp b/scp2/source/ooo/ure.scp index 653fb6f..3e9983b 100644 --- a/scp2/source/ooo/ure.scp +++ b/scp2/source/ooo/ure.scp @@ -571,7 +571,7 @@ End File gid_File_Misc_ServicesRdb TXT_FILE_BODY; Dir = GID_DIR_URE_SHARE_MISC; - Name = "ure/services.rdb"; + Name = "services.rdb"; Styles = (PACKED); End diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index fe767f7..be1123d 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -874,7 +874,7 @@ sub get_Destination_Directory_For_Item_From_Directorylist # this is used f elsif ((!( $ispredefinedprogdir )) && (!( $ispredefinedconfigdir ))) { my $directorynameref = get_Directoryname_From_Directorygid($dirsarrayref, $searchdirgid, $onelanguage, $oneitemgid); - $destfilename = $$directorynameref . $installer::globals::separator . $oneitemname; + $destfilename = $$directorynameref . $installer::globals::separator . $oneitem->{'Name'}; } else { diff --git a/solenv/gbuild/UIConfig.mk b/solenv/gbuild/UIConfig.mk index 657d362..14d05c6 100644 --- a/solenv/gbuild/UIConfig.mk +++ b/solenv/gbuild/UIConfig.mk @@ -61,17 +61,17 @@ $(call gb_UILocalizeTarget_get_clean_target,%) : # # gb_UILocalizeTarget_UILocalizeTarget target define gb_UILocalizeTarget_UILocalizeTarget -$(call gb_UILocalizeTarget__UILocalizeTarget_impl,$(1),$(wildcard $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(1))).po))) +$(call gb_UILocalizeTarget__UILocalizeTarget_impl,$(1),$(2),$(wildcard $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(2))).po))) endef # gb_UILocalizeTarget__UILocalizeTarget_impl target pofiles define gb_UILocalizeTarget__UILocalizeTarget_impl -$(call gb_UILocalizeTarget_get_target,$(1)) : POFILES := $(2) -$(call gb_UILocalizeTarget_get_target,$(1)) : UIConfig_FILE := $(SRCDIR)/$(1).ui +$(call gb_UILocalizeTarget_get_target,$(1)) : POFILES := $(3) +$(call gb_UILocalizeTarget_get_target,$(1)) : UIConfig_FILE := $(SRCDIR)/$(2).ui -$(call gb_UILocalizeTarget_get_target,$(1)) : $(2) -$(call gb_UILocalizeTarget_get_target,$(1)) : $(SRCDIR)/$(1).ui +$(call gb_UILocalizeTarget_get_target,$(1)) : $(3) +$(call gb_UILocalizeTarget_get_target,$(1)) : $(SRCDIR)/$(2).ui $(call gb_UILocalizeTarget_get_target,$(1)) :| \ $(dir $(call gb_UILocalizeTarget_get_target,$(1))).dir \ $(call gb_UILocalizeTarget_get_workdir,$(1))/.dir @@ -196,8 +196,8 @@ $(call gb_UIConfig_get_clean_target,%) : ) gb_UIConfig_get_packagename = UIConfig/$(1) -gb_UIConfig_get_packagename_for_lang = UIConfig/$(1)_$(2) gb_UIConfig_get_packagesetname = UIConfig/$(1) +gb_UIConfig_get_zipname_for_lang = UIConfig/$(1)/$(2) # Processes and delivers a set of UI configuration files. # @@ -227,9 +227,8 @@ $(call gb_Postprocess_register_target,AllUIConfigs,UIConfig,$(1)) endef define gb_UIConfig__UIConfig_for_lang -$(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename_for_lang,$(1),$(2)),$(gb_UILocalizeTarget_WORKDIR)) -$(call gb_UIConfig_get_target,$(1)) : $(call gb_Package_get_target,$(call gb_UIConfig_get_packagename_for_lang,$(1),$(2))) -$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(call gb_UIConfig_get_packagename_for_lang,$(1),$(2))) +$(call gb_Zip_Zip_internal,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2)),$(gb_UILocalizeTarget_WORKDIR)/$(1)) +$(call gb_Zip_get_target,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(2))) : $(SRCDIR)/solenv/gbuild/UIConfig.mk endef @@ -260,8 +259,11 @@ endef # # gb_UIConfig__add_uifile_for_lang target file lang define gb_UIConfig__add_uifile_for_lang -$(call gb_UIConfig__package_uifile,$(1),$(call gb_UIConfig_get_packagename_for_lang,$(1),$(3)),res/$(3)/$(notdir $(2)),$(2)/$(3).ui) -$(call gb_Package_SOURCEDIR_$(call gb_UIConfig_get_packagename_for_lang,$(1),$(3)))/$(2)/$(3).ui : $(call gb_UILocalizeTarget_get_target,$(2)) +$(call gb_UIConfig_get_target,$(1)) : $(call gb_Zip_get_target,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(3))) +$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_Zip_get_clean_target,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(3))) +$(call gb_Zip_add_file,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(3)),$(notdir $(2))/$(3).ui) +$(call gb_Zip_add_dependency,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(3)),$(call gb_UILocalizeTarget_get_target,$(1)/$(notdir $(2)))) +$(call gb_Zip_set_install_name,$(call gb_UIConfig_get_zipname_for_lang,$(1),$(3)),$(INSTROOT)/$(gb_UIConfig_INSTDIR)/$(1)/ui/res/$(3).zip) endef @@ -278,9 +280,9 @@ endef # gb_UIConfig__add_translations_impl target uifile langs define gb_UIConfig__add_translations_impl -$(call gb_UILocalizeTarget_UILocalizeTarget,$(2)) -$(call gb_UIConfig_get_target,$(1)) : $(call gb_UILocalizeTarget_get_target,$(2)) -$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UILocalizeTarget_get_clean_target,$(2)) +$(call gb_UILocalizeTarget_UILocalizeTarget,$(1)/$(notdir $(2)),$(2)) +$(call gb_UIConfig_get_target,$(1)) : $(call gb_UILocalizeTarget_get_target,$(1)/$(notdir $(2))) +$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UILocalizeTarget_get_clean_target,$(1)/$(notdir $(2))) $(foreach lang,$(3),$(call gb_UIConfig__add_uifile_for_real_lang,$(1),$(2),$(lang))) endef diff --git a/solenv/gbuild/Zip.mk b/solenv/gbuild/Zip.mk index ae21f7f..a675766 100644 --- a/solenv/gbuild/Zip.mk +++ b/solenv/gbuild/Zip.mk @@ -28,25 +28,33 @@ $(call gb_Zip_get_clean_target,%) : $(call gb_Output_announce,$*,$(false),ZIP,3) $(call gb_Helper_abbreviate_dirs,\ $(if $(CLEAR_LOCATION),rm -rf $(gb_Package_Location_$*) &&) \ + $(if $(INSTALL_NAME),rm -f $(INSTALL_NAME) &&) \ rm -f $(call gb_Zip_get_target,$*) && \ rm -f $(call gb_Zip__get_preparation_target,$*)) +$(dir $(call gb_Zip_get_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(dir $(call gb_Zip_get_target,%))%/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + # rule to create zip package in workdir # --filesync makes sure that all files in the zip package will be removed that no longer are in $(FILES) $(call gb_Zip_get_target,%) : $(call gb_Output_announce,$*,$(true),ZIP,3) - $(call gb_Helper_abbreviate_dirs,\ + $(if $(FILES),$(call gb_Helper_abbreviate_dirs,\ RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,\ $(FILES)) && \ - mkdir -p $(dir $(call gb_Zip_get_target,$*)) && \ cd $(LOCATION) && cat $${RESPONSEFILE} | tr "[:space:]" "\n" | $(gb_Zip_ZIPCOMMAND) -@rX --filesync --must-match $(call gb_Zip_get_target,$*) && \ - rm -f $${RESPONSEFILE} ) + rm -f $${RESPONSEFILE} && \ + touch $@ \ + $(if $(INSTALL_NAME),&& cp $(call gb_Zip_get_target,$*) $(INSTALL_NAME)) \ + )) # the preparation target is here to ensure proper ordering of actions in cases # when we want to, e.g., create a zip from files created by a custom target $(call gb_Zip__get_preparation_target,%) : - $(call gb_Helper_abbreviate_dirs,\ - mkdir -p $(dir $@) && touch $@) + touch $@ # clear file list, set location (zipping uses relative paths) # register target and clean target @@ -57,8 +65,12 @@ $(call gb_Zip__get_preparation_target,%) : # the location can't be stored in a scoped variable as it is needed in the add_file macro (see rule above) define gb_Zip_Zip_internal_nodeliver $(call gb_Zip_get_target,$(1)) : FILES := +$(call gb_Zip_get_target,$(1)) : INSTALL_NAME := $(call gb_Zip_get_target,$(1)) : LOCATION := $(2) +$(call gb_Zip_get_target,$(1)) :| $(dir $(call gb_Zip_get_target,$(1))).dir +$(call gb_Zip__get_preparation_target,$(1)) :| $(dir $(call gb_Zip__get_preparation_target,$(1))).dir $(call gb_Zip_get_clean_target,$(1)) : CLEAR_LOCATION := +$(call gb_Zip_get_clean_target,$(1)) : INSTALL_NAME := $(eval gb_Package_Location_$(1) := $(2)) endef @@ -118,6 +130,13 @@ $(call gb_Zip_get_target,$(1)) : gb_Zip_ZIPCOMMAND += $(2) endef +define gb_Zip_set_install_name +$(call gb_Zip_get_target,$(1)) : INSTALL_NAME := $(2) +$(call gb_Zip_get_target,$(1)) :| $(dir $(2)).dir +$(call gb_Zip_get_clean_target,$(1)) : INSTALL_NAME := $(2) + +endef + define gb_Zip_use_unpacked $(call gb_Zip__get_preparation_target,$(1)) \ :| $(call gb_UnpackedTarball_get_final_target,$(2)) diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index e2f306d..577eb86 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -7,6 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <com/sun/star/packages/zip/ZipFileAccess.hpp> + +#include <comphelper/processfactory.hxx> #include <osl/module.hxx> #include <sal/log.hxx> #include <unotools/configmgr.hxx> @@ -98,24 +101,44 @@ void VclBuilder::loadTranslations(const LanguageTag &rLanguageTag, const OUStrin aTransBuf.append('.'); nLastSlash = 0; } - aTransBuf.append("/res/").append(rLanguageTag.getLanguage()); + aTransBuf.append("/res/"); + OUString sLang(rLanguageTag.getLanguage()); switch (i) { case 0: - aTransBuf.append('-').append(rLanguageTag.getCountry()); + sLang = sLang + "-" + rLanguageTag.getCountry(); break; default: break; } + aTransBuf.append(sLang); + aTransBuf.append(".zip"); sal_Int32 nEndName = rUri.lastIndexOf('.'); if (nEndName == -1) nEndName = rUri.getLength(); - aTransBuf.append(rUri.copy(nLastSlash, nEndName-nLastSlash)); - - OUString sTransUri = aTransBuf.makeStringAndClear(); + OUString sZippedFile(rUri.copy(nLastSlash + 1, nEndName - nLastSlash - 1) + "/" + sLang + ".ui"); try { - xmlreader::XmlReader reader(sTransUri); + uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = + packages::zip::ZipFileAccess::createWithURL( + comphelper::getProcessComponentContext(), aTransBuf.makeStringAndClear()); + if (!xNameAccess.is()) + continue; + uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(sZippedFile), uno::UNO_QUERY); + if (!xInputStream.is()) + continue; + OStringBuffer sStr; + for (;;) + { + sal_Int32 const size = 2048; + css::uno::Sequence< sal_Int8 > data(size); + sal_Int32 n = xInputStream->readBytes(data, size); + sStr.append(reinterpret_cast<const sal_Char *>(data.getConstArray()), n); + if (n < size) + break; + } + + xmlreader::XmlReader reader(const_cast<char *>(sStr.getStr()), sStr.getLength()); handleTranslations(reader); break; } diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx index 13e2780..3e1d24e 100644 --- a/xmlreader/source/xmlreader.cxx +++ b/xmlreader/source/xmlreader.cxx @@ -54,6 +54,18 @@ bool isSpace(char c) { } +XmlReader::XmlReader(char const *sStr, size_t nLength) + : fileUrl_("stream") + , fileHandle_(0) +{ + namespaceIris_.push_back(Span("http://www.w3.org/XML/1998/namespace")); + namespaces_.push_back(NamespaceData(Span("xml"), NAMESPACE_XML)); + pos_ = sStr; + end_ = pos_ + nLength; + state_ = STATE_CONTENT; + firstAttribute_ = true; +} + XmlReader::XmlReader(OUString const & fileUrl) SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)): @@ -99,6 +111,8 @@ XmlReader::XmlReader(OUString const & fileUrl) } XmlReader::~XmlReader() { + if (!fileHandle_) + return; oslFileError e = osl_unmapMappedFile(fileHandle_, fileAddress_, fileSize_); if (e != osl_File_E_None) { SAL_WARN(
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
