WinRT core compatibility fixes

Update system.cpp

Update system.cpp

Update ocl.cpp

Update matching.cpp

Update ocl.cpp

Update matching.cpp
This commit is contained in:
GregoryMorse
2014-05-06 04:59:39 +08:00
parent 01f31dc007
commit b1443bc1bc
3 changed files with 24 additions and 13 deletions

View File

@@ -442,27 +442,23 @@ String format( const char* fmt, ... )
String tempfile( const char* suffix )
{
#ifdef HAVE_WINRT
std::wstring temp_dir = L"";
const wchar_t* opencv_temp_dir = _wgetenv(L"OPENCV_TEMP_PATH");
if (opencv_temp_dir)
temp_dir = std::wstring(opencv_temp_dir);
#else
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
String fname;
#ifndef HAVE_WINRT
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif
#if defined WIN32 || defined _WIN32
#ifdef HAVE_WINRT
RoInitialize(RO_INIT_MULTITHREADED);
std::wstring temp_dir2;
if (temp_dir.empty())
temp_dir = GetTempPathWinRT();
std::wstring temp_dir = L"";
const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str();
if (opencv_temp_dir)
temp_dir = std::wstring(opencv_temp_dir);
std::wstring temp_file;
temp_file = GetTempFileNameWinRT(L"ocv");
if (temp_file.empty())
return std::string();
return String();
temp_file = temp_dir + std::wstring(L"\\") + temp_file;
DeleteFileW(temp_file.c_str());
@@ -470,7 +466,7 @@ String tempfile( const char* suffix )
char aname[MAX_PATH];
size_t copied = wcstombs(aname, temp_file.c_str(), MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
fname = std::string(aname);
fname = String(aname);
RoUninitialize();
#else
char temp_dir2[MAX_PATH] = { 0 };