From f894d1de31ef9cc1ec6ab5872b8e3c7c65563ccb Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sat, 17 Jul 2010 11:51:17 +0000 Subject: [PATCH] replaced unlink() & _unlink() with more standard remove() (ticket #334) --- modules/highgui/src/loadsave.cpp | 6 +++--- tests/cv/src/anearestneighbors.cpp | 4 ++-- tests/cxcore/src/aio.cpp | 6 +----- tests/ml/src/slmltests.cpp | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/modules/highgui/src/loadsave.cpp b/modules/highgui/src/loadsave.cpp index ff823860bf..4e85e2a223 100644 --- a/modules/highgui/src/loadsave.cpp +++ b/modules/highgui/src/loadsave.cpp @@ -332,7 +332,7 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 ) if( !decoder->readHeader() ) { if( filename ) - unlink(filename); + remove(filename); return 0; } @@ -374,7 +374,7 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 ) bool code = decoder->readData( *data ); if( filename ) - unlink(filename); + remove(filename); if( !code ) { @@ -441,7 +441,7 @@ bool imencode( const string& ext, const Mat& image, fseek( f, 0, SEEK_SET ); buf.resize(fread( &buf[0], 1, buf.size(), f )); fclose(f); - unlink(filename); + remove(filename); } return code; } diff --git a/tests/cv/src/anearestneighbors.cpp b/tests/cv/src/anearestneighbors.cpp index 0b3659982d..6d1af6aee4 100644 --- a/tests/cv/src/anearestneighbors.cpp +++ b/tests/cv/src/anearestneighbors.cpp @@ -507,11 +507,11 @@ void CV_FlannSavedIndexTest::createModel(const cv::Mat &data) } char filename[50]; tmpnam( filename ); - if(filename[0] == '\\') filename[0] = '_'; + if(filename[0] == '\\') filename[0] = '_'; index->save( filename ); createIndex( data, SavedIndexParams(filename)); - unlink( filename ); + remove( filename ); } CV_LSHTest lsh_test; diff --git a/tests/cxcore/src/aio.cpp b/tests/cxcore/src/aio.cpp index 2ca6a51d25..810a44010d 100644 --- a/tests/cxcore/src/aio.cpp +++ b/tests/cxcore/src/aio.cpp @@ -425,11 +425,7 @@ void CV_IOTest::run( int ) } fs.release(); - #ifdef _MSC_VER - _unlink(filename); - #else - unlink(filename); - #endif + remove(filename); } } diff --git a/tests/ml/src/slmltests.cpp b/tests/ml/src/slmltests.cpp index 5d7500a499..29fbcd3ff4 100644 --- a/tests/ml/src/slmltests.cpp +++ b/tests/ml/src/slmltests.cpp @@ -105,8 +105,8 @@ int CV_SLMLTest::validate_test_results( int testCaseIdx ) f1.close(); f2.close(); // delete temporary files - unlink( fname1 ); - unlink( fname2 ); + remove( fname1 ); + remove( fname2 ); // 2. compare responses CV_Assert( test_resps1.size() == test_resps2.size() );