From: Stefan Csomor Date: Fri, 13 Jul 2001 20:58:14 +0000 (+0000) Subject: corrected check string handling X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9f92f6fbab2c965c5b7f53c35c3cc3fb69eb2172 corrected check string handling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index b0884be347..66e3c72b57 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -416,13 +416,12 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP { Str255 filename ; PLstrcpy( filename , name ) ; - + p2cstr( filename ) ; + wxString file(filename) ; + file.MakeUpper() ; + if ( data->numfilters > 0 ) { - for( int j = 1 ; j <= filename[0] ; j++ ) - { - filename[j] = toupper( filename[j] ) ; - } //for ( int i = 0 ; i < data->numfilters ; ++i ) int i = data->currentfilter ; if ( data->extensions[i].Right(2) == ".*" ) @@ -436,7 +435,7 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP if ( extension.GetChar(0) == '*' ) extension = extension.Mid(1) ; - if ( filename[0] >= extension.Len() && extension == (char*) filename + 1 + filename[0] - extension.Len() ) + if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) ) return true ; } return false ; diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index b0884be347..66e3c72b57 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -416,13 +416,12 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP { Str255 filename ; PLstrcpy( filename , name ) ; - + p2cstr( filename ) ; + wxString file(filename) ; + file.MakeUpper() ; + if ( data->numfilters > 0 ) { - for( int j = 1 ; j <= filename[0] ; j++ ) - { - filename[j] = toupper( filename[j] ) ; - } //for ( int i = 0 ; i < data->numfilters ; ++i ) int i = data->currentfilter ; if ( data->extensions[i].Right(2) == ".*" ) @@ -436,7 +435,7 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP if ( extension.GetChar(0) == '*' ) extension = extension.Mid(1) ; - if ( filename[0] >= extension.Len() && extension == (char*) filename + 1 + filename[0] - extension.Len() ) + if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) ) return true ; } return false ;