From 6d3102141c0f585a271239a31609922901179ee4 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Mon, 2 Sep 2013 00:57:42 -0700 Subject: [PATCH] Globbing accuracy test fail on Windows RT fixed. --- modules/core/src/glob.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/core/src/glob.cpp b/modules/core/src/glob.cpp index 208b4e05c..c75bd2e66 100644 --- a/modules/core/src/glob.cpp +++ b/modules/core/src/glob.cpp @@ -91,6 +91,7 @@ namespace if(dir->handle == INVALID_HANDLE_VALUE) { /*closedir will do all cleanup*/ + delete dir; return 0; } return dir; @@ -140,6 +141,7 @@ static bool isDir(const cv::String& path, DIR* dir) { #if defined WIN32 || defined _WIN32 || defined WINCE DWORD attributes; + BOOL status = TRUE; if (dir) attributes = dir->data.dwFileAttributes; else @@ -149,14 +151,14 @@ static bool isDir(const cv::String& path, DIR* dir) wchar_t wpath[MAX_PATH]; size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH); CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1)); - ::GetFileAttributesExW(wpath, GetFileExInfoStandard, &all_attrs); + status = ::GetFileAttributesExW(wpath, GetFileExInfoStandard, &all_attrs); #else - ::GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &all_attrs); + status = ::GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &all_attrs); #endif attributes = all_attrs.dwFileAttributes; } - return (attributes != INVALID_FILE_ATTRIBUTES) && ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0); + return status && ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0); #else (void)dir; struct stat stat_buf;