aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-09-25 01:02:40 +0200
committerMachiavelli <none@none>2010-09-25 01:02:40 +0200
commit154d11acc0afdf3639e6a07c931e35674102e44a (patch)
tree48fa416fd1e20b8002ae3ca0f633df978e1cda61 /src
parent09aeff1027176e95352b9818596056b658b897e6 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Scripting/ScriptSystem.cpp2
-rw-r--r--src/server/shared/Database/Field.cpp4
-rw-r--r--src/server/shared/Database/Field.h2
-rwxr-xr-xsrc/server/shared/Database/QueryResult.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index 856981553c2..91f75fe7c28 100644
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -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
diff --git a/src/server/shared/Database/Field.cpp b/src/server/shared/Database/Field.cpp
index f1f9df6f1f7..7afcbdfedaf 100644
--- a/src/server/shared/Database/Field.cpp
+++ b/src/server/shared/Database/Field.cpp
@@ -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;
}
diff --git a/src/server/shared/Database/Field.h b/src/server/shared/Database/Field.h
index 0870f1c8562..42260f41d9e 100644
--- a/src/server/shared/Database/Field.h
+++ b/src/server/shared/Database/Field.h
@@ -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()
diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h
index aa088b5f121..12478a2fc4a 100755
--- a/src/server/shared/Database/QueryResult.h
+++ b/src/server/shared/Database/QueryResult.h
@@ -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];
}