From: <sk...@us...> - 2014-07-31 21:15:36
|
Revision: 59946 http://sourceforge.net/p/firebird/code/59946 Author: skidder Date: 2014-07-31 21:15:33 +0000 (Thu, 31 Jul 2014) Log Message: ----------- Fix MSVC build errors and warnings Modified Paths: -------------- firebird/trunk/src/jrd/Monitoring.cpp firebird/trunk/src/jrd/Monitoring.h firebird/trunk/src/jrd/TempSpace.cpp Modified: firebird/trunk/src/jrd/Monitoring.cpp =================================================================== --- firebird/trunk/src/jrd/Monitoring.cpp 2014-07-31 16:30:12 UTC (rev 59945) +++ firebird/trunk/src/jrd/Monitoring.cpp 2014-07-31 21:15:33 UTC (rev 59946) @@ -50,6 +50,11 @@ #include "../jrd/Monitoring.h" #include "../jrd/Function.h" +#ifdef WIN_NT +#include <process.h> +#define getpid _getpid +#endif + const char* const SCRATCH = "fb_monitor_"; using namespace Firebird; @@ -487,7 +492,7 @@ while (dumpRecord.getField(dumpField)) { const USHORT fid = dumpField.id; - const size_t length = dumpField.length; + const FB_SIZE_T length = dumpField.length; const char* source = (const char*) dumpField.data; // All the strings that may require transliteration (i.e. the target charset is not NONE) @@ -541,7 +546,7 @@ void SnapshotData::clearSnapshot() { - for (size_t i = 0; i < m_snapshot.getCount(); i++) + for (FB_SIZE_T i = 0; i < m_snapshot.getCount(); i++) delete m_snapshot[i].data; m_snapshot.clear(); @@ -558,7 +563,7 @@ RecordBuffer* SnapshotData::getData(int id) const { - for (size_t i = 0; i < m_snapshot.getCount(); i++) + for (FB_SIZE_T i = 0; i < m_snapshot.getCount(); i++) { if (m_snapshot[i].rel_id == id) return m_snapshot[i].data; Modified: firebird/trunk/src/jrd/Monitoring.h =================================================================== --- firebird/trunk/src/jrd/Monitoring.h 2014-07-31 16:30:12 UTC (rev 59945) +++ firebird/trunk/src/jrd/Monitoring.h 2014-07-31 21:15:33 UTC (rev 59946) @@ -163,9 +163,9 @@ } private: - void storeField(int field_id, ValueType type, size_t length, const void* value) + void storeField(int field_id, ValueType type, FB_SIZE_T length, const void* value) { - const size_t delta = sizeof(UCHAR) + sizeof(UCHAR) + sizeof(USHORT) + length; + const FB_SIZE_T delta = sizeof(UCHAR) + sizeof(UCHAR) + sizeof(USHORT) + length; buffer.resize(offset + delta); UCHAR* ptr = buffer.begin() + offset; Modified: firebird/trunk/src/jrd/TempSpace.cpp =================================================================== --- firebird/trunk/src/jrd/TempSpace.cpp 2014-07-31 16:30:12 UTC (rev 59945) +++ firebird/trunk/src/jrd/TempSpace.cpp 2014-07-31 21:15:33 UTC (rev 59946) @@ -264,12 +264,12 @@ fb_assert(head == tail); delete head; head = tail = NULL; - size = FB_ALIGN(logicalSize, minBlockSize); + size = static_cast<FB_SIZE_T>(FB_ALIGN(logicalSize, minBlockSize)); physicalSize = size; } else { - size = FB_ALIGN(logicalSize - physicalSize, minBlockSize); + size = static_cast<FB_SIZE_T>(FB_ALIGN(logicalSize - physicalSize, minBlockSize)); physicalSize += size; } @@ -290,6 +290,10 @@ } } + + // NS 2014-07-31: FIXME: missing exception handling. + // error thrown in block of code below will leave TempSpace in inconsistent state: + // logical/physical size already increased while allocation has in fact failed. if (!block) { // allocate block in the temp file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |