kopia lustrzana https://github.com/Hamlib/Hamlib
Fix MSVC compile by removing unistd.h and defining our own rig_useconds_t
https://github.com/Hamlib/Hamlib/issues/301pull/312/head
rodzic
f323a54b5a
commit
815db24852
|
@ -28,7 +28,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BACKEND_VER "20200510"
|
#define BACKEND_VER "20200613"
|
||||||
|
|
||||||
#define EOM "\r"
|
#define EOM "\r"
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
|
|
|
@ -2743,8 +2743,8 @@ extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status);
|
||||||
|
|
||||||
|
|
||||||
// cppcheck-suppress *
|
// cppcheck-suppress *
|
||||||
#include <unistd.h>
|
typedef unsigned long rig_useconds_t;
|
||||||
extern HAMLIB_EXPORT(int) hl_usleep(useconds_t msec);
|
extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec);
|
||||||
|
|
||||||
//! @endcond
|
//! @endcond
|
||||||
|
|
||||||
|
|
|
@ -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(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);
|
extern HAMLIB_EXPORT(double) elapsed_ms(struct timespec *start, int start_flag);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ extern "C" {
|
||||||
// In order to stop the usleep warnings in cppcheck we provide our own interface
|
// 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
|
// So this will use system usleep or our usleep depending on availability of nanosleep
|
||||||
// This version of usleep can handle > 1000000 usec values
|
// 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;
|
int retval = 0;
|
||||||
|
|
||||||
|
@ -85,12 +85,13 @@ unsigned int sleep(unsigned int secs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
/**
|
/**
|
||||||
* \brief microsecond sleep
|
* \brief microsecond sleep
|
||||||
* \param usec is microseconds to sleep
|
* \param usec is microseconds to sleep
|
||||||
* This does not have the same 1000000 limit as POSIX usleep
|
* This does not have the same 1000000 limit as POSIX usleep
|
||||||
*/
|
*/
|
||||||
int usleep(useconds_t usec)
|
int usleep(rig_useconds_t usec)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
unsigned long sec = usec / 1000000ul;
|
unsigned long sec = usec / 1000000ul;
|
||||||
|
@ -106,6 +107,7 @@ int usleep(useconds_t usec)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // HAVE_NANOSLEEP
|
#endif // HAVE_NANOSLEEP
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
/* Hamlib internal use, see rig.c */
|
/* Hamlib internal use, see rig.c */
|
||||||
int hl_usleep(useconds_t usec);
|
int hl_usleep(rig_useconds_t usec);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue