From: Fridrich S. <str...@us...> - 2010-06-12 10:40:06
|
Update of /cvsroot/libwpd/libwpd2/src/lib In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv24542/src/lib Modified Files: WP6FontDescriptorPacket.cpp WP6FontDescriptorPacket.h Log Message: Making the _readFontName private member function and making getFontName return const reference to the WPXString Index: WP6FontDescriptorPacket.h =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP6FontDescriptorPacket.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- WP6FontDescriptorPacket.h 10 Jun 2010 11:52:46 -0000 1.14 +++ WP6FontDescriptorPacket.h 12 Jun 2010 10:39:58 -0000 1.15 @@ -30,15 +30,15 @@ class WP6FontDescriptorPacket : public WP6PrefixDataPacket { - public: +public: WP6FontDescriptorPacket(WPXInputStream *input, WPXEncryption *encryption, int id, uint32_t dataOffset, uint32_t dataSize); ~WP6FontDescriptorPacket(); void _readContents(WPXInputStream *input, WPXEncryption *encryption); - const char *getFontName() const { return m_fontName.cstr(); } + const WPXString &getFontName() const { return m_fontName; } - static void _readFontName(WPXInputStream *input, WPXEncryption *encryption, WPXString &fontName, uint16_t fontNameLength); +private: + void _readFontName(WPXInputStream *input, WPXEncryption *encryption); - private: WP6FontDescriptorPacket(const WP6FontDescriptorPacket&); WP6FontDescriptorPacket& operator=(const WP6FontDescriptorPacket&); uint16_t m_characterWidth; Index: WP6FontDescriptorPacket.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WP6FontDescriptorPacket.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- WP6FontDescriptorPacket.cpp 10 Jun 2010 11:52:46 -0000 1.37 +++ WP6FontDescriptorPacket.cpp 12 Jun 2010 10:39:58 -0000 1.38 @@ -88,16 +88,16 @@ m_fontNameLength = readU16(input, encryption); - _readFontName(input, encryption, m_fontName, m_fontNameLength); + _readFontName(input, encryption); } -void WP6FontDescriptorPacket::_readFontName(WPXInputStream *input, WPXEncryption *encryption, WPXString &fontName, uint16_t fontNameLength) +void WP6FontDescriptorPacket::_readFontName(WPXInputStream *input, WPXEncryption *encryption) { - if (fontNameLength > ((std::numeric_limits<uint16_t>::max)() / 2)) - fontNameLength = ((std::numeric_limits<uint16_t>::max)() / 2); - if (fontNameLength) + if (m_fontNameLength > ((std::numeric_limits<uint16_t>::max)() / 2)) + m_fontNameLength = ((std::numeric_limits<uint16_t>::max)() / 2); + if (m_fontNameLength) { - for (uint16_t i=0; i<(fontNameLength/2); i++) + for (uint16_t i=0; i<(m_fontNameLength/2); i++) { uint16_t charWord = readU16(input, encryption); uint8_t characterSet = (uint8_t)((charWord >> 8) & 0x00FF); @@ -110,11 +110,11 @@ int len = extendedCharacterWP6ToUCS2(character, characterSet, &chars); for (int j = 0; j < len; j++) - appendUCS4(fontName, (uint32_t)chars[j]); + appendUCS4(m_fontName, (uint32_t)chars[j]); } - WPD_DEBUG_MSG(("WordPerfect: stripping font name (original: %s)\n", fontName.cstr())); - std::string stringValue(fontName.cstr()); + WPD_DEBUG_MSG(("WordPerfect: stripping font name (original: %s)\n", m_fontName.cstr())); + std::string stringValue(m_fontName.cstr()); std::string::size_type pos; for (unsigned k = 0; k < countElements(FONT_WEIGHT_STRINGS); k++) { @@ -138,7 +138,7 @@ while ((pos = stringValue.find("-", stringValue.size() - 1)) != std::string::npos) stringValue.replace(pos, strlen("-"), ""); - fontName = WPXString(stringValue.c_str()); - WPD_DEBUG_MSG(("WordPerfect: stripping font name (final: %s)\n", fontName.cstr())); + m_fontName = WPXString(stringValue.c_str()); + WPD_DEBUG_MSG(("WordPerfect: stripping font name (final: %s)\n", m_fontName.cstr())); } } |