Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC - Static Code Analysis Warnings #36

Closed
ghost opened this issue Jun 30, 2012 · 1 comment
Closed

MSVC - Static Code Analysis Warnings #36

ghost opened this issue Jun 30, 2012 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 30, 2012

File: tinyxml2.h
Lines: 366 & 367

These two lines cause warnings from the MSVC static code analysis - the simple fix is to explicitly cast the arguments to isspace() to unsigned char, which IIRC is correct usage of this function.

static const char* SkipWhiteSpace( const char* p ) { while( !IsUTF8Continuation(p) && isspace( *p ) ) { ++p; } return p; }
static char
SkipWhiteSpace( char* p ) { while( !IsUTF8Continuation(*p) && isspace( *p ) ) { ++p; } return p; }

Should be:

static const char* SkipWhiteSpace( const char* p ) { while( !IsUTF8Continuation(_p) && isspace( (unsigned char)_p ) ) { ++p; } return p; }
static char* SkipWhiteSpace( char* p ) { while( !IsUTF8Continuation(_p) && isspace( (unsigned char)_p ) ) { ++p; } return p; }

Great library which I've used several times - hope this is helpful.

Cheers.

@leethomason
Copy link
Owner

I went ahead and switched to reinterpret_cast<>. Compiles fine on my machine, but it does today. if you still see a warning, go ahead and re-open this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant