Commit 5a7336a6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

uni_atoi: cleanup code, use signed int

parent fbba7679
...@@ -208,11 +208,10 @@ namespace UniSetTypes ...@@ -208,11 +208,10 @@ namespace UniSetTypes
/// ( 0, 8-, 0x, 16-, . ) /// ( 0, 8-, 0x, 16-, . )
inline int uni_atoi( const char* str ) inline int uni_atoi( const char* str )
{ {
if ( str == NULL) int n = 0; // if str is NULL or sscanf failed, we return 0
return 0;
unsigned int n; if ( str != NULL )
std::sscanf(str, "%i", &n); std::sscanf(str, "%i", &n);
return n; return n;
} }
inline int uni_atoi( const std::string str ) inline int uni_atoi( const std::string str )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment