Commit ff2d76ec authored by Roman Donchenko's avatar Roman Donchenko Committed by OpenCV Buildbot

Merge pull request #2699 from GregoryMorse:patch-1

parents bc7b2160 38db7a78
...@@ -423,27 +423,23 @@ string format( const char* fmt, ... ) ...@@ -423,27 +423,23 @@ string format( const char* fmt, ... )
string tempfile( const char* suffix ) string tempfile( const char* suffix )
{ {
#ifdef HAVE_WINRT string fname;
std::wstring temp_dir = L""; #ifndef HAVE_WINRT
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"); const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif #endif
string fname;
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
#ifdef HAVE_WINRT #ifdef HAVE_WINRT
RoInitialize(RO_INIT_MULTITHREADED); RoInitialize(RO_INIT_MULTITHREADED);
std::wstring temp_dir2; std::wstring temp_dir = L"";
if (temp_dir.empty()) const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str();
temp_dir = GetTempPathWinRT(); if (opencv_temp_dir)
temp_dir = std::wstring(opencv_temp_dir);
std::wstring temp_file; std::wstring temp_file;
temp_file = GetTempFileNameWinRT(L"ocv"); temp_file = GetTempFileNameWinRT(L"ocv");
if (temp_file.empty()) if (temp_file.empty())
return std::string(); return string();
temp_file = temp_dir + std::wstring(L"\\") + temp_file; temp_file = temp_dir + std::wstring(L"\\") + temp_file;
DeleteFileW(temp_file.c_str()); DeleteFileW(temp_file.c_str());
...@@ -451,7 +447,7 @@ string tempfile( const char* suffix ) ...@@ -451,7 +447,7 @@ string tempfile( const char* suffix )
char aname[MAX_PATH]; char aname[MAX_PATH];
size_t copied = wcstombs(aname, temp_file.c_str(), MAX_PATH); size_t copied = wcstombs(aname, temp_file.c_str(), MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1)); CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
fname = std::string(aname); fname = string(aname);
RoUninitialize(); RoUninitialize();
#else #else
char temp_dir2[MAX_PATH] = { 0 }; char temp_dir2[MAX_PATH] = { 0 };
......
...@@ -524,7 +524,9 @@ int addNullableBorder(CvLSVMFeatureMap *map, int bx, int by) ...@@ -524,7 +524,9 @@ int addNullableBorder(CvLSVMFeatureMap *map, int bx, int by)
float *new_map; float *new_map;
sizeX = map->sizeX + 2 * bx; sizeX = map->sizeX + 2 * bx;
sizeY = map->sizeY + 2 * by; sizeY = map->sizeY + 2 * by;
new_map = (float *)malloc(sizeof(float) * sizeX * sizeY * map->numFeatures); // fix for Windows Phone 8 ARM compiler
size_t size = sizeof(float) * sizeX * sizeY * map->numFeatures;
new_map = (float *)malloc(size);
for (i = 0; i < sizeX * sizeY * map->numFeatures; i++) for (i = 0; i < sizeX * sizeY * map->numFeatures; i++)
{ {
new_map[i] = 0.0; new_map[i] = 0.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment