fix mingw-win32 specific warnings in libdivecomputer.c

1) since %lld is not defined in the MSVC runtime, use
the portable PRId64 macro from inttypes.h for 64bit integers

notice in inttypes.h from mingw-win32:
/* 7.8.1 Macros for format specifiers
 *
 * MS runtime does not yet understand C9x standard "ll"
 * length specifier. It appears to treat "ll" as "l".
 * The non-standard I64 length specifier causes warning in GCC,
 * but understood by MS runtime functions.
 */

2) include unistd.h to disable warning:
warning: implicit declaration of function 'usleep'

Lubomir's code then caused a warning building natively under Linux, which
I fixed as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Dirk Hohndel 2011-11-27 09:10:37 -08:00
parent 9b9355c770
commit ff0209a5b4

View file

@ -1,5 +1,7 @@
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <inttypes.h>
#include "dive.h"
#include "divelist.h"
@ -433,8 +435,8 @@ static void event_cb(device_t *device, device_event_t event, const void *data, v
break;
case DEVICE_EVENT_CLOCK:
devdata->clock = *clock;
printf("Event: systime=%lld, devtime=%u\n",
clock->systime, clock->devtime);
printf("Event: systime=%"PRId64", devtime=%u\n",
(uint64_t)clock->systime, clock->devtime);
break;
default:
break;