MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / PrintString

Method PrintString

native/thirdpart/tinyxml2/tinyxml2.cpp:2631–2683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2629
2630
2631void XMLPrinter::PrintString( const char* p, bool restricted )
2632{
2633 // Look for runs of bytes between entities to print.
2634 const char* q = p;
2635
2636 if ( _processEntities ) {
2637 const bool* flag = restricted ? _restrictedEntityFlag : _entityFlag;
2638 while ( *q ) {
2639 TIXMLASSERT( p <= q );
2640 // Remember, char is sometimes signed. (How many times has that bitten me?)
2641 if ( *q > 0 && *q < ENTITY_RANGE ) {
2642 // Check for entities. If one is found, flush
2643 // the stream up until the entity, write the
2644 // entity, and keep looking.
2645 if ( flag[static_cast<unsigned char>(*q)] ) {
2646 while ( p < q ) {
2647 const size_t delta = q - p;
2648 const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
2649 Write( p, toPrint );
2650 p += toPrint;
2651 }
2652 bool entityPatternPrinted = false;
2653 for( int i=0; i<NUM_ENTITIES; ++i ) {
2654 if ( entities[i].value == *q ) {
2655 Putc( '&' );
2656 Write( entities[i].pattern, entities[i].length );
2657 Putc( ';' );
2658 entityPatternPrinted = true;
2659 break;
2660 }
2661 }
2662 if ( !entityPatternPrinted ) {
2663 // TIXMLASSERT( entityPatternPrinted ) causes gcc -Wunused-but-set-variable in release
2664 TIXMLASSERT( false );
2665 }
2666 ++p;
2667 }
2668 }
2669 ++q;
2670 TIXMLASSERT( p <= q );
2671 }
2672 // Flush the remaining string. This will be the entire
2673 // string if an entity wasn't found.
2674 if ( p < q ) {
2675 const size_t delta = q - p;
2676 const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast<int>(delta);
2677 Write( p, toPrint );
2678 }
2679 }
2680 else {
2681 Write( p );
2682 }
2683}
2684
2685
2686void XMLPrinter::PushHeader( bool writeBOM, bool writeDec )

Callers

nothing calls this directly

Calls 1

WriteFunction · 0.70

Tested by

no test coverage detected