[libreoffice] fix docx import on big endian

Caolán McNamara caolanm at fedoraproject.org
Wed Nov 28 12:22:24 UTC 2012


commit 7e667da165a33ae6f07c2d2c057e3ab88b6b39e8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 28 12:22:20 2012 +0000

    fix docx import on big endian

 ...text-mixup-triggering-regression-test-fai.patch |  181 ++++++++++++++++++++
 0001-disable-failing-check.patch                   |   12 --
 libreoffice.spec                                   |   10 +-
 3 files changed, 187 insertions(+), 16 deletions(-)
---
diff --git a/0001-bigendian-utext-mixup-triggering-regression-test-fai.patch b/0001-bigendian-utext-mixup-triggering-regression-test-fai.patch
new file mode 100644
index 0000000..50590cc
--- /dev/null
+++ b/0001-bigendian-utext-mixup-triggering-regression-test-fai.patch
@@ -0,0 +1,181 @@
+From 49f2a69fa7d8eaa23d77519ac29748f4dc3e4c5a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Wed, 28 Nov 2012 11:15:56 +0000
+Subject: [PATCH] bigendian utext mixup triggering regression test failure
+
+text takes a pointer to a sal_uInt8 buffer but
+utext takes a pointer to a sal_Unicode buffer
+
+passing a sal_uInt8 sequence of e.g. "\x0D\x00" to utext only happens
+to work on little endian machines to represent 0x000D, its 0x0D00 on
+bigendian.
+
+for more excitement text and utext do not share the same logic!
+Various special chars are treated different in text vs utext so
+we can't simply blindly change utext() calls to text() calls and
+get the same behaviour without reworking those.
+
+So keep the text()/utext() calls as they are, but change what's
+passed to be the right thing.
+
+Change-Id: I66696530c4a9482690c461146bdcf0a507b39b68
+---
+ .../source/ooxml/OOXMLFastContextHandler.cxx       | 51 +++++++++++-----------
+ 1 file changed, 25 insertions(+), 26 deletions(-)
+
+diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+index 920bf31..c6f03bb 100644
+--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
++++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+@@ -39,19 +39,18 @@
+ #include "Handler.hxx"
+ #include "ooxmlLoggers.hxx"
+ 
+-static const sal_uInt8 s0x7[] = { 0x7, 0x0 };
+-static const sal_uInt8 s0xd[] = { 0xd, 0x0 };
+-static const sal_uInt8 sCR[] = { 0xd, 0x0 };
+-static const sal_uInt8 sFtnEdnRef[] = { 0x2, 0x0 };
+-static const sal_uInt8 sFtnEdnSep[] = { 0x3, 0x0 };
+-static const sal_uInt8 sFtnEdnCont[] = { 0x4, 0x0 };
+-static const sal_uInt8 sTab[] = { 0x9, 0x0 };
+-static const sal_uInt8 sPgNum[] = { 0x0, 0x0 };
+-static const sal_uInt8 sFieldStart[] = { 0x13  };
+-static const sal_uInt8 sFieldSep[] = { 0x14 };
+-static const sal_uInt8 sFieldEnd[] = { 0x15 };
+-static const sal_uInt8 sNoBreakHyphen[] = { 0x1e, 0x0 };
+-static const sal_uInt8 sSoftHyphen[] = { 0x1f, 0x0 };
++static const sal_Unicode uCR = 0xd;
++static const sal_Unicode uFtnEdnRef = 0x2;
++static const sal_Unicode uFtnEdnSep = 0x3;
++static const sal_Unicode uTab = 0x9;
++static const sal_Unicode uPgNum = 0x0;
++static const sal_Unicode uNoBreakHyphen = 0x1e;
++static const sal_Unicode uSoftHyphen = 0x1f;
++
++static const sal_uInt8 cFtnEdnCont = 0x4;
++static const sal_uInt8 cFieldStart = 0x13;
++static const sal_uInt8 cFieldSep = 0x14;
++static const sal_uInt8 cFieldEnd = 0x15;
+ 
+ namespace writerfilter {
+ namespace ooxml
+@@ -710,7 +709,7 @@ void OOXMLFastContextHandler::startField()
+ #endif
+     startCharacterGroup();
+     if (isForwardEvents())
+-        mpStream->text(sFieldStart, 1);
++        mpStream->text(&cFieldStart, 1);
+     endCharacterGroup();
+ }
+ 
+@@ -721,7 +720,7 @@ void OOXMLFastContextHandler::fieldSeparator()
+ #endif
+     startCharacterGroup();
+     if (isForwardEvents())
+-        mpStream->text(sFieldSep, 1);
++        mpStream->text(&cFieldSep, 1);
+     endCharacterGroup();
+ }
+ 
+@@ -732,7 +731,7 @@ void OOXMLFastContextHandler::endField()
+ #endif
+     startCharacterGroup();
+     if (isForwardEvents())
+-        mpStream->text(sFieldEnd, 1);
++        mpStream->text(&cFieldEnd, 1);
+     endCharacterGroup();
+ }
+ 
+@@ -742,7 +741,7 @@ void OOXMLFastContextHandler::ftnednref()
+     debug_logger->element("contexthandler.ftnednref");
+ #endif
+     if (isForwardEvents())
+-        mpStream->utext(sFtnEdnRef, 1);
++        mpStream->utext((const sal_uInt8*)&uFtnEdnRef, 1);
+ }
+ 
+ void OOXMLFastContextHandler::ftnednsep()
+@@ -751,7 +750,7 @@ void OOXMLFastContextHandler::ftnednsep()
+     debug_logger->element("contexthandler.ftnednsep");
+ #endif
+     if (isForwardEvents())
+-        mpStream->utext(sFtnEdnSep, 1);
++        mpStream->utext((const sal_uInt8*)&uFtnEdnSep, 1);
+ }
+ 
+ void OOXMLFastContextHandler::ftnedncont()
+@@ -760,7 +759,7 @@ void OOXMLFastContextHandler::ftnedncont()
+     debug_logger->element("contexthandler.ftnedncont");
+ #endif
+     if (isForwardEvents())
+-        mpStream->text(sFtnEdnCont, 1);
++        mpStream->text(&cFtnEdnCont, 1);
+ }
+ 
+ void OOXMLFastContextHandler::pgNum()
+@@ -769,7 +768,7 @@ void OOXMLFastContextHandler::pgNum()
+     debug_logger->element("contexthandler.pgNum");
+ #endif
+     if (isForwardEvents())
+-        mpStream->utext((const sal_uInt8*)sPgNum, 1);
++        mpStream->utext((const sal_uInt8*)&uPgNum, 1);
+ }
+ 
+ void OOXMLFastContextHandler::tab()
+@@ -778,7 +777,7 @@ void OOXMLFastContextHandler::tab()
+     debug_logger->element("contexthandler.tab");
+ #endif
+     if (isForwardEvents())
+-        mpStream->utext((const sal_uInt8*)sTab, 1);
++        mpStream->utext((const sal_uInt8*)&uTab, 1);
+ }
+ 
+ void OOXMLFastContextHandler::cr()
+@@ -787,7 +786,7 @@ void OOXMLFastContextHandler::cr()
+     debug_logger->element("contexthandler.cr");
+ #endif
+     if (isForwardEvents())
+-        mpStream->utext((const sal_uInt8*)sCR, 1);
++        mpStream->utext((const sal_uInt8*)&uCR, 1);
+ }
+ 
+ void OOXMLFastContextHandler::noBreakHyphen()
+@@ -796,7 +795,7 @@ void OOXMLFastContextHandler::noBreakHyphen()
+     debug_logger->element("contexthandler.noBreakHyphen");
+ #endif
+     if (isForwardEvents())
+-        mpStream->utext((const sal_uInt8*)sNoBreakHyphen, 1);
++        mpStream->utext((const sal_uInt8*)&uNoBreakHyphen, 1);
+ }
+ 
+ void OOXMLFastContextHandler::softHyphen()
+@@ -805,7 +804,7 @@ void OOXMLFastContextHandler::softHyphen()
+     debug_logger->element("contexthandler.softHyphen");
+ #endif
+     if (isForwardEvents())
+-        mpStream->utext((const sal_uInt8*)sSoftHyphen, 1);
++        mpStream->utext((const sal_uInt8*)&uSoftHyphen, 1);
+ }
+ 
+ void OOXMLFastContextHandler::handleLastParagraphInSection()
+@@ -829,7 +828,7 @@ void OOXMLFastContextHandler::endOfParagraph()
+     if (! mpParserState->isInCharacterGroup())
+         startCharacterGroup();
+     if (isForwardEvents())
+-        mpStream->utext((const sal_uInt8*)sCR, 1);
++        mpStream->utext((const sal_uInt8*)&uCR, 1);
+ }
+ 
+ void OOXMLFastContextHandler::startTxbxContent()
+@@ -1876,7 +1875,7 @@ void OOXMLFastContextHandlerTextTableRow::endRow()
+     startCharacterGroup();
+ 
+     if (isForwardEvents())
+-        mpStream->utext(s0xd, 1);
++        mpStream->utext((const sal_uInt8*)&uCR, 1);
+ 
+     endCharacterGroup();
+     endParagraphGroup();
+-- 
+1.7.11.7
+
diff --git a/libreoffice.spec b/libreoffice.spec
index f4b550b..3117471 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -44,7 +44,7 @@ Summary:        Free Software Productivity Suite
 Name:           libreoffice
 Epoch:          1
 Version:        %{libo_version}.1
-Release:        1%{?libo_prerelease}%{?dist}
+Release:        2%{?libo_prerelease}%{?dist}
 License:        (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0
 Group:          Applications/Productivity
 URL:            http://www.documentfoundation.org/develop
@@ -242,8 +242,7 @@ Patch22: 0003-drop-saxon-based-XSLT-transformer.patch
 Patch23: 0004-remove-all-traces-of-saxon.patch
 Patch24: 0001-do-not-strip-install-set.patch
 Patch25: 0001-Resolves-fdo-56198-collect-scrollbar-click-preferenc.patch
-#to-do, fix this on bigendian platforms
-Patch26: 0001-disable-failing-check.patch
+Patch26: 0001-bigendian-utext-mixup-triggering-regression-test-fai.patch
 Patch27: 0001-fiddle-system-db-test-to-link-on-RHEL-6.patch
 Patch28: 0001-split-qnametostr-up-to-try-and-make-.o-s-small-enoug.patch
 %if 0%{?rhel} && 0%{?rhel} < 7
@@ -898,7 +897,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch23 -p1 -b .remove-all-traces-of-saxon.patch
 %patch24 -p1 -b .do-not-strip-install-set.patch
 %patch25 -p1 -b .fdo-56198-collect-scrollbar-click-preferenc.patch
-%patch26 -p1 -b .disable-failing-check.patch
+%patch26 -p1 -b .bigendian-utext-mixup-triggering-regression-test-fai.patch
 %patch27 -p1 -b .fiddle-system-db-test-to-link-on-RHEL-6.patch
 %patch28 -p1 -b .split-qnametostr-up-to-try-and-make-.o-s-small-enoug.patch
 %if 0%{?rhel} && 0%{?rhel} < 7
@@ -2176,6 +2175,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %endif
 
 %changelog
+* Wed Nov 28 2012 Caolán McNamara <caolanm at redhat.com> - 1:3.6.4.1-2
+- fix docx import on big endian
+
 * Sun Nov 18 2012 David Tardon <dtardon at redhat.com> - 1:3.6.4.1-1
 - 3.6.4 rc1
 


More information about the scm-commits mailing list