summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libtiff/libtiff/tif_win32.c
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@theqtcompany.com>2015-11-25 14:25:31 +0100
committeraavit <eirik.aavitsland@theqtcompany.com>2015-12-09 12:25:16 +0000
commit6730d70f001c9492d32a6a8e95c304a52d7ddc35 (patch)
tree1553ae391ec42af87ba32a52fa28f3cea2764980 /src/3rdparty/libtiff/libtiff/tif_win32.c
parentde4f14476c24eb4cf52948af92220a2a6462c823 (diff)
Bundled libtiff updated to version 4.0.6v5.6.0-beta1
Upstream changes since 4.0.3 have been merged in. Our local tif_conf.h have been updated according to the upstream changes in tif_conf.h.in. Change-Id: I1c2aef6f0f60377de4876e25df723c32a6f95ea6 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_win32.c')
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_win32.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_win32.c b/src/3rdparty/libtiff/libtiff/tif_win32.c
index 5fa828f..fdc2ee6 100644
--- a/src/3rdparty/libtiff/libtiff/tif_win32.c
+++ b/src/3rdparty/libtiff/libtiff/tif_win32.c
@@ -1,4 +1,4 @@
-/* $Id: tif_win32.c,v 1.39 2011-12-22 17:07:57 bfriesen Exp $ */
+/* $Id: tif_win32.c,v 1.41 2015-08-23 20:12:44 bfriesen Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@@ -28,6 +28,31 @@
* TIFF Library Win32-specific Routines. Adapted from tif_unix.c 4/5/95 by
* Scott Wagner (wagner@itek.com), Itek Graphix, Rochester, NY USA
*/
+
+/*
+ CreateFileA/CreateFileW return type 'HANDLE'.
+
+ thandle_t is declared like
+
+ DECLARE_HANDLE(thandle_t);
+
+ in tiffio.h.
+
+ Windows (from winnt.h) DECLARE_HANDLE logic looks like
+
+ #ifdef STRICT
+ typedef void *HANDLE;
+ #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+ #else
+ typedef PVOID HANDLE;
+ #define DECLARE_HANDLE(name) typedef HANDLE name
+ #endif
+
+ See http://bugzilla.maptools.org/show_bug.cgi?id=1941 for problems in WIN64
+ builds resulting from this. Unfortunately, the proposed patch was lost.
+
+*/
+
#include "tiffiop.h"
#include <windows.h>
@@ -214,7 +239,7 @@ TIFFFdOpen(int ifd, const char* name, const char* mode)
break;
}
}
- tif = TIFFClientOpen(name, mode, (thandle_t)ifd,
+ tif = TIFFClientOpen(name, mode, (thandle_t)ifd, /* FIXME: WIN64 cast to pointer warning */
_tiffReadProc, _tiffWriteProc,
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
fSuppressMap ? _tiffDummyMapProc : _tiffMapProc,
@@ -259,7 +284,7 @@ TIFFOpen(const char* name, const char* mode)
return ((TIFF *)0);
}
- tif = TIFFFdOpen((int)fd, name, mode);
+ tif = TIFFFdOpen((int)fd, name, mode); /* FIXME: WIN64 cast from pointer to int warning */
if(!tif)
CloseHandle(fd);
return tif;
@@ -314,7 +339,7 @@ TIFFOpenW(const wchar_t* name, const char* mode)
NULL, NULL);
}
- tif = TIFFFdOpen((int)fd,
+ tif = TIFFFdOpen((int)fd, /* FIXME: WIN64 cast from pointer to int warning */
(mbname != NULL) ? mbname : "<unknown>", mode);
if(!tif)
CloseHandle(fd);
@@ -329,6 +354,9 @@ TIFFOpenW(const wchar_t* name, const char* mode)
void*
_TIFFmalloc(tmsize_t s)
{
+ if (s == 0)
+ return ((void *) NULL);
+
return (malloc((size_t) s));
}