提交 e03ffde3 编写于 作者: A Alexander Smorkalov

WinRT API Certification fixes for core and contrib.

上级 62b85a41
#include "opencv2/contrib/contrib.hpp" #include "opencv2/contrib/contrib.hpp"
#include <cvconfig.h>
#if defined(WIN32) || defined(_WIN32) #if defined(WIN32) || defined(_WIN32)
#include <windows.h> #include <windows.h>
...@@ -16,7 +17,7 @@ namespace cv ...@@ -16,7 +17,7 @@ namespace cv
list.clear(); list.clear();
std::string path_f = path + "/" + exten; std::string path_f = path + "/" + exten;
#ifdef WIN32 #ifdef WIN32
#if HAVE_WINRT #ifdef HAVE_WINRT
WIN32_FIND_DATAW FindFileData; WIN32_FIND_DATAW FindFileData;
#else #else
WIN32_FIND_DATA FindFileData; WIN32_FIND_DATA FindFileData;
...@@ -28,7 +29,7 @@ namespace cv ...@@ -28,7 +29,7 @@ namespace cv
wchar_t* wpath = (wchar_t*)malloc((size+1)*sizeof(wchar_t)); wchar_t* wpath = (wchar_t*)malloc((size+1)*sizeof(wchar_t));
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 = FindFirstFileW(wpath, &FindFileData); hFind = FindFirstFileExW(wpath, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, 0);
free(wpath); free(wpath);
#else #else
hFind = FindFirstFileA((LPCSTR)path_f.c_str(), &FindFileData); hFind = FindFirstFileA((LPCSTR)path_f.c_str(), &FindFileData);
...@@ -50,7 +51,7 @@ namespace cv ...@@ -50,7 +51,7 @@ namespace cv
char* fname; char* fname;
#ifdef HAVE_WINRT #ifdef HAVE_WINRT
size_t asize = wcstombs(NULL, FindFileData.cFileName, 0); size_t asize = wcstombs(NULL, FindFileData.cFileName, 0);
char* fname = (char*)malloc((asize+1)*sizeof(char)); fname = (char*)malloc((asize+1)*sizeof(char));
fname[asize] = 0; fname[asize] = 0;
wcstombs(fname, FindFileData.cFileName, asize); wcstombs(fname, FindFileData.cFileName, asize);
#else #else
...@@ -104,7 +105,7 @@ namespace cv ...@@ -104,7 +105,7 @@ namespace cv
std::string path_f = path + "/" + exten; std::string path_f = path + "/" + exten;
list.clear(); list.clear();
#ifdef WIN32 #ifdef WIN32
#if HAVE_WINRT #ifdef HAVE_WINRT
WIN32_FIND_DATAW FindFileData; WIN32_FIND_DATAW FindFileData;
#else #else
WIN32_FIND_DATA FindFileData; WIN32_FIND_DATA FindFileData;
...@@ -116,7 +117,7 @@ namespace cv ...@@ -116,7 +117,7 @@ namespace cv
wchar_t* wpath = (wchar_t*)malloc((size+1)*sizeof(wchar_t)); wchar_t* wpath = (wchar_t*)malloc((size+1)*sizeof(wchar_t));
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 = FindFirstFileW(wpath, &FindFileData); hFind = FindFirstFileExW(wpath, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, 0);
free(wpath); free(wpath);
#else #else
hFind = FindFirstFileA((LPCSTR)path_f.c_str(), &FindFileData); hFind = FindFirstFileA((LPCSTR)path_f.c_str(), &FindFileData);
...@@ -130,13 +131,13 @@ namespace cv ...@@ -130,13 +131,13 @@ namespace cv
do do
{ {
if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY && if (FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY &&
strcmp(FindFileData.cFileName, ".") != 0 && wcscmp(FindFileData.cFileName, L".") != 0 &&
strcmp(FindFileData.cFileName, "..") != 0) wcscmp(FindFileData.cFileName, L"..") != 0)
{ {
char* fname; char* fname;
#ifdef HAVE_WINRT #ifdef HAVE_WINRT
size_t asize = wcstombs(NULL, FindFileData.cFileName, 0); size_t asize = wcstombs(NULL, FindFileData.cFileName, 0);
char* fname = (char*)malloc((asize+1)*sizeof(char)); fname = (char*)malloc((asize+1)*sizeof(char));
fname[asize] = 0; fname[asize] = 0;
wcstombs(fname, FindFileData.cFileName, asize); wcstombs(fname, FindFileData.cFileName, asize);
#else #else
......
...@@ -81,7 +81,6 @@ ...@@ -81,7 +81,6 @@
#ifdef HAVE_WINRT #ifdef HAVE_WINRT
#include <wrl/client.h> #include <wrl/client.h>
#pragma comment(lib, "MinCore_Downlevel")
std::wstring GetTempPathWinRT() std::wstring GetTempPathWinRT()
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册