diff options
Diffstat (limited to 'src/rtfparser.cpp')
-rw-r--r-- | src/rtfparser.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rtfparser.cpp b/src/rtfparser.cpp index 336847f..589ef71 100644 --- a/src/rtfparser.cpp +++ b/src/rtfparser.cpp @@ -60,7 +60,10 @@ void RtfReader::sendData(RtfContext& cx, wstring data) { if(m_uniEat > 0) { - int len = __min(data.size(), m_uniEat); + int len = data.size(); + if(len > m_uniEat) + len = m_uniEat; + cx.data.append(data.substr(len)); m_uniEat -= len; } @@ -134,11 +137,11 @@ bool RtfReader::parseControlWord(RtfContext& cx) // NOTE: Although the RTF specification prohibits upercase // control words, MS Word uses them :-/ if(ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') - controlword.append(1, ch); + controlword.append(1, (char)ch); // Part of the parameter of a control word else if(ch >= '0' && ch <= '9') - param.append(1, ch); + param.append(1, (char)ch); // Now handle escapes and other special types of // control words. These are all only valid at beginning @@ -199,7 +202,7 @@ bool RtfReader::parseControlWord(RtfContext& cx) // a hyphen right after control word is part of number else if(!empty && param.empty() && ch == '-') { - param.append(1, ch); + param.append(1, (char)ch); } // TODO: This looks real hokey and acts that @@ -399,4 +402,3 @@ done: return m_parseErrors.empty(); } - |