summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-05-15 09:59:18 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-05-16 06:46:29 +0000
commit53d40e18515c78e59583f1f8fadc82ffa2ab9e32 (patch)
tree9026c2b72fe2853608d7ff40de198b2a8fdd44e0 /writerfilter
parentdc6c363f0c7fec8be700b272ea94eebc8e3534a9 (diff)
fdo#62977 allow SAL_MAX_INT16..SAL_MAX_UINT16 when importing RTF_U
(cherry picked from commit 4a816a816e8b4e213394898bd0e307dd90fcbb64) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx Change-Id: Ie36d5881b0ebe8c38526690ca27d02bfb7af7829 Reviewed-on: https://gerrit.libreoffice.org/3913 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0a2348d89311..056ac08b60e9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2971,7 +2971,10 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aStates.top().nUc = nParam;
break;
case RTF_U:
- if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16))
+ // sal_Unicode is unsigned 16-bit, RTF may represent that as a
+ // signed SAL_MIN_INT16..SAL_MAX_INT16 or 0..SAL_MAX_UINT16. The
+ // static_cast() will do the right thing.
+ if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16))
{
m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam));
m_aStates.top().nCharsToSkip = m_aStates.top().nUc;