summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-10-16 19:37:18 +0000
committerStef Walter <stef@memberwebs.com>2006-10-16 19:37:18 +0000
commitbdb9ccd0d3e058d0555a73aca3cb01f7dd45b5a7 (patch)
tree0442ce65bc7696fd80de647e9c006bf1037c3afe
parent8ef4da8da6cd9621f79d45a8ecaa59942102d252 (diff)
Don't parse pictures in one big data block which is slow.
-rw-r--r--ChangeLog2
-rw-r--r--src/rtfparser.cpp5
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5dc21a2..a7daeb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@ Version 0.9.7
- Don't let most characters below 0x0020 through. Old RTF's seem
to have these for strange reasons.
+ - Send data in chunks so massive amounts of picture data don't
+ slow down the conversion.
Version 0.9.6
- Add character styles
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)