Merge pull request #10984 from extrowerk:advanced_haiku_patches

* Haiku supporting patches

* Revert uneeded changes

* Whitespace cleanup
pull/11075/head
miqlas 7 years ago committed by Alexander Alekhin
parent 7e9578789b
commit f3a9f13cb4
  1. 2
      modules/core/include/opencv2/core/utils/filesystem.private.hpp
  2. 5
      modules/core/src/parallel.cpp
  3. 10
      modules/core/src/utils/filesystem.cpp
  4. 4
      modules/videoio/src/cap_ffmpeg_impl.hpp

@ -12,7 +12,7 @@
# elif defined WINRT # elif defined WINRT
/* not supported */ /* not supported */
# elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \ # elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \
defined __FreeBSD__ || defined __bsdi__ defined __FreeBSD__ || defined __bsdi__ || defined __HAIKU__
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1 # define OPENCV_HAVE_FILESYSTEM_SUPPORT 1
# elif defined(__APPLE__) # elif defined(__APPLE__)
# include <TargetConditionals.h> # include <TargetConditionals.h>

@ -53,7 +53,8 @@
#undef abs #undef abs
#endif #endif
#if defined __linux__ || defined __APPLE__ || defined __GLIBC__ #if defined __linux__ || defined __APPLE__ || defined __GLIBC__ \
|| defined __HAIKU__
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
@ -721,7 +722,7 @@ int cv::getNumberOfCPUs(void)
#elif defined __ANDROID__ #elif defined __ANDROID__
static int ncpus = getNumberOfCPUsImpl(); static int ncpus = getNumberOfCPUsImpl();
return ncpus; return ncpus;
#elif defined __linux__ || defined __GLIBC__ #elif defined __linux__ || defined __GLIBC__ || defined __HAIKU__
return (int)sysconf( _SC_NPROCESSORS_ONLN ); return (int)sysconf( _SC_NPROCESSORS_ONLN );
#elif defined __APPLE__ #elif defined __APPLE__
int numCPU=0; int numCPU=0;

@ -34,7 +34,7 @@
#include <errno.h> #include <errno.h>
#include <io.h> #include <io.h>
#include <stdio.h> #include <stdio.h>
#elif defined __linux__ || defined __APPLE__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
@ -161,7 +161,7 @@ cv::String getcwd()
sz = GetCurrentDirectoryA((DWORD)buf.size(), (char*)buf); sz = GetCurrentDirectoryA((DWORD)buf.size(), (char*)buf);
return cv::String((char*)buf, (size_t)sz); return cv::String((char*)buf, (size_t)sz);
#endif #endif
#elif defined __linux__ || defined __APPLE__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
for(;;) for(;;)
{ {
char* p = ::getcwd((char*)buf, buf.size()); char* p = ::getcwd((char*)buf, buf.size());
@ -195,7 +195,7 @@ bool createDirectory(const cv::String& path)
#else #else
int result = _mkdir(path.c_str()); int result = _mkdir(path.c_str());
#endif #endif
#elif defined __linux__ || defined __APPLE__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
int result = mkdir(path.c_str(), 0777); int result = mkdir(path.c_str(), 0777);
#else #else
int result = -1; int result = -1;
@ -310,7 +310,7 @@ private:
Impl& operator=(const Impl&); // disabled Impl& operator=(const Impl&); // disabled
}; };
#elif defined __linux__ || defined __APPLE__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
struct FileLock::Impl struct FileLock::Impl
{ {
@ -424,7 +424,7 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
default_cache_path = "/tmp/"; default_cache_path = "/tmp/";
CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path); CV_LOG_WARNING(NULL, "Using world accessible cache directory. This may be not secure: " << default_cache_path);
} }
#elif defined __linux__ #elif defined __linux__ || defined __HAIKU__
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
if (default_cache_path.empty()) if (default_cache_path.empty())
{ {

@ -101,7 +101,7 @@ extern "C" {
long tv_nsec; long tv_nsec;
}; };
#endif #endif
#elif defined __linux__ || defined __APPLE__ #elif defined __linux__ || defined __APPLE__ || defined __HAIKU__
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
@ -298,7 +298,7 @@ static int get_number_of_cpus(void)
GetSystemInfo( &sysinfo ); GetSystemInfo( &sysinfo );
return (int)sysinfo.dwNumberOfProcessors; return (int)sysinfo.dwNumberOfProcessors;
#elif defined __linux__ #elif defined __linux__ || defined __HAIKU__
return (int)sysconf( _SC_NPROCESSORS_ONLN ); return (int)sysconf( _SC_NPROCESSORS_ONLN );
#elif defined __APPLE__ #elif defined __APPLE__
int numCPU=0; int numCPU=0;

Loading…
Cancel
Save