minimize preprocessor branching for vxWorks
This commit is contained in:
@@ -30,10 +30,6 @@
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
#ifdef __vxworks
|
||||
#define INT64_MAX (0x7fffffffffffffffLL)
|
||||
#endif
|
||||
|
||||
using namespace epics::pvData;
|
||||
|
||||
using std::max;
|
||||
|
||||
@@ -26,6 +26,13 @@ using namespace std;
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
|
||||
#ifdef __vxworks
|
||||
inline int sendto(int s, const char *buf, size_t len, int flags, const struct sockaddr *to, int tolen)
|
||||
{
|
||||
return ::sendto(s, const_cast<char*>(buf), len, flags, const_cast<struct sockaddr *>(to), tolen);
|
||||
}
|
||||
#endif
|
||||
|
||||
PVACCESS_REFCOUNT_MONITOR_DEFINE(blockingUDPTransport);
|
||||
|
||||
BlockingUDPTransport::BlockingUDPTransport(
|
||||
@@ -295,17 +302,8 @@ namespace epics {
|
||||
bool BlockingUDPTransport::send(ByteBuffer* buffer, const osiSockAddr& address) {
|
||||
|
||||
buffer->flip();
|
||||
int retval = sendto(_channel,
|
||||
#ifdef __vxworks
|
||||
(char *)
|
||||
#endif
|
||||
buffer->getArray(),
|
||||
buffer->getLimit(), 0,
|
||||
#ifdef __vxworks
|
||||
(sockaddr*)
|
||||
#endif
|
||||
&(address.sa), sizeof(sockaddr));
|
||||
|
||||
int retval = sendto(_channel, buffer->getArray(),
|
||||
buffer->getLimit(), 0, &(address.sa), sizeof(sockaddr));
|
||||
if(unlikely(retval<0))
|
||||
{
|
||||
char errStr[64];
|
||||
@@ -324,16 +322,8 @@ namespace epics {
|
||||
|
||||
bool allOK = true;
|
||||
for(size_t i = 0; i<_sendAddresses->size(); i++) {
|
||||
int retval = sendto(_channel,
|
||||
#ifdef __vxworks
|
||||
(char *)
|
||||
#endif
|
||||
buffer->getArray(),
|
||||
buffer->getLimit(), 0,
|
||||
#ifdef __vxworks
|
||||
(sockaddr*)
|
||||
#endif
|
||||
&((*_sendAddresses)[i].sa),
|
||||
int retval = sendto(_channel, buffer->getArray(),
|
||||
buffer->getLimit(), 0, &((*_sendAddresses)[i].sa),
|
||||
sizeof(sockaddr));
|
||||
if(unlikely(retval<0))
|
||||
{
|
||||
|
||||
@@ -10,11 +10,6 @@
|
||||
#include <pv/remote.h>
|
||||
#include <osiSock.h>
|
||||
|
||||
#ifndef __vxworks
|
||||
/* why not use pvType.h here? */
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user