David Turner pushed to branch fix-compiler-warnings at FreeType / FreeType Demo Programs
Commits:
-
42f1cf70
by David Turner at 2021-05-24T18:01:15+02:00
-
67478cf1
by David Turner at 2021-05-24T18:02:46+02:00
-
2ba431dc
by David Turner at 2021-05-24T18:02:46+02:00
-
ba942c43
by David Turner at 2021-05-24T18:02:46+02:00
4 changed files:
Changes:
... | ... | @@ -256,6 +256,15 @@ gr_win32_surface_set_icon( grWin32Surface* surface, |
256 | 256 |
ICONINFO ici = { TRUE };
|
257 | 257 |
HICON hIcon;
|
258 | 258 |
|
259 |
+/* NOTE: The Mingw64 wingdi.h defines this macro as 'sRGB'
|
|
260 |
+ * which triggers the -Wmultichar warning during compilation,
|
|
261 |
+ * so replace it with the corresponding numerical value.
|
|
262 |
+ */
|
|
263 |
+#ifdef __MINGW64__
|
|
264 |
+#undef LCS_sRGB
|
|
265 |
+#define LCS_sRGB 0x73524742
|
|
266 |
+#endif
|
|
267 |
+ |
|
259 | 268 |
BITMAPV4HEADER hdr = { sizeof( BITMAPV4HEADER ),
|
260 | 269 |
0, 0, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0,
|
261 | 270 |
0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
|
... | ... | @@ -297,6 +306,8 @@ gr_win32_surface_set_icon( grWin32Surface* surface, |
297 | 306 |
case ICON_BIG:
|
298 | 307 |
surface->bIcon = hIcon;
|
299 | 308 |
return s[0];
|
309 |
+ default:
|
|
310 |
+ return 0; /* should not happen */
|
|
300 | 311 |
}
|
301 | 312 |
}
|
302 | 313 |
|
... | ... | @@ -198,19 +198,11 @@ |
198 | 198 |
static double
|
199 | 199 |
get_time( void )
|
200 | 200 |
{
|
201 |
-#if defined _POSIX_TIMERS && _POSIX_TIMERS > 0
|
|
202 |
- struct timespec tv;
|
|
203 |
- |
|
204 |
- |
|
205 |
-#ifdef _POSIX_CPUTIME
|
|
206 |
- clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &tv );
|
|
207 |
-#else
|
|
208 |
- clock_gettime( CLOCK_REALTIME, &tv );
|
|
209 |
-#endif /* _POSIX_CPUTIME */
|
|
210 |
- |
|
211 |
- return 1E6 * (double)tv.tv_sec + 1E-3 * (double)tv.tv_nsec;
|
|
212 |
- |
|
213 |
-#elif defined _WIN32
|
|
201 |
+/* NOTE: When building with the Mingw64 toolchain, _POSIX_TIMERS
|
|
202 |
+ * will be defined, but clock_gettime() won't, so ensure that the
|
|
203 |
+ * _WIN32 specific timer code appears first here.
|
|
204 |
+ */
|
|
205 |
+#if defined _WIN32
|
|
214 | 206 |
|
215 | 207 |
#ifdef QPC
|
216 | 208 |
LARGE_INTEGER ticks;
|
... | ... | @@ -238,6 +230,18 @@ |
238 | 230 |
|
239 | 231 |
#endif
|
240 | 232 |
|
233 |
+#elif defined _POSIX_TIMERS && _POSIX_TIMERS > 0
|
|
234 |
+ struct timespec tv;
|
|
235 |
+ |
|
236 |
+ |
|
237 |
+#ifdef _POSIX_CPUTIME
|
|
238 |
+ clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &tv );
|
|
239 |
+#else
|
|
240 |
+ clock_gettime( CLOCK_REALTIME, &tv );
|
|
241 |
+#endif /* _POSIX_CPUTIME */
|
|
242 |
+ |
|
243 |
+ return 1E6 * (double)tv.tv_sec + 1E-3 * (double)tv.tv_nsec;
|
|
244 |
+ |
|
241 | 245 |
#else
|
242 | 246 |
/* clock() accuracy has improved since glibc 2.18 */
|
243 | 247 |
return 1E6 * (double)clock() / (double)CLOCKS_PER_SEC;
|
... | ... | @@ -66,7 +66,7 @@ void record_my_block( void* base, long size ) |
66 | 66 |
{
|
67 | 67 |
if ( block->base == base && block->size != 0 )
|
68 | 68 |
{
|
69 |
- fprintf( stderr, "duplicate memory block at %08lx\n", (long)block->base );
|
|
69 |
+ fprintf( stderr, "duplicate memory block at %p\n", block->base );
|
|
70 | 70 |
exit(1);
|
71 | 71 |
}
|
72 | 72 |
}
|
... | ... | @@ -147,7 +147,10 @@ |
147 | 147 |
#define WIN32_LEAN_AND_MEAN
|
148 | 148 |
#include<windows.h>
|
149 | 149 |
|
150 |
+/* Microsoft Visual C++ specific pragma */
|
|
151 |
+#ifdef _MSC_VER
|
|
150 | 152 |
#pragma comment (lib,"Gdiplus.lib")
|
153 |
+#endif
|
|
151 | 154 |
|
152 | 155 |
/* Barebone definitions and opaque types to avoid GDI+ (C++) headers */
|
153 | 156 |
|