From 641c2ba83e5e284ffbf280d6eb10f018bb197417 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 16 Jul 2010 15:04:34 +0000 Subject: [PATCH] repaired build on mac after libtiff update --- 3rdparty/include/tiffconf.h | 8 ++++++++ 3rdparty/include/tiffio.h | 2 +- 3rdparty/libtiff/tif_config.h | 9 ++++++++- 3rdparty/libtiff/tif_dirinfo.c | 16 ++++++++++++++++ 3rdparty/libtiff/tif_unix.c | 4 ---- tests/cv/src/highguitest.cpp | 10 ++++++++-- 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/3rdparty/include/tiffconf.h b/3rdparty/include/tiffconf.h index 3d14847a27..68dfcf014c 100644 --- a/3rdparty/include/tiffconf.h +++ b/3rdparty/include/tiffconf.h @@ -26,13 +26,21 @@ #define TIFF_INT64_FORMAT "%I64d" /* Signed 64-bit type */ +#ifdef _MSC_VER #define TIFF_INT64_T signed __int64 +#else +#define TIFF_INT64_T long long +#endif /* Unsigned 64-bit type formatter */ #define TIFF_UINT64_FORMAT "%I64u" /* Unsigned 64-bit type */ +#ifdef _MSC_VER #define TIFF_UINT64_T unsigned __int64 +#else +#define TIFF_UINT64_T unsigned long long +#endif /* Compatibility stuff. */ diff --git a/3rdparty/include/tiffio.h b/3rdparty/include/tiffio.h index 06ec25c829..36e4997a91 100644 --- a/3rdparty/include/tiffio.h +++ b/3rdparty/include/tiffio.h @@ -64,7 +64,7 @@ typedef uint16 tsample_t; /* sample number */ typedef uint32 tstrile_t; /* strip or tile number */ typedef tstrile_t tstrip_t; /* strip number */ typedef tstrile_t ttile_t; /* tile number */ -typedef int32 tsize_t; /* i/o size in bytes */ +typedef size_t tsize_t; /* i/o size in bytes */ typedef void* tdata_t; /* image data ref */ typedef uint32 toff_t; /* file offset */ diff --git a/3rdparty/libtiff/tif_config.h b/3rdparty/libtiff/tif_config.h index 4dd77dd8cf..08d1f0d071 100644 --- a/3rdparty/libtiff/tif_config.h +++ b/3rdparty/libtiff/tif_config.h @@ -32,11 +32,18 @@ /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 + +#ifdef _MSC_VER /* Signed 64-bit type */ #define TIFF_INT64_T signed __int64 - /* Unsigned 64-bit type */ #define TIFF_UINT64_T unsigned __int64 +#else +/* Signed 64-bit type */ +#define TIFF_INT64_T long long +/* Signed 64-bit type */ +#define TIFF_UINT64_T unsigned long long +#endif /* Set the native cpu bit order */ #define HOST_FILLORDER FILLORDER_LSB2MSB diff --git a/3rdparty/libtiff/tif_dirinfo.c b/3rdparty/libtiff/tif_dirinfo.c index 0a77c9714e..57c29d55c2 100644 --- a/3rdparty/libtiff/tif_dirinfo.c +++ b/3rdparty/libtiff/tif_dirinfo.c @@ -771,6 +771,22 @@ _TIFFFindFieldInfo(TIFF* tif, ttag_t tag, TIFFDataType dt) return tif->tif_foundfield = (ret ? *ret : NULL); } +#undef lfind +static void * +lfind(const void *key, const void *base, size_t *nmemb, size_t size, + int(*compar)(const void *, const void *)) +{ + char *element, *end; + + end = (char *)base + *nmemb * size; + for (element = (char *)base; element < end; element += size) + if (!compar(element, key)) /* key found */ + return element; + + return NULL; +} + + const TIFFFieldInfo* _TIFFFindFieldInfoByName(TIFF* tif, const char *field_name, TIFFDataType dt) { diff --git a/3rdparty/libtiff/tif_unix.c b/3rdparty/libtiff/tif_unix.c index b73e80db1a..e0f1a8ddf2 100644 --- a/3rdparty/libtiff/tif_unix.c +++ b/3rdparty/libtiff/tif_unix.c @@ -46,10 +46,6 @@ # include #endif -#ifdef HAVE_IO_H -# include -#endif - #include "tiffiop.h" static tsize_t diff --git a/tests/cv/src/highguitest.cpp b/tests/cv/src/highguitest.cpp index a63004abea..0ad0281653 100644 --- a/tests/cv/src/highguitest.cpp +++ b/tests/cv/src/highguitest.cpp @@ -66,8 +66,14 @@ using namespace std; struct TempDirHolder { - const string temp_folder; - TempDirHolder() { char* p = tmpnam(0); if(p[0] == '\\') p++; temp_folder = p; exec_cmd("mkdir " + temp_folder); } + string temp_folder; + TempDirHolder() + { + char* p = tmpnam(0); + if(p[0] == '\\') p++; + temp_folder = string(p); + exec_cmd("mkdir " + temp_folder); + } ~TempDirHolder() { exec_cmd("rm -rf " + temp_folder); } static void exec_cmd(const string& cmd) { marker(cmd); int res = system( cmd.c_str() ); (void)res; }