|
|
@@ -101,9 +101,9 @@ distribution.
|
|
|
#endif
|
|
|
|
|
|
|
|
|
-static const char LINE_FEED = (char)0x0a; // all line endings are normalized to LF
|
|
|
+static const char LINE_FEED = static_cast<char>(0x0a); // all line endings are normalized to LF
|
|
|
static const char LF = LINE_FEED;
|
|
|
-static const char CARRIAGE_RETURN = (char)0x0d; // CR gets filtered out
|
|
|
+static const char CARRIAGE_RETURN = static_cast<char>(0x0d); // CR gets filtered out
|
|
|
static const char CR = CARRIAGE_RETURN;
|
|
|
static const char SINGLE_QUOTE = '\'';
|
|
|
static const char DOUBLE_QUOTE = '\"';
|
|
|
@@ -430,22 +430,22 @@ void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length
|
|
|
switch (*length) {
|
|
|
case 4:
|
|
|
--output;
|
|
|
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
|
|
+ *output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
|
|
|
input >>= 6;
|
|
|
//fall through
|
|
|
case 3:
|
|
|
--output;
|
|
|
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
|
|
+ *output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
|
|
|
input >>= 6;
|
|
|
//fall through
|
|
|
case 2:
|
|
|
--output;
|
|
|
- *output = (char)((input | BYTE_MARK) & BYTE_MASK);
|
|
|
+ *output = static_cast<char>((input | BYTE_MARK) & BYTE_MASK);
|
|
|
input >>= 6;
|
|
|
//fall through
|
|
|
case 1:
|
|
|
--output;
|
|
|
- *output = (char)(input | FIRST_BYTE_MARK[*length]);
|
|
|
+ *output = static_cast<char>(input | FIRST_BYTE_MARK[*length]);
|
|
|
break;
|
|
|
default:
|
|
|
TIXMLASSERT( false );
|
|
|
@@ -585,7 +585,7 @@ void XMLUtil::ToStr( double v, char* buffer, int bufferSize )
|
|
|
void XMLUtil::ToStr( int64_t v, char* buffer, int bufferSize )
|
|
|
{
|
|
|
// horrible syntax trick to make the compiler happy about %lld
|
|
|
- TIXML_SNPRINTF(buffer, bufferSize, "%lld", (long long)v);
|
|
|
+ TIXML_SNPRINTF(buffer, bufferSize, "%lld", static_cast<long long>(v));
|
|
|
}
|
|
|
|
|
|
void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize )
|
|
|
@@ -658,7 +658,7 @@ bool XMLUtil::ToInt64(const char* str, int64_t* value)
|
|
|
{
|
|
|
long long v = 0; // horrible syntax trick to make the compiler happy about %lld
|
|
|
if (TIXML_SSCANF(str, "%lld", &v) == 1) {
|
|
|
- *value = (int64_t)v;
|
|
|
+ *value = static_cast<int64_t>(v);
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
@@ -2264,7 +2264,7 @@ template
|
|
|
struct LongFitsIntoSizeTMinusOne {
|
|
|
static bool Fits( unsigned long value )
|
|
|
{
|
|
|
- return value < (size_t)-1;
|
|
|
+ return value < static_cast<size_t>(-1);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -2360,7 +2360,7 @@ XMLError XMLDocument::Parse( const char* p, size_t len )
|
|
|
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
|
|
|
return _errorID;
|
|
|
}
|
|
|
- if ( len == (size_t)(-1) ) {
|
|
|
+ if ( len == static_cast<size_t>(-1) ) {
|
|
|
len = strlen( p );
|
|
|
}
|
|
|
TIXMLASSERT( _charBuffer == 0 );
|
|
|
@@ -2494,13 +2494,13 @@ XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) :
|
|
|
}
|
|
|
for( int i=0; i<NUM_ENTITIES; ++i ) {
|
|
|
const char entityValue = entities[i].value;
|
|
|
- const unsigned char flagIndex = (unsigned char)entityValue;
|
|
|
+ const unsigned char flagIndex = static_cast<unsigned char>(entityValue);
|
|
|
TIXMLASSERT( flagIndex < ENTITY_RANGE );
|
|
|
_entityFlag[flagIndex] = true;
|
|
|
}
|
|
|
- _restrictedEntityFlag[(unsigned char)'&'] = true;
|
|
|
- _restrictedEntityFlag[(unsigned char)'<'] = true;
|
|
|
- _restrictedEntityFlag[(unsigned char)'>'] = true; // not required, but consistency is nice
|
|
|
+ _restrictedEntityFlag[static_cast<unsigned char>('&')] = true;
|
|
|
+ _restrictedEntityFlag[static_cast<unsigned char>('<')] = true;
|
|
|
+ _restrictedEntityFlag[static_cast<unsigned char>('>')] = true; // not required, but consistency is nice
|
|
|
_buffer.Push( 0 );
|
|
|
}
|
|
|
|
|
|
@@ -2575,10 +2575,10 @@ void XMLPrinter::PrintString( const char* p, bool restricted )
|
|
|
// Check for entities. If one is found, flush
|
|
|
// the stream up until the entity, write the
|
|
|
// entity, and keep looking.
|
|
|
- if ( flag[(unsigned char)(*q)] ) {
|
|
|
+ if ( flag[static_cast<unsigned char>(*q)] ) {
|
|
|
while ( p < q ) {
|
|
|
const size_t delta = q - p;
|
|
|
- const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (int)delta;
|
|
|
+ const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
|
|
|
Write( p, toPrint );
|
|
|
p += toPrint;
|
|
|
}
|
|
|
@@ -2606,7 +2606,7 @@ void XMLPrinter::PrintString( const char* p, bool restricted )
|
|
|
// string if an entity wasn't found.
|
|
|
if ( p < q ) {
|
|
|
const size_t delta = q - p;
|
|
|
- const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (int)delta;
|
|
|
+ const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
|
|
|
Write( p, toPrint );
|
|
|
}
|
|
|
}
|