return "" -> return NULL
This commit is contained in:
@@ -277,7 +277,7 @@ CString werr_ssprintf( int err, const char *fmt, ...)
|
||||
CString ConvertWstringToACP( wstring s )
|
||||
{
|
||||
if( s.empty() )
|
||||
return "";
|
||||
return NULL;
|
||||
|
||||
int iBytes = WideCharToMultiByte( CP_ACP, 0, s.data(), s.size(),
|
||||
NULL, 0, NULL, FALSE );
|
||||
@@ -301,7 +301,7 @@ CString ConvertUTF8ToACP( CString s )
|
||||
CString join( const CString &Deliminator, const CStringArray& Source)
|
||||
{
|
||||
if( Source.empty() )
|
||||
return "";
|
||||
return NULL;
|
||||
|
||||
CString csTmp;
|
||||
|
||||
@@ -317,7 +317,7 @@ CString join( const CString &Deliminator, const CStringArray& Source)
|
||||
CString join( const CString &Delimitor, CStringArray::const_iterator begin, CStringArray::const_iterator end )
|
||||
{
|
||||
if( begin == end )
|
||||
return "";
|
||||
return NULL;
|
||||
|
||||
CString ret;
|
||||
while( begin != end )
|
||||
@@ -512,11 +512,11 @@ CString GetExtension( const CString &sPath )
|
||||
{
|
||||
size_t pos = sPath.rfind( '.' );
|
||||
if( pos == sPath.npos )
|
||||
return "";
|
||||
return NULL;
|
||||
|
||||
size_t slash = sPath.find( '/', pos );
|
||||
if( slash != sPath.npos )
|
||||
return ""; /* rare: path/dir.ext/fn */
|
||||
return NULL; /* rare: path/dir.ext/fn */
|
||||
|
||||
return sPath.substr( pos+1, sPath.size()-pos+1 );
|
||||
}
|
||||
@@ -660,6 +660,15 @@ void StripCrnl(CString &s)
|
||||
s.erase(s.size()-1);
|
||||
}
|
||||
|
||||
bool EndsWith( const CString &sTestThis, const CString &sEnding )
|
||||
{
|
||||
ASSERT( !sEnding.empty() );
|
||||
|
||||
if( sTestThis.size() < sEnding.size() )
|
||||
return false;
|
||||
return sTestThis.Right( sEnding.size() ) == sEnding;
|
||||
}
|
||||
|
||||
void StripCvs( vector<CString> &vs )
|
||||
{
|
||||
for( unsigned i=0; i<vs.size(); i++ )
|
||||
@@ -686,7 +695,7 @@ CString DerefRedir(const CString &_path)
|
||||
|
||||
/* Empty is invalid. */
|
||||
if( sNewFileName == "" )
|
||||
return "";
|
||||
return NULL;
|
||||
|
||||
FixSlashesInPlace( sNewFileName );
|
||||
|
||||
@@ -1244,7 +1253,7 @@ CString Basename( const CString &dir )
|
||||
{
|
||||
size_t end = dir.find_last_not_of( "/\\" );
|
||||
if( end == dir.npos )
|
||||
return "";
|
||||
return NULL;
|
||||
|
||||
size_t start = dir.find_last_of( "/\\", end );
|
||||
if( start == dir.npos )
|
||||
@@ -1286,7 +1295,7 @@ CString Dirname( const CString &dir )
|
||||
CString Capitalize( const CString &s )
|
||||
{
|
||||
if( s.GetLength()==0 )
|
||||
return "";
|
||||
return NULL;
|
||||
CString s2 = s;
|
||||
/* XXX: utf-8 */
|
||||
if( !(s2[0] & 0x80) )
|
||||
|
||||
Reference in New Issue
Block a user