[Libreoffice-commits] libcdr.git: src/lib
Fridrich Å trba
fridrich.strba at bluewin.ch
Fri Apr 12 12:56:08 PDT 2013
src/lib/CDRParser.cpp | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
New commits:
commit f291b04aaef9f37bcbc046895fb9393ba303c55b
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Fri Apr 12 21:55:43 2013 +0200
Collapse two functions into one that is the other's only caller
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 1547d90..5ffe7df 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -128,13 +128,22 @@ static void processNameForEncoding(WPXString &name, unsigned short &encoding)
return;
}
-static void _processX6StyleString(const char *styleString, libcdr::CDRCharacterStyle &style)
+static void _readX6StyleString(WPXInputStream *input, unsigned length, libcdr::CDRCharacterStyle &style)
{
+ std::vector<unsigned char> styleBuffer(length);
+ unsigned long numBytesRead = 0;
+ const unsigned char *tmpBuffer = input->read(length, numBytesRead);
+ if (numBytesRead)
+ memcpy(&styleBuffer[0], tmpBuffer, numBytesRead);
+ WPXString styleString;
+ libcdr::appendCharacters(styleString, styleBuffer);
+ CDR_DEBUG_MSG(("CDRParser::_readX6StyleString - styleString = \"%s\"\n", styleString.cstr()));
+
boost::property_tree::ptree pt;
try
{
std::stringstream ss;
- ss << styleString;
+ ss << styleString.cstr();
boost::property_tree::read_json(ss, pt);
}
catch (...)
@@ -152,19 +161,6 @@ static void _processX6StyleString(const char *styleString, libcdr::CDRCharacterS
style.m_fontSize = (double)fontSize / 254000.0;
}
-static void _readX6StyleString(WPXInputStream *input, unsigned length, libcdr::CDRCharacterStyle &style)
-{
- std::vector<unsigned char> styleBuffer(length);
- unsigned long numBytesRead = 0;
- const unsigned char *tmpBuffer = input->read(length, numBytesRead);
- if (numBytesRead)
- memcpy(&styleBuffer[0], tmpBuffer, numBytesRead);
- WPXString styleString;
- libcdr::appendCharacters(styleString, styleBuffer);
- CDR_DEBUG_MSG(("CDRParser::_readX6StyleString - styleString = \"%s\"\n", styleString.cstr()));
- _processX6StyleString(styleString.cstr(), style);
-}
-
} // anonymous namespace
More information about the Libreoffice-commits
mailing list