summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-01-17 19:02:47 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-01-20 09:06:51 +0100
commitabf133355ffa6a3cda1e44969cd0716cab4f6e61 (patch)
tree4369bc01ad2f1297a157bc5cdea79712db1eb8ea /sax
parent5ef1d9ff36e40ca24a6d3de15543481ee8b1cb58 (diff)
Some more loplugin:cstylecast: sax
Change-Id: I3ded4f19f73a094dabd2d2da54917290ffe468f5
Diffstat (limited to 'sax')
-rw-r--r--sax/qa/cppunit/parser.cxx2
-rw-r--r--sax/source/expatwrap/sax_expat.cxx4
-rw-r--r--sax/source/expatwrap/saxwriter.cxx22
-rw-r--r--sax/source/expatwrap/xml2utf.cxx24
-rw-r--r--sax/source/fastparser/fastparser.cxx2
-rw-r--r--sax/source/tools/fastattribs.cxx2
6 files changed, 28 insertions, 28 deletions
diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx
index 5669d0f0bb92..824d5ecd7078 100644
--- a/sax/qa/cppunit/parser.cxx
+++ b/sax/qa/cppunit/parser.cxx
@@ -79,7 +79,7 @@ uno::Reference< io::XInputStream > ParserTest::createStream(const OString& sInpu
{
uno::Reference< io::XOutputStream > xPipe( io::Pipe::create(m_xContext) );
uno::Reference< io::XInputStream > xInStream( xPipe, uno::UNO_QUERY );
- uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)sInput.getStr(), sInput.getLength() );
+ uno::Sequence< sal_Int8 > aSeq( reinterpret_cast<sal_Int8 const *>(sInput.getStr()), sInput.getLength() );
xPipe->writeBytes( aSeq );
xPipe->flush();
xPipe->closeOutput();
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 8a2c0c56deac..df1870e66328 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -709,14 +709,14 @@ void SaxExpatParser_Impl::parse( )
if( ! nRead ) {
XML_Parse( getEntity().pParser ,
- ( const char * ) seqOut.getArray() ,
+ reinterpret_cast<const char *>(seqOut.getConstArray()),
0 ,
1 );
break;
}
bool bContinue = ( XML_Parse( getEntity().pParser ,
- (const char *) seqOut.getArray(),
+ reinterpret_cast<const char *>(seqOut.getConstArray()),
nRead,
0 ) != XML_STATUS_ERROR );
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 0e8250b7bb1d..2c59889cc479 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -258,7 +258,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '&': // resemble to &amp;
{
if ((rPos + 5) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&amp;", 5);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&amp;"), 5);
else
{
memcpy( &(pTarget[rPos]) , "&amp;", 5 );
@@ -269,7 +269,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '<':
{
if ((rPos + 4) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&lt;", 4);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&lt;"), 4);
else
{
memcpy( &(pTarget[rPos]) , "&lt;" , 4 );
@@ -280,7 +280,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '>':
{
if ((rPos + 4) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&gt;", 4);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&gt;"), 4);
else
{
memcpy( &(pTarget[rPos]) , "&gt;" , 4 );
@@ -291,7 +291,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case 39: // 39 == '''
{
if ((rPos + 6) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&apos;", 6);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&apos;"), 6);
else
{
memcpy( &(pTarget[rPos]) , "&apos;" , 6 );
@@ -302,7 +302,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '"':
{
if ((rPos + 6) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&quot;", 6);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&quot;"), 6);
else
{
memcpy( &(pTarget[rPos]) , "&quot;" , 6 );
@@ -313,7 +313,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case 13:
{
if ((rPos + 6) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&#x0d;", 6);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&#x0d;"), 6);
else
{
memcpy( &(pTarget[rPos]) , "&#x0d;" , 6 );
@@ -326,7 +326,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
if( bNormalizeWhitespace )
{
if ((rPos + 6) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&#x0a;" , 6);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&#x0a;"), 6);
else
{
memcpy( &(pTarget[rPos]) , "&#x0a;" , 6 );
@@ -346,7 +346,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
if( bNormalizeWhitespace )
{
if ((rPos + 6) > SEQUENCESIZE)
- AddBytes(pTarget, rPos, (sal_Int8*)"&#x09;" , 6);
+ AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&#x09;"), 6);
else
{
memcpy( &(pTarget[rPos]) , "&#x09;" , 6 );
@@ -537,7 +537,7 @@ inline void SaxWriterHelper::startDocument() throw( SAXException )
}
else
{
- AddBytes(mp_Sequence, nCurrentPos, (sal_Int8*)pc, nLen);
+ AddBytes(mp_Sequence, nCurrentPos, reinterpret_cast<sal_Int8 const *>(pc), nLen);
}
OSL_ENSURE(nCurrentPos <= SEQUENCESIZE, "not reset current position");
if (nCurrentPos == SEQUENCESIZE)
@@ -716,7 +716,7 @@ inline void SaxWriterHelper::startCDATA() throw( SAXException )
nCurrentPos += 9;
}
else
- AddBytes(mp_Sequence, nCurrentPos, (sal_Int8*)"<![CDATA[" , 9);
+ AddBytes(mp_Sequence, nCurrentPos, reinterpret_cast<sal_Int8 const *>("<![CDATA["), 9);
if (nCurrentPos == SEQUENCESIZE)
nCurrentPos = writeSequence();
}
@@ -730,7 +730,7 @@ inline void SaxWriterHelper::endCDATA() throw( SAXException )
nCurrentPos += 3;
}
else
- AddBytes(mp_Sequence, nCurrentPos, (sal_Int8*)"]]>" , 3);
+ AddBytes(mp_Sequence, nCurrentPos, reinterpret_cast<sal_Int8 const *>("]]>"), 3);
if (nCurrentPos == SEQUENCESIZE)
nCurrentPos = writeSequence();
}
diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx
index a868c9b471dc..aca05ed937d8 100644
--- a/sax/source/expatwrap/xml2utf.cxx
+++ b/sax/source/expatwrap/xml2utf.cxx
@@ -128,11 +128,11 @@ XMLFile2UTFConverter::~XMLFile2UTFConverter()
void XMLFile2UTFConverter::removeEncoding( Sequence<sal_Int8> &seq )
{
const sal_Int8 *pSource = seq.getArray();
- if( ! strncmp( (const char * ) pSource , "<?xml" , 4) )
+ if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4) )
{
// scan for encoding
- OString str( (sal_Char * ) pSource , seq.getLength() );
+ OString str( reinterpret_cast<char const *>(pSource), seq.getLength() );
// cut sequence to first line break
// find first line break;
@@ -180,7 +180,7 @@ bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &s
return false;
}
- if( ! strncmp( (const char * ) pSource , "<?xml" , 4 ) ) {
+ if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4 ) ) {
// scan if the <?xml tag finishes within this buffer
bCheckIfFirstClosingBracketExsists = true;
}
@@ -225,10 +225,10 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
}
// first level : detect possible file formats
- if( ! strncmp( (const char * ) pSource , "<?xml" , 4 ) ) {
+ if( ! strncmp( reinterpret_cast<const char *>(pSource), "<?xml", 4 ) ) {
// scan for encoding
- OString str( (const sal_Char *) pSource , seq.getLength() );
+ OString str( reinterpret_cast<const char *>(pSource), seq.getLength() );
// cut sequence to first line break
//find first line break;
@@ -277,8 +277,8 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
// simply add the byte order mark !
seq.realloc( seq.getLength() + 2 );
memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() - 2 );
- ((sal_uInt8*)seq.getArray())[0] = 0xFE;
- ((sal_uInt8*)seq.getArray())[1] = 0xFF;
+ reinterpret_cast<sal_uInt8*>(seq.getArray())[0] = 0xFE;
+ reinterpret_cast<sal_uInt8*>(seq.getArray())[1] = 0xFF;
m_sEncoding = "utf-16";
}
@@ -288,8 +288,8 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
seq.realloc( seq.getLength() + 2 );
memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() - 2 );
- ((sal_uInt8*)seq.getArray())[0] = 0xFF;
- ((sal_uInt8*)seq.getArray())[1] = 0xFE;
+ reinterpret_cast<sal_uInt8*>(seq.getArray())[0] = 0xFF;
+ reinterpret_cast<sal_uInt8*>(seq.getArray())[1] = 0xFE;
m_sEncoding = "utf-16";
}
@@ -416,7 +416,7 @@ Sequence<sal_Unicode> Text2UnicodeConverter::convert( const Sequence<sal_Int8> &
nTargetCount += rtl_convertTextToUnicode(
m_convText2Unicode,
m_contextText2Unicode,
- ( const sal_Char * ) &( pbSource[nSourceCount] ),
+ reinterpret_cast<const char *>(&( pbSource[nSourceCount] )),
nSourceSize - nSourceCount ,
&( seqUnicode.getArray()[ nTargetCount ] ),
seqUnicode.getLength() - nTargetCount,
@@ -504,7 +504,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource ,
sal_Int32 nSeqSize = nSourceSize * 3;
Sequence<sal_Int8> seqText( nSeqSize );
- sal_Char *pTarget = (sal_Char *) seqText.getArray();
+ sal_Char *pTarget = reinterpret_cast<char *>(seqText.getArray());
while( true ) {
nTargetCount += rtl_convertUnicodeToText(
@@ -523,7 +523,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource ,
if( uiInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL ) {
nSeqSize = nSeqSize *2;
seqText.realloc( nSeqSize ); // double array size
- pTarget = ( sal_Char * ) seqText.getArray();
+ pTarget = reinterpret_cast<char *>(seqText.getArray());
continue;
}
break;
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index d586e3520d78..de5a5ea872a9 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -997,7 +997,7 @@ void FastSaxParserImpl::parse()
{
if( rEntity.mpParser != NULL )
{
- if( xmlParseChunk( rEntity.mpParser, (const char*) seqOut.getConstArray(), 0, 1 ) != XML_ERR_OK )
+ if( xmlParseChunk( rEntity.mpParser, reinterpret_cast<const char*>(seqOut.getConstArray()), 0, 1 ) != XML_ERR_OK )
rEntity.throwException( mxDocumentLocator, true );
}
break;
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index d32f484632aa..c1a3e1c14fff 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -243,7 +243,7 @@ sal_Int32 FastTokenHandlerBase::getTokenFromChars(
else
{
// heap allocate, copy & then free
- Sequence< sal_Int8 > aSeq( (sal_Int8*)pToken, nLen );
+ Sequence< sal_Int8 > aSeq( reinterpret_cast<sal_Int8 const *>(pToken), nLen );
nRet = xTokenHandler->getTokenFromUTF8( aSeq );
}