5066
|
1 This file is part of MXE. See LICENSE.md for licensing information. |
|
2 |
|
3 From 2d08af9a15089c354b436282e4d23f462a81ce8f Mon Sep 17 00:00:00 2001 |
|
4 From: MXE <mxe@mxe.cc> |
|
5 Date: Tue, 7 Oct 2014 21:50:59 -0700 |
|
6 Subject: [PATCH] Fix i686-w64-mingw32 |
|
7 |
|
8 Cherry-picked from |
|
9 http://git.dcmtk.org/web?p=dcmtk.git;a=commitdiff;h=b8a53c5f7fd12e9479f830680ef84f93805fd004 |
|
10 |
|
11 diff --git a/config/configure.in b/config/configure.in |
|
12 index e343ce1..a305114 100644 |
|
13 --- a/config/configure.in |
|
14 +++ b/config/configure.in |
|
15 @@ -199,6 +199,10 @@ AC_CHECK_TYPES(longlong) |
|
16 AC_CHECK_TYPES(ulonglong) |
|
17 CHECK_VLA |
|
18 |
|
19 +dnl File access stuff |
|
20 +AC_CHECK_TYPES(fpos64_t) |
|
21 +AC_CHECK_TYPES(off64_t) |
|
22 + |
|
23 dnl stdbool.h and stdint.h are only defined in ANSI C, not in C++ |
|
24 AC_CHECK_HEADERS(stdbool.h) |
|
25 AC_CHECK_HEADERS(stdint.h) |
|
26 @@ -232,6 +236,7 @@ AC_CHECK_FUNCS(sleep fork) |
|
27 AC_CHECK_FUNCS(_findfirst) |
|
28 AC_CHECK_FUNCS(strlcpy strlcat) |
|
29 AC_CHECK_FUNCS(vsnprintf) |
|
30 +AC_CHECK_FUNCS(popen pclose) |
|
31 AC_FUNC_FSEEKO |
|
32 |
|
33 |
|
34 diff --git a/config/include/dcmtk/config/cfunix.h.in b/config/include/dcmtk/config/cfunix.h.in |
|
35 index 3a6cd69..ed211ca 100644 |
|
36 --- a/config/include/dcmtk/config/cfunix.h.in |
|
37 +++ b/config/include/dcmtk/config/cfunix.h.in |
|
38 @@ -157,6 +157,9 @@ |
|
39 /* Define to 1 if you have the `fork' function. */ |
|
40 #undef HAVE_FORK |
|
41 |
|
42 +/* Define to 1 if the system has the type `fpos64_t'. */ |
|
43 +#undef HAVE_FPOS64_T |
|
44 + |
|
45 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ |
|
46 #undef HAVE_FSEEKO |
|
47 |
|
48 @@ -424,14 +427,23 @@ typedef unsigned short ushort; |
|
49 /* Define to 1 if you have the `ntohs' function. */ |
|
50 #undef HAVE_NTOHS |
|
51 |
|
52 +/* Define to 1 if the system has the type `off64_t'. */ |
|
53 +#undef HAVE_OFF64_T |
|
54 + |
|
55 /* Define if your system supports readdir_r with the obsolete Posix 1.c draft |
|
56 6 declaration (2 arguments) instead of the Posix 1.c declaration with 3 |
|
57 arguments. */ |
|
58 #undef HAVE_OLD_READDIR_R |
|
59 |
|
60 +/* Define to 1 if you have the `pclose' function. */ |
|
61 +#undef HAVE_PCLOSE |
|
62 + |
|
63 /* Define if pthread_t is a pointer type on your system */ |
|
64 #undef HAVE_POINTER_TYPE_PTHREAD_T |
|
65 |
|
66 +/* Define to 1 if you have the `popen' function. */ |
|
67 +#undef HAVE_POPEN |
|
68 + |
|
69 /* Define if your system has a prototype for accept in sys/types.h |
|
70 sys/socket.h */ |
|
71 #undef HAVE_PROTOTYPE_ACCEPT |
|
72 diff --git a/ofstd/include/dcmtk/ofstd/offile.h b/ofstd/include/dcmtk/ofstd/offile.h |
|
73 index 0f5d454..3f5a677 100644 |
|
74 --- a/ofstd/include/dcmtk/ofstd/offile.h |
|
75 +++ b/ofstd/include/dcmtk/ofstd/offile.h |
|
76 @@ -75,26 +75,36 @@ END_EXTERN_C |
|
77 #endif |
|
78 #endif |
|
79 |
|
80 -#if defined(_WIN32) && !defined(__MINGW32__) |
|
81 - // On Win32 systems except MinGW (where Posix definitions are available) |
|
82 - // we use Win32 specific definitions |
|
83 - typedef __int64 offile_off_t; |
|
84 - typedef fpos_t offile_fpos_t; |
|
85 +// Explicit LFS (LFS64) and Windows need 64 bit types |
|
86 +#if defined(EXPLICIT_LFS_64) || defined(_WIN32) |
|
87 + |
|
88 +// Use POSIX 64 bit file position type when available |
|
89 +#ifdef HAVE_FPOS64_T |
|
90 +typedef fpos64_t offile_fpos_t; |
|
91 +#else // Otherwise this should be sufficient |
|
92 +typedef fpos_t offile_fpos_t; |
|
93 +#endif |
|
94 + |
|
95 +// Use POSIX 64 bit file offset type when available |
|
96 +#ifdef HAVE_OFF64_T |
|
97 +typedef off64_t offile_off_t; |
|
98 +#elif !defined(OF_NO_SINT64) // Otherwise use a 64 bit integer |
|
99 +typedef Sint64 offile_off_t; |
|
100 +#else // Cry when 64 LFS is required but no 64 bit integer exists |
|
101 +#error \ |
|
102 + Could not find a suitable offset-type for LFS64 support. |
|
103 +#endif |
|
104 + |
|
105 +#else // Implicit LFS or no LFS |
|
106 + |
|
107 +#ifdef HAVE_FSEEKO |
|
108 +typedef off_t offile_off_t; |
|
109 #else |
|
110 - #ifdef EXPLICIT_LFS_64 |
|
111 - // Explicit LFS (LFS64) |
|
112 - typedef fpos64_t offile_fpos_t; |
|
113 - typedef off64_t offile_off_t; |
|
114 - #else |
|
115 - // Implicit LFS or no LFS |
|
116 - #ifdef HAVE_FSEEKO |
|
117 - typedef off_t offile_off_t; |
|
118 - #else |
|
119 - typedef long offile_off_t; |
|
120 - #endif |
|
121 - typedef fpos_t offile_fpos_t; |
|
122 - #endif |
|
123 +typedef long offile_off_t; |
|
124 #endif |
|
125 +typedef fpos_t offile_fpos_t; |
|
126 + |
|
127 +#endif // basic type definitions |
|
128 |
|
129 // the type we use to store the last error. |
|
130 typedef int offile_errno_t; |
|
131 @@ -196,10 +206,10 @@ public: |
|
132 OFBool popen(const char *command, const char *modes) |
|
133 { |
|
134 if (file_) fclose(); |
|
135 -#ifdef _WIN32 |
|
136 - file_ = _popen(command, modes); |
|
137 -#else |
|
138 +#ifdef HAVE_POPEN |
|
139 file_ = :: popen(command, modes); |
|
140 +#else |
|
141 + file_ = _popen(command, modes); |
|
142 #endif |
|
143 if (file_) popened_ = OFTrue; else storeLastError(); |
|
144 return (file_ != NULL); |
|
145 @@ -258,10 +268,10 @@ public: |
|
146 { |
|
147 if (popened_) |
|
148 { |
|
149 -#ifdef _WIN32 |
|
150 - result = _pclose(file_); |
|
151 -#else |
|
152 +#ifdef HAVE_PCLOSE |
|
153 result = :: pclose(file_); |
|
154 +#else |
|
155 + result = _pclose(file_); |
|
156 #endif |
|
157 } |
|
158 else |
|
159 -- |
|
160 1.8.3.2 |
|
161 |