summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-28 11:15:56 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-28 12:11:26 +0000
commit49f2a69fa7d8eaa23d77519ac29748f4dc3e4c5a (patch)
treefb7f27dfaf77b9fa019960c139010487efa972d3
parent38cc919efb965e7982d23d5b1c91a639cc2c6fdd (diff)
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
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.cxx51
1 files changed, 25 insertions, 26 deletions
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 920bf31faa94..c6f03bbde0ef 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();