Fix MSVC compile by removing unistd.h and defining our own rig_useconds_t

https://github.com/Hamlib/Hamlib/issues/301
pull/312/head
Michael Black W9MDB 2020-06-13 17:40:47 -05:00
rodzic f323a54b5a
commit 815db24852
5 zmienionych plików z 9 dodań i 7 usunięć

Wyświetl plik

@ -28,7 +28,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "20200510"
#define BACKEND_VER "20200613"
#define EOM "\r"
#define TRUE 1

Wyświetl plik

@ -2743,8 +2743,8 @@ extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status);
// cppcheck-suppress *
#include <unistd.h>
extern HAMLIB_EXPORT(int) hl_usleep(useconds_t msec);
typedef unsigned long rig_useconds_t;
extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec);
//! @endcond

Wyświetl plik

@ -100,7 +100,7 @@ extern HAMLIB_EXPORT(void) rig_force_cache_timeout(struct timeval *tv);
extern HAMLIB_EXPORT(setting_t) rig_idx2setting(int i);
extern HAMLIB_EXPORT(int) hl_usleep(useconds_t usec);
extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t usec);
extern HAMLIB_EXPORT(double) elapsed_ms(struct timespec *start, int start_flag);

Wyświetl plik

@ -50,7 +50,7 @@ extern "C" {
// In order to stop the usleep warnings in cppcheck we provide our own interface
// So this will use system usleep or our usleep depending on availability of nanosleep
// This version of usleep can handle > 1000000 usec values
int hl_usleep(useconds_t usec)
int hl_usleep(rig_useconds_t usec)
{
int retval = 0;
@ -85,12 +85,13 @@ unsigned int sleep(unsigned int secs)
}
#if 0
/**
* \brief microsecond sleep
* \param usec is microseconds to sleep
* This does not have the same 1000000 limit as POSIX usleep
*/
int usleep(useconds_t usec)
int usleep(rig_useconds_t usec)
{
int retval;
unsigned long sec = usec / 1000000ul;
@ -106,6 +107,7 @@ int usleep(useconds_t usec)
return 0;
}
#endif
#endif // HAVE_NANOSLEEP
#ifdef __cplusplus

Wyświetl plik

@ -28,7 +28,7 @@
__BEGIN_DECLS
/* Hamlib internal use, see rig.c */
int hl_usleep(useconds_t usec);
int hl_usleep(rig_useconds_t usec);
__END_DECLS