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
{
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();
......
......@@ -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 );
......
......@@ -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();
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 );
}
......
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