summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:17:24 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:17:24 +0100
commitacd1696a066b8fa6fb94a0613939565799413769 (patch)
tree31dac1c3922fe467e1771f514c3cca3d2e552ae3 /sax
parent681783c9adf85bde36348f11c03d3a483bf545be (diff)
More loplugin:cstylecast: sax
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ide5941d633fb3bf930b790d644154829b77ad117
Diffstat (limited to 'sax')
-rw-r--r--sax/qa/cppunit/attributes.cxx8
-rw-r--r--sax/qa/cppunit/test_converter.cxx4
-rw-r--r--sax/qa/cppunit/xmlimport.cxx2
-rw-r--r--sax/source/expatwrap/saxwriter.cxx8
-rw-r--r--sax/source/tools/converter.cxx14
-rw-r--r--sax/source/tools/fastattribs.cxx2
6 files changed, 19 insertions, 19 deletions
diff --git a/sax/qa/cppunit/attributes.cxx b/sax/qa/cppunit/attributes.cxx
index 15fdb31293b3..244da02eb535 100644
--- a/sax/qa/cppunit/attributes.cxx
+++ b/sax/qa/cppunit/attributes.cxx
@@ -55,15 +55,15 @@ void AttributesTest::test()
xAttributeList->addUnknown("a", "a");
xAttributeList->addUnknown("b", "b", "b");
xAttributeList->addUnknown("c", "c");
- CPPUNIT_ASSERT_EQUAL( (sal_Int32) 3, xAttributeList->getUnknownAttributes().getLength() );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(3), xAttributeList->getUnknownAttributes().getLength() );
- CPPUNIT_ASSERT_EQUAL( (sal_Int32) 2, xAttributeList->getFastAttributes().getLength() );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(2), xAttributeList->getFastAttributes().getLength() );
xAttributeList->clear();
CPPUNIT_ASSERT( !xAttributeList->hasAttribute(1) );
- CPPUNIT_ASSERT_EQUAL( (sal_Int32) 0, xAttributeList->getFastAttributes().getLength() );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(0), xAttributeList->getFastAttributes().getLength() );
xAttributeList->addUnknown("c", "c");
- CPPUNIT_ASSERT_EQUAL( (sal_Int32) 1, xAttributeList->getUnknownAttributes().getLength() );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32(1), xAttributeList->getUnknownAttributes().getLength() );
}
CPPUNIT_TEST_SUITE_REGISTRATION( AttributesTest );
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index d1ac259cc33c..1487acbb8607 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -160,7 +160,7 @@ void doTest(util::DateTime const & rdt, char const*const pis,
util::DateTime odt;
SAL_INFO("sax.cppunit","about to convert '" << is << "'");
bool bSuccess( Converter::parseDateTime(odt, is) );
- SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << (bool)odt.IsUTC);
+ SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << static_cast<bool>(odt.IsUTC));
CPPUNIT_ASSERT(bSuccess);
CPPUNIT_ASSERT(eqDateTime(rdt, odt));
OUStringBuffer buf;
@@ -254,7 +254,7 @@ void doTestTime(util::DateTime const & rdt, char const*const pis,
util::DateTime odt;
SAL_INFO("sax.cppunit","about to convert '" << is << "'");
bool bSuccess( Converter::parseTimeOrDateTime(odt, is) );
- SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << (bool)odt.IsUTC);
+ SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << static_cast<bool>(odt.IsUTC));
CPPUNIT_ASSERT(bSuccess);
CPPUNIT_ASSERT(eqDateTime(rdt, odt));
OUStringBuffer buf;
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index efaab5fabbc6..f7ea3ec92c19 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -316,7 +316,7 @@ sal_Int32 DummyTokenHandler::getTokenDirect( const char* pToken, sal_Int32 nLeng
for( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(tokens); i++ )
{
if ( tokens[i] == sToken )
- return (sal_Int32)i;
+ return static_cast<sal_Int32>(i);
}
return FastToken::DONTKNOW;
}
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index f84a7301dcfe..a9d8f280706c 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -141,7 +141,7 @@ public:
bool bNormalizeWhitespace);
sal_uInt32 GetLastColumnCount() const throw()
- { return (sal_uInt32)(nCurrentPos - nLastLineFeedPos); }
+ { return static_cast<sal_uInt32>(nCurrentPos - nLastLineFeedPos); }
/// @throws SAXException
inline void startDocument();
@@ -380,7 +380,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
break;
default:
{
- pTarget[rPos] = (sal_Int8)c;
+ pTarget[rPos] = static_cast<sal_Int8>(c);
rPos ++;
}
break;
@@ -388,8 +388,8 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
}
else
{
- pTarget[rPos] = (sal_Int8)c;
- if ((sal_Int8)c == LINEFEED)
+ pTarget[rPos] = static_cast<sal_Int8>(c);
+ if (static_cast<sal_Int8>(c) == LINEFEED)
nLastLineFeedPos = rPos;
rPos ++;
}
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index b824015d1126..d5618128a231 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -96,7 +96,7 @@ bool Converter::convertMeasure( sal_Int32& rValue,
{
// TODO: check overflow!
nDiv *= 10;
- nVal += ( ((double)(rString[nPos] - '0')) / nDiv );
+ nVal += ( static_cast<double>(rString[nPos] - '0') / nDiv );
nPos++;
}
}
@@ -255,12 +255,12 @@ bool Converter::convertMeasure( sal_Int32& rValue,
if( bNeg )
nVal = -nVal;
- if( nVal <= (double)nMin )
+ if( nVal <= static_cast<double>(nMin) )
rValue = nMin;
- else if( nVal >= (double)nMax )
+ else if( nVal >= static_cast<double>(nMax) )
rValue = nMax;
else
- rValue = (sal_Int32)nVal;
+ rValue = static_cast<sal_Int32>(nVal);
return true;
}
@@ -511,15 +511,15 @@ void Converter::convertColor( OUStringBuffer& rBuffer, sal_Int32 nColor )
{
rBuffer.append( '#' );
- sal_uInt8 nCol = (sal_uInt8)(nColor >> 16);
+ sal_uInt8 nCol = static_cast<sal_uInt8>(nColor >> 16);
rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
- nCol = (sal_uInt8)(nColor >> 8);
+ nCol = static_cast<sal_uInt8>(nColor >> 8);
rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
- nCol = (sal_uInt8)nColor;
+ nCol = static_cast<sal_uInt8>(nColor);
rBuffer.append( sal_Unicode( aHexTab[ nCol >> 4 ] ) );
rBuffer.append( sal_Unicode( aHexTab[ nCol & 0xf ] ) );
}
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 06fe66270b12..fa91125b2245 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -249,7 +249,7 @@ sal_Int32 FastTokenHandlerBase::getTokenFromChars(
nLen = strlen( pToken );
if( pTokenHandler )
- nRet = pTokenHandler->getTokenDirect( pToken, (sal_Int32) nLen );
+ nRet = pTokenHandler->getTokenDirect( pToken, static_cast<sal_Int32>(nLen) );
else
{
// heap allocate, copy & then free