Avoided modifying a constant string

This commit is contained in:
Zane U. Ji 2012-08-10 19:36:06 +08:00
parent 5894e44ac2
commit acbd505cfe
1 changed files with 2 additions and 6 deletions

View File

@ -45,12 +45,8 @@ void XMLCALL XslLocator::processingInstructionHandler (
if ( strcmp ( target, "xml-stylesheet" ) ) if ( strcmp ( target, "xml-stylesheet" ) )
return; return;
char *value, *iterator; const char *value, *iterator;
#ifdef __WXMSW__
value = strstr ( ( const char * ) data, "href=" ); value = strstr ( ( const char * ) data, "href=" );
#else
value = ( char *) strstr ( data, "href=" );
#endif
if ( !value || strlen ( value ) < 7 ) if ( !value || strlen ( value ) < 7 )
return; return;
value += 6; value += 6;
@ -63,7 +59,7 @@ void XMLCALL XslLocator::processingInstructionHandler (
} }
} }
d->xslLocation = std::string ( value, iterator - value ); d->xslLocation.assign( value, iterator - value );
XML_StopParser ( d->parser, false ); XML_StopParser ( d->parser, false );
} }