From bdb9ccd0d3e058d0555a73aca3cb01f7dd45b5a7 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 16 Oct 2006 19:37:18 +0000 Subject: Don't parse pictures in one big data block which is slow. --- src/rtfparser.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/rtfparser.cpp b/src/rtfparser.cpp index 6ba9abe..ccbf06e 100644 --- a/src/rtfparser.cpp +++ b/src/rtfparser.cpp @@ -43,6 +43,8 @@ #include "rtfparser.h" #include "internal.h" +const unsigned int MAX_CHUNK = 4096; + const wchar_t kAnsiToUnicode[] = { /* Moltly invalid, but used for wierd things in RTF anyway :( */ @@ -244,6 +246,9 @@ void RtfParser::sendData(wchar_t ch) else transcode16to8(ch, m_dataBuffer); + + if(m_dataBuffer.size() > MAX_CHUNK) + flushData(); } void RtfParser::sendData(const wstring& data) -- cgit v1.2.3