Core/DBLayer:

- Fix another pesky linux specific compile error. (Thanks to Derex/Aokromes)
- Fix a typo in an assertion. (Thanks to Derex/Aokromes)
- Add proper zero termination in SetStructuredValue to get rid of memory issues that arose in the last few commits.
- Fix a crash caused by vsprintf´ing std::string in SystemMgr::LoadVersion()

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-09-25 01:02:40 +02:00
parent 09aeff1027
commit 154d11acc0
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ void SystemMgr::LoadVersion()
{
Field* pFields = Result->Fetch();
sLog.outString("TSCR: Database version is: %s", pFields[0].GetString());
sLog.outString("TSCR: Database version is: %s", pFields[0].GetCString());
sLog.outString();
}
else
+2 -2
View File
@@ -30,7 +30,7 @@ Field::~Field()
CleanUp();
}
void Field::SetByteValue(void* newValue, const size_t newSize, enum_field_types newType, uint32 length)
void Field::SetByteValue(const void* newValue, const size_t newSize, enum_field_types newType, uint32 length)
{
// This value stores raw bytes that have to be explicitly casted later
if (newValue)
@@ -50,7 +50,7 @@ void Field::SetStructuredValue(char* newValue, enum_field_types newType, const s
{
size_t size = strlen(newValue);
data.value = new char [size+1];
memcpy(data.value, newValue, size);
strcpy((char*)data.value, newValue);
data.length = size;
}
+1 -1
View File
@@ -248,7 +248,7 @@ class Field
uint32 length; // Length (prepared strings only)
} data;
void SetByteValue(void* newValue, const size_t newSize, enum_field_types newType, uint32 length);
void SetByteValue(const void* newValue, const size_t newSize, enum_field_types newType, uint32 length);
void SetStructuredValue(char* newValue, enum_field_types newType, const size_t newSize);
void CleanUp()
+1 -1
View File
@@ -45,7 +45,7 @@ class ResultSet
Field *Fetch() const { return m_currentRow; }
const Field & operator [] (uint32 index) const
{
ASSERT(index < m_rowCount);
ASSERT(index < m_fieldCount);
return m_currentRow[index];
}