mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-05-15 03:41:30 +00:00
Merge pull request #306 from Dmitry-Me/printSubstringEntirely
Print entire substring instead of each character
This commit is contained in:
commit
fb33e99a77
@ -2066,8 +2066,11 @@ void XMLPrinter::PrintString( const char* p, bool restricted )
|
|||||||
// entity, and keep looking.
|
// entity, and keep looking.
|
||||||
if ( flag[(unsigned char)(*q)] ) {
|
if ( flag[(unsigned char)(*q)] ) {
|
||||||
while ( p < q ) {
|
while ( p < q ) {
|
||||||
Print( "%c", *p );
|
const size_t delta = q - p;
|
||||||
++p;
|
// %.*s accepts type int as "precision"
|
||||||
|
const int toPrint = ( INT_MAX < delta ) ? INT_MAX : delta;
|
||||||
|
Print( "%.*s", toPrint, p );
|
||||||
|
p += toPrint;
|
||||||
}
|
}
|
||||||
for( int i=0; i<NUM_ENTITIES; ++i ) {
|
for( int i=0; i<NUM_ENTITIES; ++i ) {
|
||||||
if ( entities[i].value == *q ) {
|
if ( entities[i].value == *q ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user