Kaydet (Commit) abf13335 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some more loplugin:cstylecast: sax

Change-Id: I3ded4f19f73a094dabd2d2da54917290ffe468f5
üst 5ef1d9ff
...@@ -79,7 +79,7 @@ uno::Reference< io::XInputStream > ParserTest::createStream(const OString& sInpu ...@@ -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::XOutputStream > xPipe( io::Pipe::create(m_xContext) );
uno::Reference< io::XInputStream > xInStream( xPipe, uno::UNO_QUERY ); 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->writeBytes( aSeq );
xPipe->flush(); xPipe->flush();
xPipe->closeOutput(); xPipe->closeOutput();
......
...@@ -709,14 +709,14 @@ void SaxExpatParser_Impl::parse( ) ...@@ -709,14 +709,14 @@ void SaxExpatParser_Impl::parse( )
if( ! nRead ) { if( ! nRead ) {
XML_Parse( getEntity().pParser , XML_Parse( getEntity().pParser ,
( const char * ) seqOut.getArray() , reinterpret_cast<const char *>(seqOut.getConstArray()),
0 , 0 ,
1 ); 1 );
break; break;
} }
bool bContinue = ( XML_Parse( getEntity().pParser , bool bContinue = ( XML_Parse( getEntity().pParser ,
(const char *) seqOut.getArray(), reinterpret_cast<const char *>(seqOut.getConstArray()),
nRead, nRead,
0 ) != XML_STATUS_ERROR ); 0 ) != XML_STATUS_ERROR );
......
...@@ -258,7 +258,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -258,7 +258,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '&': // resemble to &amp; case '&': // resemble to &amp;
{ {
if ((rPos + 5) > SEQUENCESIZE) if ((rPos + 5) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&amp;", 5); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&amp;"), 5);
else else
{ {
memcpy( &(pTarget[rPos]) , "&amp;", 5 ); memcpy( &(pTarget[rPos]) , "&amp;", 5 );
...@@ -269,7 +269,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -269,7 +269,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '<': case '<':
{ {
if ((rPos + 4) > SEQUENCESIZE) if ((rPos + 4) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&lt;", 4); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&lt;"), 4);
else else
{ {
memcpy( &(pTarget[rPos]) , "&lt;" , 4 ); memcpy( &(pTarget[rPos]) , "&lt;" , 4 );
...@@ -280,7 +280,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -280,7 +280,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '>': case '>':
{ {
if ((rPos + 4) > SEQUENCESIZE) if ((rPos + 4) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&gt;", 4); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&gt;"), 4);
else else
{ {
memcpy( &(pTarget[rPos]) , "&gt;" , 4 ); memcpy( &(pTarget[rPos]) , "&gt;" , 4 );
...@@ -291,7 +291,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -291,7 +291,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case 39: // 39 == ''' case 39: // 39 == '''
{ {
if ((rPos + 6) > SEQUENCESIZE) if ((rPos + 6) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&apos;", 6); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&apos;"), 6);
else else
{ {
memcpy( &(pTarget[rPos]) , "&apos;" , 6 ); memcpy( &(pTarget[rPos]) , "&apos;" , 6 );
...@@ -302,7 +302,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -302,7 +302,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case '"': case '"':
{ {
if ((rPos + 6) > SEQUENCESIZE) if ((rPos + 6) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&quot;", 6); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&quot;"), 6);
else else
{ {
memcpy( &(pTarget[rPos]) , "&quot;" , 6 ); memcpy( &(pTarget[rPos]) , "&quot;" , 6 );
...@@ -313,7 +313,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -313,7 +313,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
case 13: case 13:
{ {
if ((rPos + 6) > SEQUENCESIZE) if ((rPos + 6) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&#x0d;", 6); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&#x0d;"), 6);
else else
{ {
memcpy( &(pTarget[rPos]) , "&#x0d;" , 6 ); memcpy( &(pTarget[rPos]) , "&#x0d;" , 6 );
...@@ -326,7 +326,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -326,7 +326,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
if( bNormalizeWhitespace ) if( bNormalizeWhitespace )
{ {
if ((rPos + 6) > SEQUENCESIZE) if ((rPos + 6) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&#x0a;" , 6); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&#x0a;"), 6);
else else
{ {
memcpy( &(pTarget[rPos]) , "&#x0a;" , 6 ); memcpy( &(pTarget[rPos]) , "&#x0a;" , 6 );
...@@ -346,7 +346,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr, ...@@ -346,7 +346,7 @@ inline bool SaxWriterHelper::convertToXML( const sal_Unicode * pStr,
if( bNormalizeWhitespace ) if( bNormalizeWhitespace )
{ {
if ((rPos + 6) > SEQUENCESIZE) if ((rPos + 6) > SEQUENCESIZE)
AddBytes(pTarget, rPos, (sal_Int8*)"&#x09;" , 6); AddBytes(pTarget, rPos, reinterpret_cast<sal_Int8 const *>("&#x09;"), 6);
else else
{ {
memcpy( &(pTarget[rPos]) , "&#x09;" , 6 ); memcpy( &(pTarget[rPos]) , "&#x09;" , 6 );
...@@ -537,7 +537,7 @@ inline void SaxWriterHelper::startDocument() throw( SAXException ) ...@@ -537,7 +537,7 @@ inline void SaxWriterHelper::startDocument() throw( SAXException )
} }
else 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"); OSL_ENSURE(nCurrentPos <= SEQUENCESIZE, "not reset current position");
if (nCurrentPos == SEQUENCESIZE) if (nCurrentPos == SEQUENCESIZE)
...@@ -716,7 +716,7 @@ inline void SaxWriterHelper::startCDATA() throw( SAXException ) ...@@ -716,7 +716,7 @@ inline void SaxWriterHelper::startCDATA() throw( SAXException )
nCurrentPos += 9; nCurrentPos += 9;
} }
else else
AddBytes(mp_Sequence, nCurrentPos, (sal_Int8*)"<![CDATA[" , 9); AddBytes(mp_Sequence, nCurrentPos, reinterpret_cast<sal_Int8 const *>("<![CDATA["), 9);
if (nCurrentPos == SEQUENCESIZE) if (nCurrentPos == SEQUENCESIZE)
nCurrentPos = writeSequence(); nCurrentPos = writeSequence();
} }
...@@ -730,7 +730,7 @@ inline void SaxWriterHelper::endCDATA() throw( SAXException ) ...@@ -730,7 +730,7 @@ inline void SaxWriterHelper::endCDATA() throw( SAXException )
nCurrentPos += 3; nCurrentPos += 3;
} }
else else
AddBytes(mp_Sequence, nCurrentPos, (sal_Int8*)"]]>" , 3); AddBytes(mp_Sequence, nCurrentPos, reinterpret_cast<sal_Int8 const *>("]]>"), 3);
if (nCurrentPos == SEQUENCESIZE) if (nCurrentPos == SEQUENCESIZE)
nCurrentPos = writeSequence(); nCurrentPos = writeSequence();
} }
......
...@@ -128,11 +128,11 @@ XMLFile2UTFConverter::~XMLFile2UTFConverter() ...@@ -128,11 +128,11 @@ XMLFile2UTFConverter::~XMLFile2UTFConverter()
void XMLFile2UTFConverter::removeEncoding( Sequence<sal_Int8> &seq ) void XMLFile2UTFConverter::removeEncoding( Sequence<sal_Int8> &seq )
{ {
const sal_Int8 *pSource = seq.getArray(); 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 // 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 // cut sequence to first line break
// find first line break; // find first line break;
...@@ -180,7 +180,7 @@ bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &s ...@@ -180,7 +180,7 @@ bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &s
return false; 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 // scan if the <?xml tag finishes within this buffer
bCheckIfFirstClosingBracketExsists = true; bCheckIfFirstClosingBracketExsists = true;
} }
...@@ -225,10 +225,10 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq ) ...@@ -225,10 +225,10 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
} }
// first level : detect possible file formats // 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 // 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 // cut sequence to first line break
//find first line break; //find first line break;
...@@ -277,8 +277,8 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq ) ...@@ -277,8 +277,8 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
// simply add the byte order mark ! // simply add the byte order mark !
seq.realloc( seq.getLength() + 2 ); seq.realloc( seq.getLength() + 2 );
memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() - 2 ); memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() - 2 );
((sal_uInt8*)seq.getArray())[0] = 0xFE; reinterpret_cast<sal_uInt8*>(seq.getArray())[0] = 0xFE;
((sal_uInt8*)seq.getArray())[1] = 0xFF; reinterpret_cast<sal_uInt8*>(seq.getArray())[1] = 0xFF;
m_sEncoding = "utf-16"; m_sEncoding = "utf-16";
} }
...@@ -288,8 +288,8 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq ) ...@@ -288,8 +288,8 @@ bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
seq.realloc( seq.getLength() + 2 ); seq.realloc( seq.getLength() + 2 );
memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() - 2 ); memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() - 2 );
((sal_uInt8*)seq.getArray())[0] = 0xFF; reinterpret_cast<sal_uInt8*>(seq.getArray())[0] = 0xFF;
((sal_uInt8*)seq.getArray())[1] = 0xFE; reinterpret_cast<sal_uInt8*>(seq.getArray())[1] = 0xFE;
m_sEncoding = "utf-16"; m_sEncoding = "utf-16";
} }
...@@ -416,7 +416,7 @@ Sequence<sal_Unicode> Text2UnicodeConverter::convert( const Sequence<sal_Int8> & ...@@ -416,7 +416,7 @@ Sequence<sal_Unicode> Text2UnicodeConverter::convert( const Sequence<sal_Int8> &
nTargetCount += rtl_convertTextToUnicode( nTargetCount += rtl_convertTextToUnicode(
m_convText2Unicode, m_convText2Unicode,
m_contextText2Unicode, m_contextText2Unicode,
( const sal_Char * ) &( pbSource[nSourceCount] ), reinterpret_cast<const char *>(&( pbSource[nSourceCount] )),
nSourceSize - nSourceCount , nSourceSize - nSourceCount ,
&( seqUnicode.getArray()[ nTargetCount ] ), &( seqUnicode.getArray()[ nTargetCount ] ),
seqUnicode.getLength() - nTargetCount, seqUnicode.getLength() - nTargetCount,
...@@ -504,7 +504,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource , ...@@ -504,7 +504,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource ,
sal_Int32 nSeqSize = nSourceSize * 3; sal_Int32 nSeqSize = nSourceSize * 3;
Sequence<sal_Int8> seqText( nSeqSize ); Sequence<sal_Int8> seqText( nSeqSize );
sal_Char *pTarget = (sal_Char *) seqText.getArray(); sal_Char *pTarget = reinterpret_cast<char *>(seqText.getArray());
while( true ) { while( true ) {
nTargetCount += rtl_convertUnicodeToText( nTargetCount += rtl_convertUnicodeToText(
...@@ -523,7 +523,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource , ...@@ -523,7 +523,7 @@ Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource ,
if( uiInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL ) { if( uiInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL ) {
nSeqSize = nSeqSize *2; nSeqSize = nSeqSize *2;
seqText.realloc( nSeqSize ); // double array size seqText.realloc( nSeqSize ); // double array size
pTarget = ( sal_Char * ) seqText.getArray(); pTarget = reinterpret_cast<char *>(seqText.getArray());
continue; continue;
} }
break; break;
......
...@@ -997,7 +997,7 @@ void FastSaxParserImpl::parse() ...@@ -997,7 +997,7 @@ void FastSaxParserImpl::parse()
{ {
if( rEntity.mpParser != NULL ) 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 ); rEntity.throwException( mxDocumentLocator, true );
} }
break; break;
......
...@@ -243,7 +243,7 @@ sal_Int32 FastTokenHandlerBase::getTokenFromChars( ...@@ -243,7 +243,7 @@ sal_Int32 FastTokenHandlerBase::getTokenFromChars(
else else
{ {
// heap allocate, copy & then free // 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 ); nRet = xTokenHandler->getTokenFromUTF8( aSeq );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment