diff --git a/src/remote/blockingTCPAcceptor.cpp b/src/remote/blockingTCPAcceptor.cpp index 9a14360..565e65c 100644 --- a/src/remote/blockingTCPAcceptor.cpp +++ b/src/remote/blockingTCPAcceptor.cpp @@ -268,8 +268,8 @@ namespace pvAccess { { case esscimqi_socketBothShutdownRequired: shutdown(sock, SHUT_RDWR); - _thread.exitWait(); epicsSocketDestroy(sock); + _thread.exitWait(); break; case esscimqi_socketSigAlarmRequired: LOG(logLevelError, "SigAlarm close not implemented for this target\n"); diff --git a/src/remote/blockingUDPConnector.cpp b/src/remote/blockingUDPConnector.cpp index 7057f68..676ce47 100644 --- a/src/remote/blockingUDPConnector.cpp +++ b/src/remote/blockingUDPConnector.cpp @@ -68,9 +68,10 @@ namespace epics { } // sockets are blocking by default - Transport::shared_pointer transport(new BlockingUDPTransport(_serverFlag, responseHandler, + BlockingUDPTransport::shared_pointer transport(new BlockingUDPTransport(_serverFlag, responseHandler, socket, bindAddress, transportRevision)); - return transport; + + return Transport::shared_pointer(transport); } } diff --git a/src/remoteClient/clientContextImpl.cpp b/src/remoteClient/clientContextImpl.cpp index a64dfdc..74f625e 100644 --- a/src/remoteClient/clientContextImpl.cpp +++ b/src/remoteClient/clientContextImpl.cpp @@ -5060,7 +5060,9 @@ namespace epics { * So we compose the provider within the context and use a nested shared_ptr * to the context for the provider. */ - ClientContextImpl::shared_pointer ctxt(new InternalClientContextImpl(conf)); + // TODO use make::shared + InternalClientContextImpl::shared_pointer t(new InternalClientContextImpl(conf)); + ClientContextImpl::shared_pointer ctxt(t); InternalClientContextImpl *self = static_cast(ctxt.get()); diff --git a/src/utils/configuration.cpp b/src/utils/configuration.cpp index 6b0a356..a49e2db 100644 --- a/src/utils/configuration.cpp +++ b/src/utils/configuration.cpp @@ -4,11 +4,19 @@ * in file LICENSE that is included with this distribution. */ +#include +#include +#include +#include +#include +#include + #include #include #include +#include #include #define epicsExportSharedSymbols @@ -25,6 +33,122 @@ namespace pvAccess { using namespace epics::pvData; using namespace std; +#ifndef EPICS_VERSION_INT +#define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) +#define EPICS_VERSION_INT VERSION_INT(EPICS_VERSION, EPICS_REVISION, EPICS_MODIFICATION, EPICS_PATCH_LEVEL) +#endif + +#if EPICS_VERSION_INT < VERSION_INT(3,15,0,1) +/* integer conversion primitives added to epicsStdlib.c in 3.15.0.1 */ + +#define S_stdlib_noConversion 1 /* No digits to convert */ +#define S_stdlib_extraneous 2 /* Extraneous characters */ +#define S_stdlib_underflow 3 /* Too small to represent */ +#define S_stdlib_overflow 4 /* Too large to represent */ +#define S_stdlib_badBase 5 /* Number base not supported */ + +static int +epicsParseDouble(const char *str, double *to, char **units) +{ + int c; + char *endp; + double value; + + while ((c = *str) && isspace(c)) + ++str; + + errno = 0; + value = epicsStrtod(str, &endp); + + if (endp == str) + return S_stdlib_noConversion; + if (errno == ERANGE) + return (value == 0) ? S_stdlib_underflow : S_stdlib_overflow; + + while ((c = *endp) && isspace(c)) + ++endp; + if (c && !units) + return S_stdlib_extraneous; + + *to = value; + if (units) + *units = endp; + return 0; +} + +static int +epicsParseFloat(const char *str, float *to, char **units) +{ + double value, abs; + int status = epicsParseDouble(str, &value, units); + + if (status) + return status; + + abs = fabs(value); + if (value > 0 && abs <= FLT_MIN) + return S_stdlib_underflow; + // NOTE: 'finite' is deprecated in OS X 10.9, use 'isfinite' instead + if (isfinite(value) && abs >= FLT_MAX) + return S_stdlib_overflow; + + *to = (float)value; + return 0; +} + +static int +epicsParseLong(const char *str, long *to, int base, char **units) +{ + int c; + char *endp; + long value; + + while ((c = *str) && isspace(c)) + ++str; + + errno = 0; + value = strtol(str, &endp, base); + + if (endp == str) + return S_stdlib_noConversion; + if (errno == EINVAL) /* Not universally supported */ + return S_stdlib_badBase; + if (errno == ERANGE) + return S_stdlib_overflow; + + while ((c = *endp) && isspace(c)) + ++endp; + if (c && !units) + return S_stdlib_extraneous; + + *to = value; + if (units) + *units = endp; + return 0; +} + +static int +epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units) +{ + long value; + int status = epicsParseLong(str, &value, base, units); + + if (status) + return status; + +#if (LONG_MAX > 0x7fffffff) + if (value < -0x80000000L || value > 0x7fffffffL) + return S_stdlib_overflow; +#endif + + *to = (epicsInt32)value; + return 0; +} + +#endif + + + Properties::Properties() {} Properties::Properties(const string &fileName) : _fileName(fileName) {}