@ -20,17 +20,16 @@ namespace cv
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT
WIN32_FIND_DATAW FindFileData ;
WIN32_FIND_DATAW FindFileData ;
# else
# else
WIN32_FIND_DATA FindFileData ;
WIN32_FIND_DATAA FindFileData ;
# endif
# endif
HANDLE hFind ;
HANDLE hFind ;
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT
size_t size = mbstowcs ( NULL , path_f . c_str ( ) , path_f . size ( ) ) ;
size_t size = mbstowcs ( NULL , path_f . c_str ( ) , path_f . size ( ) ) ;
wchar_t * wpath = ( wchar_t * ) malloc ( ( size + 1 ) * sizeof ( wchar_t ) ) ;
Ptr < wchar_t > wpath = new wchar_t [ size + 1 ] ;
wpath [ size ] = 0 ;
wpath [ size ] = 0 ;
mbstowcs ( wpath , path_f . c_str ( ) , path_f . size ( ) ) ;
mbstowcs ( wpath , path_f . c_str ( ) , path_f . size ( ) ) ;
hFind = FindFirstFileExW ( wpath , FindExInfoStandard , & FindFileData , FindExSearchNameMatch , NULL , 0 ) ;
hFind = FindFirstFileExW ( wpath , FindExInfoStandard , & FindFileData , FindExSearchNameMatch , NULL , 0 ) ;
free ( wpath ) ;
# else
# else
hFind = FindFirstFileA ( ( LPCSTR ) path_f . c_str ( ) , & FindFileData ) ;
hFind = FindFirstFileA ( ( LPCSTR ) path_f . c_str ( ) , & FindFileData ) ;
# endif
# endif
@ -48,22 +47,19 @@ namespace cv
FindFileData . dwFileAttributes = = FILE_ATTRIBUTE_SYSTEM | |
FindFileData . dwFileAttributes = = FILE_ATTRIBUTE_SYSTEM | |
FindFileData . dwFileAttributes = = FILE_ATTRIBUTE_READONLY )
FindFileData . dwFileAttributes = = FILE_ATTRIBUTE_READONLY )
{
{
char * fname ;
cv : : Ptr < char > fname ;
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT
size_t asize = wcstombs ( NULL , FindFileData . cFileName , 0 ) ;
size_t asize = wcstombs ( NULL , FindFileData . cFileName , 0 ) ;
fname = ( char * ) malloc ( ( asize + 1 ) * sizeof ( char ) ) ;
fname = new char [ asize + 1 ] ;
fname [ asize ] = 0 ;
fname [ asize ] = 0 ;
wcstombs ( fname , FindFileData . cFileName , asize ) ;
wcstombs ( fname , FindFileData . cFileName , asize ) ;
# else
# else
fname = FindFileData . cFileName ;
fname = FindFileData . cFileName ;
# endif
# endif
if ( addPath )
if ( addPath )
list . push_back ( path + " / " + fname ) ;
list . push_back ( path + " / " + std : : string ( fname ) ) ;
else
else
list . push_back ( fname ) ;
list . push_back ( std : : string ( fname ) ) ;
# ifdef HAVE_WINRT
free ( fname ) ;
# endif
}
}
}
}
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT
@ -108,17 +104,16 @@ namespace cv
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT
WIN32_FIND_DATAW FindFileData ;
WIN32_FIND_DATAW FindFileData ;
# else
# else
WIN32_FIND_DATA FindFileData ;
WIN32_FIND_DATAA FindFileData ;
# endif
# endif
HANDLE hFind ;
HANDLE hFind ;
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT
size_t size = mbstowcs ( NULL , path_f . c_str ( ) , path_f . size ( ) ) ;
size_t size = mbstowcs ( NULL , path_f . c_str ( ) , path_f . size ( ) ) ;
wchar_t * wpath = ( wchar_t * ) malloc ( ( size + 1 ) * sizeof ( wchar_t ) ) ;
Ptr < wchar_t > wpath = new wchar_t [ size + 1 ] ;
wpath [ size ] = 0 ;
wpath [ size ] = 0 ;
mbstowcs ( wpath , path_f . c_str ( ) , path_f . size ( ) ) ;
mbstowcs ( wpath , path_f . c_str ( ) , path_f . size ( ) ) ;
hFind = FindFirstFileExW ( wpath , FindExInfoStandard , & FindFileData , FindExSearchNameMatch , NULL , 0 ) ;
hFind = FindFirstFileExW ( wpath , FindExInfoStandard , & FindFileData , FindExSearchNameMatch , NULL , 0 ) ;
free ( wpath ) ;
# else
# else
hFind = FindFirstFileA ( ( LPCSTR ) path_f . c_str ( ) , & FindFileData ) ;
hFind = FindFirstFileA ( ( LPCSTR ) path_f . c_str ( ) , & FindFileData ) ;
# endif
# endif
@ -130,14 +125,20 @@ namespace cv
{
{
do
do
{
{
# ifdef HAVE_WINRT
if ( FindFileData . dwFileAttributes = = FILE_ATTRIBUTE_DIRECTORY & &
if ( FindFileData . dwFileAttributes = = FILE_ATTRIBUTE_DIRECTORY & &
wcscmp ( FindFileData . cFileName , L " . " ) ! = 0 & &
wcscmp ( FindFileData . cFileName , L " . " ) ! = 0 & &
wcscmp ( FindFileData . cFileName , L " .. " ) ! = 0 )
wcscmp ( FindFileData . cFileName , L " .. " ) ! = 0 )
# else
if ( FindFileData . dwFileAttributes = = FILE_ATTRIBUTE_DIRECTORY & &
strcmp ( FindFileData . cFileName , " . " ) ! = 0 & &
strcmp ( FindFileData . cFileName , " .. " ) ! = 0 )
# endif
{
{
char * fname ;
cv : : Ptr < char > fname ;
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT
size_t asize = wcstombs ( NULL , FindFileData . cFileName , 0 ) ;
size_t asize = wcstombs ( NULL , FindFileData . cFileName , 0 ) ;
fname = ( char * ) malloc ( ( asize + 1 ) * sizeof ( char ) ) ;
fname = new char [ asize + 1 ] ;
fname [ asize ] = 0 ;
fname [ asize ] = 0 ;
wcstombs ( fname , FindFileData . cFileName , asize ) ;
wcstombs ( fname , FindFileData . cFileName , asize ) ;
# else
# else
@ -145,9 +146,9 @@ namespace cv
# endif
# endif
if ( addPath )
if ( addPath )
list . push_back ( path + " / " + fname ) ;
list . push_back ( path + " / " + std : : string ( fname ) ) ;
else
else
list . push_back ( fname ) ;
list . push_back ( std : : string ( fname ) ) ;
}
}
}
}
# ifdef HAVE_WINRT
# ifdef HAVE_WINRT