[Libreoffice-commits] core.git: writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Dec 24 01:21:13 PST 2014
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 21 ++++++++++-----------
writerfilter/source/rtftok/rtflistener.hxx | 8 ++++----
writerfilter/source/rtftok/rtflookahead.cxx | 2 +-
writerfilter/source/rtftok/rtftokenizer.cxx | 6 +++---
4 files changed, 18 insertions(+), 19 deletions(-)
New commits:
commit c7da07ad5150d9c0d8e1a99b053009f103d792d9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Dec 24 10:20:30 2014 +0100
writerfilter: turn RTFInternalState into a C++11 scoped enumeration
Change-Id: I7407aeba6ddcfd783cee508faa6731c59d0b9759
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0664af6..66afbb4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -997,7 +997,7 @@ RTFError RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing
RTFError RTFDocumentImpl::resolveChars(char ch)
{
- if (m_aStates.top().nInternalState == INTERNAL_BIN)
+ if (m_aStates.top().nInternalState == RTFInternalState::BIN)
{
m_pBinaryData.reset(new SvMemoryStream());
m_pBinaryData->WriteChar(ch);
@@ -1006,7 +1006,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
Strm().ReadChar(ch);
m_pBinaryData->WriteChar(ch);
}
- m_aStates.top().nInternalState = INTERNAL_NORMAL;
+ m_aStates.top().nInternalState = RTFInternalState::NORMAL;
return RTFError::OK;
}
@@ -1016,10 +1016,9 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
bool bUnicodeChecked = false;
bool bSkipped = false;
- while (!Strm().IsEof() && (m_aStates.top().nInternalState == INTERNAL_HEX
- || (ch != '{' && ch != '}' && ch != '\\')))
+ while (!Strm().IsEof() && (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != '{' && ch != '}' && ch != '\\')))
{
- if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d && ch != 0x0a))
+ if (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != 0x0d && ch != 0x0a))
{
if (m_aStates.top().nCharsToSkip == 0)
{
@@ -1038,7 +1037,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
}
// read a single char if we're in hex mode
- if (m_aStates.top().nInternalState == INTERNAL_HEX)
+ if (m_aStates.top().nInternalState == RTFInternalState::HEX)
break;
if (RTL_TEXTENCODING_MS_932 == m_aStates.top().nCurrentEncoding)
@@ -1067,10 +1066,10 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
Strm().ReadChar(ch);
}
- if (m_aStates.top().nInternalState != INTERNAL_HEX && !Strm().IsEof())
+ if (m_aStates.top().nInternalState != RTFInternalState::HEX && !Strm().IsEof())
Strm().SeekRel(-1);
- if (m_aStates.top().nInternalState == INTERNAL_HEX && m_aStates.top().nDestinationState != DESTINATION_LEVELNUMBERS)
+ if (m_aStates.top().nInternalState == RTFInternalState::HEX && m_aStates.top().nDestinationState != DESTINATION_LEVELNUMBERS)
{
if (!bSkipped)
m_aHexBuffer.append(ch);
@@ -2185,7 +2184,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
}
break;
case RTF_HEXCHAR:
- m_aStates.top().nInternalState = INTERNAL_HEX;
+ m_aStates.top().nInternalState = RTFInternalState::HEX;
break;
case RTF_CELL:
case RTF_NESTCELL:
@@ -4526,7 +4525,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break;
case RTF_BIN:
{
- m_aStates.top().nInternalState = INTERNAL_BIN;
+ m_aStates.top().nInternalState = RTFInternalState::BIN;
m_aStates.top().nBinaryToRead = nParam;
}
break;
@@ -6135,7 +6134,7 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex)
RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
: m_pDocumentImpl(pDocumentImpl),
- nInternalState(INTERNAL_NORMAL),
+ nInternalState(RTFInternalState::NORMAL),
nDestinationState(DESTINATION_NORMAL),
nFieldStatus(FIELD_NONE),
nBorderState(BORDER_NONE),
diff --git a/writerfilter/source/rtftok/rtflistener.hxx b/writerfilter/source/rtftok/rtflistener.hxx
index f37064c..0715557 100644
--- a/writerfilter/source/rtftok/rtflistener.hxx
+++ b/writerfilter/source/rtftok/rtflistener.hxx
@@ -16,11 +16,11 @@ namespace writerfilter
{
namespace rtftok
{
-enum RTFInternalState
+enum class RTFInternalState
{
- INTERNAL_NORMAL,
- INTERNAL_BIN,
- INTERNAL_HEX
+ NORMAL,
+ BIN,
+ HEX
};
enum class RTFError
diff --git a/writerfilter/source/rtftok/rtflookahead.cxx b/writerfilter/source/rtftok/rtflookahead.cxx
index 00ab4a9..b90e8dd 100644
--- a/writerfilter/source/rtftok/rtflookahead.cxx
+++ b/writerfilter/source/rtftok/rtflookahead.cxx
@@ -93,7 +93,7 @@ void RTFLookahead::setDestinationState(RTFDestinationState /*nDestinationState*/
RTFInternalState RTFLookahead::getInternalState()
{
- return INTERNAL_NORMAL;
+ return RTFInternalState::NORMAL;
}
void RTFLookahead::setInternalState(RTFInternalState /*nInternalState*/)
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index fbcff42..85fc050 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -88,7 +88,7 @@ RTFError RTFTokenizer::resolveParse()
if (m_nGroup < 0)
return RTFError::GROUP_UNDER;
- if (m_nGroup > 0 && m_rImport.getInternalState() == INTERNAL_BIN)
+ if (m_nGroup > 0 && m_rImport.getInternalState() == RTFInternalState::BIN)
{
ret = m_rImport.resolveChars(ch);
if (ret != RTFError::OK)
@@ -129,7 +129,7 @@ RTFError RTFTokenizer::resolveParse()
default:
if (m_nGroup == 0)
return RTFError::CHAR_OVER;
- if (m_rImport.getInternalState() == INTERNAL_NORMAL)
+ if (m_rImport.getInternalState() == RTFInternalState::NORMAL)
{
ret = m_rImport.resolveChars(ch);
if (ret != RTFError::OK)
@@ -151,7 +151,7 @@ RTFError RTFTokenizer::resolveParse()
return ret;
count = 2;
b = 0;
- m_rImport.setInternalState(INTERNAL_NORMAL);
+ m_rImport.setInternalState(RTFInternalState::NORMAL);
}
}
break;
More information about the Libreoffice-commits
mailing list