mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-06-07 07:03:41 +00:00
Merge pull request #272 from Dmitry-Me/properTreatStrchrPostConditions
strchr() can only find what is was asked for
This commit is contained in:
commit
ba7d9df976
11
tinyxml2.cpp
11
tinyxml2.cpp
@ -353,6 +353,7 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
|
|||||||
unsigned long ucs = 0;
|
unsigned long ucs = 0;
|
||||||
ptrdiff_t delta = 0;
|
ptrdiff_t delta = 0;
|
||||||
unsigned mult = 1;
|
unsigned mult = 1;
|
||||||
|
const char semicolon = ';';
|
||||||
|
|
||||||
if ( *(p+2) == 'x' ) {
|
if ( *(p+2) == 'x' ) {
|
||||||
// Hexadecimal.
|
// Hexadecimal.
|
||||||
@ -361,11 +362,12 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* q = p+3;
|
const char* q = p+3;
|
||||||
q = strchr( q, ';' );
|
q = strchr( q, semicolon );
|
||||||
|
|
||||||
if ( !q || !*q ) {
|
if ( !q ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
TIXMLASSERT( *q == semicolon );
|
||||||
|
|
||||||
delta = q-p;
|
delta = q-p;
|
||||||
--q;
|
--q;
|
||||||
@ -394,11 +396,12 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* q = p+2;
|
const char* q = p+2;
|
||||||
q = strchr( q, ';' );
|
q = strchr( q, semicolon );
|
||||||
|
|
||||||
if ( !q || !*q ) {
|
if ( !q ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
TIXMLASSERT( *q == semicolon );
|
||||||
|
|
||||||
delta = q-p;
|
delta = q-p;
|
||||||
--q;
|
--q;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user