std::string GetBaseName( const std::string& file_path, const bool with_extension )
{
std::string tmp_str = file_path;
- int pos = file_path.rfind( _separator_ );
+ auto pos = file_path.rfind( _separator_ );
if ( pos >= 0 )
tmp_str = pos < (int)file_path.size()-1 ? file_path.substr( pos+1 ) : "";
std::string GetDirName( const std::string& file_path )
{
- int pos = file_path.rfind( _separator_ );
+ auto pos = file_path.rfind( _separator_ );
if ( pos >= 0 )
return pos < (int)file_path.size()-1 ? file_path.substr(0, pos ) : "";
return std::string(".");
std::string AddExtension( const std::string& name )
{
std::string tmp_str = name;
- int pos = tmp_str.rfind( _extension_ );
+ auto pos = tmp_str.rfind( _extension_ );
if( pos < 0 )
return tmp_str.append( _extension_ );
return tmp_str;
char* utf8_encode(const wchar_t* encoded)
{
if (encoded == NULL) return NULL;
- int size_needed = WideCharToMultiByte(CP_UTF8, 0, encoded, std::wcslen(encoded), NULL, 0, NULL, NULL);
+ auto size_needed = WideCharToMultiByte(CP_UTF8, 0, encoded, (int)std::wcslen(encoded), NULL, 0, NULL, NULL);
char* strTo = new char[ size_needed + 1 ];
- WideCharToMultiByte(CP_UTF8, 0, encoded, std::wcslen(encoded), strTo, size_needed, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, encoded, (int)std::wcslen(encoded), strTo, size_needed, NULL, NULL);
strTo[size_needed] = '\0';
return strTo;
}
wchar_t* utf8_decode(const char* decoded)
{
if (decoded == NULL) return NULL;
- int size_needed = MultiByteToWideChar(CP_UTF8, 0, decoded, strlen(decoded), NULL, 0);
+ auto size_needed = MultiByteToWideChar(CP_UTF8, 0, decoded, (int)strlen(decoded), NULL, 0);
wchar_t* wstrTo = new wchar_t[ size_needed + 1 ];
- MultiByteToWideChar(CP_UTF8, 0, decoded, strlen(decoded), wstrTo, size_needed);
+ MultiByteToWideChar(CP_UTF8, 0, decoded, (int)strlen(decoded), wstrTo, size_needed);
wstrTo[size_needed] = '\0';
return wstrTo;
}