From dfaacdf102b22d8c467d8c3cc0b82636b6d8d616 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Tue, 16 Aug 2011 09:10:57 -0400 Subject: [PATCH 1/3] must include boost --- configure/CONFIG_SITE | 1 + 1 file changed, 1 insertion(+) diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index d669cbb..674abe7 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -24,6 +24,7 @@ # define INSTALL_LOCATION here #INSTALL_LOCATION= +USR_INCLUDES += -I/usr/include/boost/tr1 INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv USR_INCLUDES += -I $(INSTALL_LOCATION)/include From 33183d3dd14e95a0301106507e5ab3ec0d52e801 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Wed, 24 Aug 2011 15:44:29 -0400 Subject: [PATCH 2/3] add virtual destructors --- pvDataApp/monitor/monitor.h | 3 +++ pvDataApp/pv/pvData.h | 1 + pvDataApp/pv/pvIntrospect.h | 10 +++++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pvDataApp/monitor/monitor.h b/pvDataApp/monitor/monitor.h index 609626b..02a1d0f 100644 --- a/pvDataApp/monitor/monitor.h +++ b/pvDataApp/monitor/monitor.h @@ -22,6 +22,7 @@ namespace epics { namespace pvData { class MonitorElement { public: POINTER_DEFINITIONS(MonitorElement); + virtual ~MonitorElement(){} /** * Get the PVStructure. * @return The PVStructure. @@ -47,6 +48,7 @@ namespace epics { namespace pvData { class Monitor : public Destroyable, private NoDefaultMethods { public: POINTER_DEFINITIONS(Monitor); + virtual ~Monitor(){} /** * Start monitoring. * @return completion status. @@ -78,6 +80,7 @@ namespace epics { namespace pvData { class MonitorRequester : public virtual Requester { public: POINTER_DEFINITIONS(MonitorRequester); + virtual ~MonitorRequester(){} /** * The client and server have both completed the createMonitor request. * @param status Completion status. diff --git a/pvDataApp/pv/pvData.h b/pvDataApp/pv/pvData.h index 82a801d..d6e6bba 100644 --- a/pvDataApp/pv/pvData.h +++ b/pvDataApp/pv/pvData.h @@ -53,6 +53,7 @@ private: class PostHandler { public: + virtual ~PostHandler(){} virtual void postPut() = 0; }; diff --git a/pvDataApp/pv/pvIntrospect.h b/pvDataApp/pv/pvIntrospect.h index a6873b9..7cfbe9b 100644 --- a/pvDataApp/pv/pvIntrospect.h +++ b/pvDataApp/pv/pvIntrospect.h @@ -62,6 +62,7 @@ namespace ScalarTypeFunc { class Field : public std::tr1::enable_shared_from_this { public: POINTER_DEFINITIONS(Field); + virtual ~Field(); String getFieldName() const{return m_fieldName;} Type getType() const{return m_type;} virtual void toString(StringBuilder buf) const{toString(buf,0);} @@ -69,7 +70,6 @@ public: void renameField(String newName); protected: Field(String fieldName,Type type); - virtual ~Field(); private: String m_fieldName; Type m_type; @@ -88,6 +88,7 @@ private: class Scalar : public Field{ public: POINTER_DEFINITIONS(Scalar); + virtual ~Scalar(); typedef Scalar& reference; typedef const Scalar& const_reference; @@ -96,7 +97,6 @@ public: virtual void toString(StringBuilder buf,int indentLevel) const; protected: Scalar(String fieldName,ScalarType scalarType); - virtual ~Scalar(); private: ScalarType scalarType; friend class FieldCreate; @@ -105,6 +105,7 @@ private: class ScalarArray : public Field{ public: POINTER_DEFINITIONS(ScalarArray); + ScalarArray(String fieldName,ScalarType scalarType); typedef ScalarArray& reference; typedef const ScalarArray& const_reference; @@ -112,7 +113,6 @@ public: virtual void toString(StringBuilder buf) const{toString(buf,0);} virtual void toString(StringBuilder buf,int indentLevel) const; protected: - ScalarArray(String fieldName,ScalarType scalarType); virtual ~ScalarArray(); private: ScalarType elementType; @@ -133,13 +133,14 @@ protected: StructureArray(String fieldName,StructureConstPtr structure); virtual ~StructureArray(); private: - StructureConstPtr pstructure; + StructureConstPtr pstructure; friend class FieldCreate; }; class Structure : public Field { public: POINTER_DEFINITIONS(Structure); + virtual ~Structure(); typedef Structure& reference; typedef const Structure& const_reference; @@ -154,7 +155,6 @@ public: virtual void toString(StringBuilder buf,int indentLevel) const; protected: Structure(String fieldName, int numberFields,FieldConstPtrArray fields); - virtual ~Structure(); private: int numberFields; FieldConstPtrArray fields; From 7aa07aa2cefda24f11faff93f35e0ff0d30c630b Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Tue, 30 Aug 2011 09:34:03 -0400 Subject: [PATCH 3/3] get rid of a lot of warning messages. --- pvDataApp/factory/Convert.cpp | 64 ++++++++++++++++---------------- pvDataApp/property/timeStamp.cpp | 4 +- test/testBaseException | 8 ++-- test/testBaseExceptionDiff | 10 ++--- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/pvDataApp/factory/Convert.cpp b/pvDataApp/factory/Convert.cpp index 3174098..0491dbd 100644 --- a/pvDataApp/factory/Convert.cpp +++ b/pvDataApp/factory/Convert.cpp @@ -704,11 +704,11 @@ int8 Convert::toByte(PVScalar * pv) } case pvFloat: { PVFloat *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvDouble: { PVDouble *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvString: throw std::logic_error(String("string can not be converted to byte")); @@ -741,11 +741,11 @@ int16 Convert::toShort(PVScalar * pv) } case pvFloat: { PVFloat *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvDouble: { PVDouble *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvString: throw std::logic_error(String("string can not be converted to short")); @@ -778,11 +778,11 @@ int32 Convert::toInt(PVScalar * pv) } case pvFloat: { PVFloat *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvDouble: { PVDouble *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvString: throw std::logic_error(String("string can not be converted to int")); @@ -815,11 +815,11 @@ int64 Convert::toLong(PVScalar * pv) } case pvFloat: { PVFloat *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvDouble: { PVDouble *value = static_cast(pv); - return value->get(); + return static_cast(value->get()); } case pvString: throw std::logic_error(String("string can not be converted to long")); @@ -1143,19 +1143,19 @@ void Convert::fromFloat(PVScalar* pv, float from) throw std::logic_error(String("float can not be converted to boolean")); case pvByte: { PVByte *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvShort: { PVShort *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvInt: { PVInt *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvLong: { PVLong *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvFloat: { PVFloat *value = static_cast(pv); @@ -1187,19 +1187,19 @@ void Convert::fromDouble(PVScalar *pv, double from) throw std::logic_error(String("double can not be converted to boolean")); case pvByte: { PVByte *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvShort: { PVShort *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvInt: { PVInt *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvLong: { PVLong *value = static_cast(pv); - value->put(from); return; + value->put(static_cast(from)); return; } case pvFloat: { PVFloat *value = static_cast(pv); @@ -1739,7 +1739,7 @@ int convertToByteArray(PVScalarArray * pv, int offset, int len,int8 to[], int to FloatArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -1757,7 +1757,7 @@ int convertToByteArray(PVScalarArray * pv, int offset, int len,int8 to[], int to DoubleArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -1962,7 +1962,7 @@ int convertToShortArray(PVScalarArray * pv, int offset, int len,int16 to[], int FloatArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -1980,7 +1980,7 @@ int convertToShortArray(PVScalarArray * pv, int offset, int len,int16 to[], int DoubleArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -2185,7 +2185,7 @@ int convertToIntArray(PVScalarArray * pv, int offset, int len,int32 to[], int to FloatArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -2203,7 +2203,7 @@ int convertToIntArray(PVScalarArray * pv, int offset, int len,int32 to[], int to DoubleArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -2408,7 +2408,7 @@ int convertToLongArray(PVScalarArray * pv, int offset, int len,int64 to[], int t FloatArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -2426,7 +2426,7 @@ int convertToLongArray(PVScalarArray * pv, int offset, int len,int64 to[], int t DoubleArray dataArray = data.data; int dataOffset = data.offset; for (int i = 0; i < num; i++) - to[i + toOffset] = dataArray[i + dataOffset]; + to[i + toOffset] = static_cast(dataArray[i + dataOffset]); len -= num; offset += num; toOffset += num; @@ -2456,7 +2456,7 @@ int convertFromFloatArray(PVScalarArray *pv, int offset, int len,float from[], i PVByteArray *pvdata = static_cast(pv); int8 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; @@ -2470,7 +2470,7 @@ int convertFromFloatArray(PVScalarArray *pv, int offset, int len,float from[], i PVShortArray *pvdata = static_cast(pv); int16 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; @@ -2484,7 +2484,7 @@ int convertFromFloatArray(PVScalarArray *pv, int offset, int len,float from[], i PVIntArray *pvdata = static_cast(pv); int32 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; @@ -2498,7 +2498,7 @@ int convertFromFloatArray(PVScalarArray *pv, int offset, int len,float from[], i PVLongArray *pvdata = static_cast(pv); int64 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; @@ -2679,7 +2679,7 @@ int convertFromDoubleArray(PVScalarArray *pv, int offset, int len,double from[], PVByteArray *pvdata = static_cast(pv); int8 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; @@ -2693,7 +2693,7 @@ int convertFromDoubleArray(PVScalarArray *pv, int offset, int len,double from[], PVShortArray *pvdata = static_cast(pv); int16 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; @@ -2707,7 +2707,7 @@ int convertFromDoubleArray(PVScalarArray *pv, int offset, int len,double from[], PVIntArray *pvdata = static_cast(pv); int32 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; @@ -2721,7 +2721,7 @@ int convertFromDoubleArray(PVScalarArray *pv, int offset, int len,double from[], PVLongArray *pvdata = static_cast(pv); int64 data[1]; while (len > 0) { - data[0] = from[fromOffset]; + data[0] = static_cast(from[fromOffset]); if (pvdata->put(offset, 1, data, 0) == 0) return ntransfered; --len; diff --git a/pvDataApp/property/timeStamp.cpp b/pvDataApp/property/timeStamp.cpp index 5314656..f37290f 100644 --- a/pvDataApp/property/timeStamp.cpp +++ b/pvDataApp/property/timeStamp.cpp @@ -156,8 +156,8 @@ TimeStamp & TimeStamp::operator-=(int64 seconds) TimeStamp & TimeStamp::operator+=(double seconds) { - int64 secs = seconds; - int64 nano = (seconds - secs)*1e9; + int64 secs = static_cast(seconds); + int64 nano = static_cast((seconds - secs)*1e9); nanoSeconds += nano; if(nanoSeconds>nanoSecPerSec) { nanoSeconds -= nanoSecPerSec; diff --git a/test/testBaseException b/test/testBaseException index 0de1968..e195adc 100644 --- a/test/testBaseException +++ b/test/testBaseException @@ -5,7 +5,7 @@ There is a logic_error On line 68 of ../testBaseException.cpp ../bin/linux-x86/testBaseException[0x80497b9] ../bin/linux-x86/testBaseException[0x8049a54] -/lib/libc.so.6(__libc_start_main+0xe6)[0x126e36] +/lib/libc.so.6(__libc_start_main+0xe6)[0x3aae36] ../bin/linux-x86/testBaseException[0x80490e1] To translate run 'addr2line -e execname 0xXXXXXXX ...' Note: Must be compiled with debug symbols @@ -17,7 +17,7 @@ On line 75 of ../testBaseException.cpp ../bin/linux-x86/testBaseException() [0x8049cec] ../bin/linux-x86/testBaseException() [0x8049923] ../bin/linux-x86/testBaseException() [0x8049a54] -/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36] +/lib/libc.so.6(__libc_start_main+0xe6) [0x3aae36] ../bin/linux-x86/testBaseException() [0x80490e1] testBaseException... @@ -26,7 +26,7 @@ all is OK On line 48 of ../testBaseException.cpp ../bin/linux-x86/testBaseException() [0x8049581] ../bin/linux-x86/testBaseException() [0x8049a5c] -/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36] +/lib/libc.so.6(__libc_start_main+0xe6) [0x3aae36] ../bin/linux-x86/testBaseException() [0x80490e1] @@ -38,7 +38,7 @@ On line 57 of ../testBaseException.cpp ../bin/linux-x86/testBaseException() [0x80491ec] ../bin/linux-x86/testBaseException() [0x80496f9] ../bin/linux-x86/testBaseException() [0x8049a5c] -/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36] +/lib/libc.so.6(__libc_start_main+0xe6) [0x3aae36] ../bin/linux-x86/testBaseException() [0x80490e1] diff --git a/test/testBaseExceptionDiff b/test/testBaseExceptionDiff index 7a7e2f2..3aecec5 100644 --- a/test/testBaseExceptionDiff +++ b/test/testBaseExceptionDiff @@ -1,5 +1,5 @@ --- testBaseExceptionGold 2011-04-27 13:11:55.000000000 -0400 -+++ testBaseException 2011-06-07 07:20:29.000000000 -0400 ++++ testBaseException 2011-08-30 09:31:21.000000000 -0400 @@ -1,37 +1,46 @@ + + @@ -8,7 +8,7 @@ +On line 68 of ../testBaseException.cpp +../bin/linux-x86/testBaseException[0x80497b9] +../bin/linux-x86/testBaseException[0x8049a54] -+/lib/libc.so.6(__libc_start_main+0xe6)[0x126e36] ++/lib/libc.so.6(__libc_start_main+0xe6)[0x3aae36] +../bin/linux-x86/testBaseException[0x80490e1] +To translate run 'addr2line -e execname 0xXXXXXXX ...' + Note: Must be compiled with debug symbols @@ -20,7 +20,7 @@ +../bin/linux-x86/testBaseException() [0x8049cec] +../bin/linux-x86/testBaseException() [0x8049923] +../bin/linux-x86/testBaseException() [0x8049a54] -+/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36] ++/lib/libc.so.6(__libc_start_main+0xe6) [0x3aae36] +../bin/linux-x86/testBaseException() [0x80490e1] + testBaseException... @@ -34,7 +34,7 @@ +On line 48 of ../testBaseException.cpp +../bin/linux-x86/testBaseException() [0x8049581] +../bin/linux-x86/testBaseException() [0x8049a5c] -+/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36] ++/lib/libc.so.6(__libc_start_main+0xe6) [0x3aae36] +../bin/linux-x86/testBaseException() [0x80490e1] + @@ -67,7 +67,7 @@ +../bin/linux-x86/testBaseException() [0x80491ec] +../bin/linux-x86/testBaseException() [0x80496f9] +../bin/linux-x86/testBaseException() [0x8049a5c] -+/lib/libc.so.6(__libc_start_main+0xe6) [0x126e36] ++/lib/libc.so.6(__libc_start_main+0xe6) [0x3aae36] +../bin/linux-x86/testBaseException() [0x80490e1] +