From 8f1069afd65d60704f4e81cfb905a8134c66781f Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Fri, 9 Sep 2011 12:54:10 +0200 Subject: Some cosmetical fixes --- src/lib/VSD11Parser.cpp | 4 ++-- src/lib/VSDXContentCollector.cpp | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib/VSD11Parser.cpp b/src/lib/VSD11Parser.cpp index 665f0fb..fbd50a8 100644 --- a/src/lib/VSD11Parser.cpp +++ b/src/lib/VSD11Parser.cpp @@ -114,7 +114,7 @@ void libvisio::VSD11Parser::readText(WPXInputStream *input) void libvisio::VSD11Parser::readCharIX(WPXInputStream *input) { - WPXString fontFace = "Arial"; + WPXString fontFace("Arial"); unsigned charCount = readU32(input); unsigned short fontID = readU16(input); input->seek(1, WPX_SEEK_CUR); // Color ID @@ -216,7 +216,7 @@ void libvisio::VSD11Parser::readFillStyle(WPXInputStream *input) void libvisio::VSD11Parser::readCharIXStyle(WPXInputStream *input) { - WPXString fontFace = "Arial"; + WPXString fontFace("Arial"); unsigned charCount = readU32(input); unsigned short fontID = readU16(input); input->seek(1, WPX_SEEK_CUR); // Color ID diff --git a/src/lib/VSDXContentCollector.cpp b/src/lib/VSDXContentCollector.cpp index 3f7050f..9b1fcb9 100644 --- a/src/lib/VSDXContentCollector.cpp +++ b/src/lib/VSDXContentCollector.cpp @@ -148,7 +148,18 @@ void libvisio::VSDXContentCollector::_flushText() { text.clear(); - if (m_textFormat == VSD_TEXT_ANSI) + if (m_textFormat == VSD_TEXT_UTF16) + { + unsigned long max = m_charFormats[i].charCount <= (m_textStream.size()/2) ? m_charFormats[i].charCount : (m_textStream.size()/2); + VSD_DEBUG_MSG(("Charcount: %d, max: %lu, stream size: %lu\n", m_charFormats[i].charCount, max, (unsigned long)m_textStream.size())); + max = (m_charFormats[i].charCount == 0 && m_textStream.size()) ? m_textStream.size()/2 : max; + VSD_DEBUG_MSG(("Charcount: %d, max: %lu, stream size: %lu\n", m_charFormats[i].charCount, max, (unsigned long)m_textStream.size())); + VSDInternalStream tmpStream(m_textStream, max*2); + _appendUTF16LE(text, &tmpStream); + + m_textStream.erase(m_textStream.begin(), m_textStream.begin() + (max*2)); + } + else { unsigned long max = m_charFormats[i].charCount <= m_textStream.size() ? m_charFormats[i].charCount : m_textStream.size(); max = (m_charFormats[i].charCount == 0 && m_textStream.size()) ? m_textStream.size() : max; @@ -162,17 +173,6 @@ void libvisio::VSDXContentCollector::_flushText() m_textStream.erase(m_textStream.begin(), m_textStream.begin() + max); } - else if (m_textFormat == VSD_TEXT_UTF16) - { - unsigned long max = m_charFormats[i].charCount <= (m_textStream.size()/2) ? m_charFormats[i].charCount : (m_textStream.size()/2); - VSD_DEBUG_MSG(("Charcount: %d, max: %lu, stream size: %lu\n", m_charFormats[i].charCount, max, (unsigned long)m_textStream.size())); - max = (m_charFormats[i].charCount == 0 && m_textStream.size()) ? m_textStream.size()/2 : max; - VSD_DEBUG_MSG(("Charcount: %d, max: %lu, stream size: %lu\n", m_charFormats[i].charCount, max, (unsigned long)m_textStream.size())); - VSDInternalStream tmpStream(m_textStream, max*2); - _appendUTF16LE(text, &tmpStream); - - m_textStream.erase(m_textStream.begin(), m_textStream.begin() + (max*2)); - } WPXPropertyList textProps; if (m_fonts[m_charFormats[i].faceID] == "") textProps.insert("style:font-name", m_charFormats[i].face); -- cgit v1.2.3