From 5b4a5169e365fe0b85b78caa186fdf671b4972ec Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Tue, 23 Dec 2014 17:36:28 +0300 Subject: [PATCH] Move variable declaration closer to where it's needed --- tinyxml2.cpp | 2 +- tinyxml2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index f6e2584..e70c77d 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1861,7 +1861,6 @@ XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) XMLError XMLDocument::Parse( const char* p, size_t len ) { - const char* start = p; Clear(); if ( len == 0 || !p || !*p ) { @@ -1875,6 +1874,7 @@ XMLError XMLDocument::Parse( const char* p, size_t len ) memcpy( _charBuffer, p, len ); _charBuffer[len] = 0; + const char* start = p; p = XMLUtil::SkipWhiteSpace( p ); p = XMLUtil::ReadBOM( p, &_writeBOM ); if ( !p || !*p ) { diff --git a/tinyxml2.h b/tinyxml2.h index 35da4d9..b88e2d0 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -562,10 +562,10 @@ public: } inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { - int n = 0; if ( p == q ) { return true; } + int n = 0; while( *p && *q && *p == *q && n