fixes for windows xp sp3 sdk 7.1, typedefs for non-portable types, removed variable-length stack allocated arrays in tests, fixed inconsistent timeFunction interface declaraion, replaced variable-length stack allocated array in with std::vector in PVStructure factory as it is followed immediately by further heap allocation
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
* EPICS pvDataCPP is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/pvIntrospect.h>
|
||||
#include <pv/convert.h>
|
||||
@@ -150,9 +151,9 @@ namespace epics { namespace pvData {
|
||||
throw std::logic_error("Number of fields must be >=0");
|
||||
|
||||
Structure::shared_pointer structure = const_pointer_cast<Structure>(getStructure());
|
||||
FieldConstPtr fields[numberNewFields];
|
||||
std::vector<FieldConstPtr> fields(numberNewFields);
|
||||
for(int i=0; i<numberNewFields; i++) fields[i] = pvFields[i]->getField();
|
||||
structure->appendFields(numberNewFields,fields);
|
||||
structure->appendFields(numberNewFields,&fields[0]);
|
||||
int origLength = pImpl->numberFields;
|
||||
PVFieldPtrArray oldPVFields = pImpl->pvFields;
|
||||
int numberFields = origLength + numberNewFields;
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
#include <pv/linkedList.h>
|
||||
#include <pv/CDRMonitor.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
static
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
#elif defined(EXCEPT_USE_CAPTURE)
|
||||
{
|
||||
m_depth=CaptureStackBackTrace(0,EXCEPT_DEPTH.m_stack,0);
|
||||
m_depth=CaptureStackBackTrace(0,EXCEPT_DEPTH,m_stack,0);
|
||||
}
|
||||
#else
|
||||
{}
|
||||
@@ -141,7 +141,7 @@ namespace detail {
|
||||
std::string
|
||||
showException(const E& ex)
|
||||
{
|
||||
ExceptionMixin *mx=dynamic_cast<ExceptionMixin*>(&ex);
|
||||
const ExceptionMixin *mx=dynamic_cast<const ExceptionMixin*>(&ex);
|
||||
if(!mx) return std::string();
|
||||
return mx->show();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
# define SHARED_FROM_BOOST
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER>=1600)
|
||||
// MSVC 2010 has it in <memory>
|
||||
# undef SHARED_FROM_BOOST
|
||||
# undef SHARED_FROM_TR1
|
||||
#endif
|
||||
|
||||
// go and get it
|
||||
|
||||
#if defined(SHARED_FROM_TR1)
|
||||
|
||||
@@ -7,23 +7,10 @@
|
||||
#include <pv/noDefaultMethods.h>
|
||||
#include <pv/pvType.h>
|
||||
#include <pv/timeStamp.h>
|
||||
#include <pv/timeFunction.h>
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
class TimeFunctionRequester {
|
||||
public:
|
||||
virtual void function() = 0;
|
||||
};
|
||||
|
||||
class TimeFunction : private NoDefaultMethods {
|
||||
public:
|
||||
TimeFunction(TimeFunctionRequester *requester);
|
||||
~TimeFunction();
|
||||
double timeCall();
|
||||
private:
|
||||
TimeFunctionRequester *requester;
|
||||
};
|
||||
|
||||
TimeFunction::TimeFunction(TimeFunctionRequester *requester)
|
||||
: requester(requester) {}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
using namespace epics::pvData;
|
||||
|
||||
static int numNodes = 5;
|
||||
static const int numNodes = 5;
|
||||
class Basic;
|
||||
typedef LinkedListNode<Basic> BasicListNode;
|
||||
typedef LinkedList<Basic> BasicList;
|
||||
@@ -276,7 +276,7 @@ static void testOrderedQueue(FILE * fd ) {
|
||||
static void testTime(FILE *auxFd) {
|
||||
TimeStamp startTime;
|
||||
TimeStamp endTime;
|
||||
int numNodes = 1000;
|
||||
const int numNodes = 1000;
|
||||
|
||||
LinkedList<Basic> basicList;
|
||||
Basic *basics[numNodes];
|
||||
@@ -309,7 +309,7 @@ static void testTimeLocked(FILE *auxFd) {
|
||||
TimeStamp startTime;
|
||||
TimeStamp endTime;
|
||||
Mutex mutex;
|
||||
int numNodes = 1000;
|
||||
const int numNodes = 1000;
|
||||
|
||||
LinkedList<Basic> basicList;
|
||||
Basic *basics[numNodes];
|
||||
@@ -352,7 +352,7 @@ typedef std::list<Basic *> stdList;
|
||||
static void testStdListTime(FILE *auxFd) {
|
||||
TimeStamp startTime;
|
||||
TimeStamp endTime;
|
||||
int numNodes = 1000;
|
||||
const int numNodes = 1000;
|
||||
|
||||
stdList basicList;
|
||||
Basic *basics[numNodes];
|
||||
@@ -385,7 +385,7 @@ static void testStdListTime(FILE *auxFd) {
|
||||
static void testStdListTimeLocked(FILE *auxFd) {
|
||||
TimeStamp startTime;
|
||||
TimeStamp endTime;
|
||||
int numNodes = 1000;
|
||||
const int numNodes = 1000;
|
||||
Mutex mutex;
|
||||
|
||||
stdList basicList;
|
||||
|
||||
@@ -36,7 +36,7 @@ struct Data {
|
||||
};
|
||||
|
||||
|
||||
static int numElements = 5;
|
||||
static const int numElements = 5;
|
||||
typedef QueueElement<Data> DataElement;
|
||||
typedef Queue<Data> DataQueue;
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ void testArray(std::ostream& ofile) {
|
||||
assert(factory!=NULL);
|
||||
|
||||
ofile<<"\tPVBooleanArray\n";
|
||||
bool boolEmpty[] = { };
|
||||
bool boolEmpty[] = { false };
|
||||
bool bv[] = { false, true, false, true, true };
|
||||
PVBooleanArray* pvBoolean = (PVBooleanArray*)factory->createPVScalarArray(
|
||||
NULL, "pvBooleanArray", epics::pvData::pvBoolean);
|
||||
@@ -253,7 +253,7 @@ void testArray(std::ostream& ofile) {
|
||||
delete pvBoolean;
|
||||
|
||||
ofile<<"\tPVByteArray\n";
|
||||
int8 byteEmpty[] = { };
|
||||
int8 byteEmpty[] = { 0 };
|
||||
int8 byv[] = { 0, 1, 2, -1, BYTE_MAX_VALUE, BYTE_MAX_VALUE-1,
|
||||
BYTE_MIN_VALUE+1, BYTE_MIN_VALUE };
|
||||
PVByteArray* pvByte = (PVByteArray*)factory->createPVScalarArray(NULL,
|
||||
@@ -265,7 +265,7 @@ void testArray(std::ostream& ofile) {
|
||||
delete pvByte;
|
||||
|
||||
ofile<<"\tPVShortArray\n";
|
||||
int16 shortEmpty[] = { };
|
||||
int16 shortEmpty[] = { 0 };
|
||||
int16 sv[] = { 0, 1, 2, -1, SHORT_MAX_VALUE, SHORT_MAX_VALUE-1,
|
||||
SHORT_MIN_VALUE+1, SHORT_MIN_VALUE };
|
||||
PVShortArray* pvShort = (PVShortArray*)factory->createPVScalarArray(NULL,
|
||||
@@ -277,7 +277,7 @@ void testArray(std::ostream& ofile) {
|
||||
delete pvShort;
|
||||
|
||||
ofile<<"\tPVIntArray\n";
|
||||
int32 intEmpty[] = { };
|
||||
int32 intEmpty[] = { 0 };
|
||||
int32 iv[] = { 0, 1, 2, -1, INT_MAX_VALUE, INT_MAX_VALUE-1,
|
||||
INT_MIN_VALUE+1, INT_MIN_VALUE };
|
||||
PVIntArray* pvInt = (PVIntArray*)factory->createPVScalarArray(NULL,
|
||||
@@ -289,7 +289,7 @@ void testArray(std::ostream& ofile) {
|
||||
delete pvInt;
|
||||
|
||||
ofile<<"\tPVLongArray\n";
|
||||
int64 longEmpty[] = { };
|
||||
int64 longEmpty[] = { 0 };
|
||||
int64 lv[] = { 0, 1, 2, -1, LONG_MAX_VALUE, LONG_MAX_VALUE-1,
|
||||
LONG_MIN_VALUE+1, LONG_MIN_VALUE };
|
||||
PVLongArray* pvLong = (PVLongArray*)factory->createPVScalarArray(NULL,
|
||||
@@ -301,7 +301,7 @@ void testArray(std::ostream& ofile) {
|
||||
delete pvLong;
|
||||
|
||||
ofile<<"\tPVFloatArray\n";
|
||||
float floatEmpty[] = { };
|
||||
float floatEmpty[] = { (float)0.0 };
|
||||
float fv[] = { (float)0.0, (float)1.1, (float)2.3, (float)-1.4,
|
||||
FLOAT_MAX_VALUE, FLOAT_MAX_VALUE-(float)123456.789, FLOAT_MIN_VALUE
|
||||
+(float)1.1, FLOAT_MIN_VALUE };
|
||||
@@ -314,7 +314,7 @@ void testArray(std::ostream& ofile) {
|
||||
delete pvFloat;
|
||||
|
||||
ofile<<"\tPVDoubleArray\n";
|
||||
double doubleEmpty[] = { };
|
||||
double doubleEmpty[] = { (double)0.0 };
|
||||
double dv[] = { (double)0.0, (double)1.1, (double)2.3, (double)-1.4,
|
||||
DOUBLE_MAX_VALUE, DOUBLE_MAX_VALUE-(double)123456.789,
|
||||
DOUBLE_MIN_VALUE+(double)1.1, DOUBLE_MIN_VALUE };
|
||||
@@ -327,7 +327,7 @@ void testArray(std::ostream& ofile) {
|
||||
delete pvDouble;
|
||||
|
||||
ofile<<"\tPVStringArray\n";
|
||||
String stringEmpty[] = { };
|
||||
String stringEmpty[] = { "" };
|
||||
String
|
||||
strv[] =
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user