mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10792] Fixed warnings and need in redundent char* casts in database access code.
This commit is contained in:
parent
7f34658dd2
commit
abc6dfca98
9 changed files with 26 additions and 20 deletions
|
|
@ -492,7 +492,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
|
||||||
struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader>
|
struct SQLCreatureLoader : public SQLStorageLoaderBase<SQLCreatureLoader>
|
||||||
{
|
{
|
||||||
template<class D>
|
template<class D>
|
||||||
void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
|
void convert_from_str(uint32 /*field_pos*/, char const *src, D &dst)
|
||||||
{
|
{
|
||||||
dst = D(sObjectMgr.GetScriptId(src));
|
dst = D(sObjectMgr.GetScriptId(src));
|
||||||
}
|
}
|
||||||
|
|
@ -1849,7 +1849,7 @@ void ObjectMgr::LoadItemLocales()
|
||||||
struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader>
|
struct SQLItemLoader : public SQLStorageLoaderBase<SQLItemLoader>
|
||||||
{
|
{
|
||||||
template<class D>
|
template<class D>
|
||||||
void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
|
void convert_from_str(uint32 /*field_pos*/, char const *src, D &dst)
|
||||||
{
|
{
|
||||||
dst = D(sObjectMgr.GetScriptId(src));
|
dst = D(sObjectMgr.GetScriptId(src));
|
||||||
}
|
}
|
||||||
|
|
@ -5227,7 +5227,7 @@ void ObjectMgr::LoadPageTextLocales()
|
||||||
struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader>
|
struct SQLInstanceLoader : public SQLStorageLoaderBase<SQLInstanceLoader>
|
||||||
{
|
{
|
||||||
template<class D>
|
template<class D>
|
||||||
void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
|
void convert_from_str(uint32 /*field_pos*/, char const *src, D &dst)
|
||||||
{
|
{
|
||||||
dst = D(sObjectMgr.GetScriptId(src));
|
dst = D(sObjectMgr.GetScriptId(src));
|
||||||
}
|
}
|
||||||
|
|
@ -6516,7 +6516,7 @@ void ObjectMgr::LoadGameObjectLocales()
|
||||||
struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader>
|
struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader>
|
||||||
{
|
{
|
||||||
template<class D>
|
template<class D>
|
||||||
void convert_from_str(uint32 /*field_pos*/, char *src, D &dst)
|
void convert_from_str(uint32 /*field_pos*/, char const *src, D &dst)
|
||||||
{
|
{
|
||||||
dst = D(sObjectMgr.GetScriptId(src));
|
dst = D(sObjectMgr.GetScriptId(src));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("The table `%s` in your [%s] database is missing its version info.",table_name,db_name);
|
sLog.outErrorDb("The table `%s` in your [%s] database is missing its version info.",table_name,db_name);
|
||||||
sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.",table_name,db_name);
|
sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.");
|
||||||
sLog.outErrorDb();
|
sLog.outErrorDb();
|
||||||
sLog.outErrorDb("This revision of MaNGOS requires a database updated to:");
|
sLog.outErrorDb("This revision of MaNGOS requires a database updated to:");
|
||||||
sLog.outErrorDb("`%s.sql`",req_sql_update_name);
|
sLog.outErrorDb("`%s.sql`",req_sql_update_name);
|
||||||
|
|
@ -264,7 +264,7 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("The table `%s` in your [%s] database is missing or corrupt.",table_name,db_name);
|
sLog.outErrorDb("The table `%s` in your [%s] database is missing or corrupt.",table_name,db_name);
|
||||||
sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.",table_name,db_name);
|
sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.");
|
||||||
sLog.outErrorDb();
|
sLog.outErrorDb();
|
||||||
sLog.outErrorDb("This revision of mangos requires a database updated to:");
|
sLog.outErrorDb("This revision of mangos requires a database updated to:");
|
||||||
sLog.outErrorDb("`%s.sql`",req_sql_update_name);
|
sLog.outErrorDb("`%s.sql`",req_sql_update_name);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,6 @@ enum Field::DataTypes QueryResultMysql::ConvertNativeType(enum_field_types mysql
|
||||||
case FIELD_TYPE_NULL:
|
case FIELD_TYPE_NULL:
|
||||||
return Field::DB_TYPE_STRING;
|
return Field::DB_TYPE_STRING;
|
||||||
case FIELD_TYPE_TINY:
|
case FIELD_TYPE_TINY:
|
||||||
|
|
||||||
case FIELD_TYPE_SHORT:
|
case FIELD_TYPE_SHORT:
|
||||||
case FIELD_TYPE_LONG:
|
case FIELD_TYPE_LONG:
|
||||||
case FIELD_TYPE_INT24:
|
case FIELD_TYPE_INT24:
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ void SQLStorage::EraseEntry(uint32 id)
|
||||||
else
|
else
|
||||||
offset += 4;
|
offset += 4;
|
||||||
|
|
||||||
reinterpret_cast<void*&>(pIndex[id]) = NULL;
|
pIndex[id] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SQLStorage::Free ()
|
void SQLStorage::Free ()
|
||||||
|
|
|
||||||
|
|
@ -101,13 +101,20 @@ struct SQLStorageLoaderBase
|
||||||
template<class S>
|
template<class S>
|
||||||
void convert_to_str(uint32 field_pos, S src, char * & dst);
|
void convert_to_str(uint32 field_pos, S src, char * & dst);
|
||||||
template<class D>
|
template<class D>
|
||||||
void convert_from_str(uint32 field_pos, char * src, D& dst);
|
void convert_from_str(uint32 field_pos, char const* src, D& dst);
|
||||||
void convert_str_to_str(uint32 field_pos, char *src, char *&dst);
|
void convert_str_to_str(uint32 field_pos, char const* src, char *&dst);
|
||||||
|
|
||||||
|
// trap, no body
|
||||||
|
template<class D>
|
||||||
|
void convert_from_str(uint32 field_pos, char* src, D& dst);
|
||||||
|
void convert_str_to_str(uint32 field_pos, char* src, char *&dst);
|
||||||
private:
|
private:
|
||||||
template<class V>
|
template<class V>
|
||||||
void storeValue(V value, SQLStorage &store, char *p, int x, uint32 &offset);
|
void storeValue(V value, SQLStorage &store, char *p, uint32 x, uint32 &offset);
|
||||||
void storeValue(char * value, SQLStorage &store, char *p, int x, uint32 &offset);
|
void storeValue(char const* value, SQLStorage &store, char *p, uint32 x, uint32 &offset);
|
||||||
|
|
||||||
|
// trap, no body
|
||||||
|
void storeValue(char * value, SQLStorage &store, char *p, uint32 x, uint32 &offset);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SQLStorageLoader : public SQLStorageLoaderBase<SQLStorageLoader>
|
struct SQLStorageLoader : public SQLStorageLoaderBase<SQLStorageLoader>
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ void SQLStorageLoaderBase<T>::convert(uint32 /*field_pos*/, S src, D &dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void SQLStorageLoaderBase<T>::convert_str_to_str(uint32 /*field_pos*/, char *src, char *&dst)
|
void SQLStorageLoaderBase<T>::convert_str_to_str(uint32 /*field_pos*/, char const *src, char *&dst)
|
||||||
{
|
{
|
||||||
if(!src)
|
if(!src)
|
||||||
{
|
{
|
||||||
|
|
@ -53,14 +53,14 @@ void SQLStorageLoaderBase<T>::convert_to_str(uint32 /*field_pos*/, S /*src*/, ch
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
template<class D>
|
template<class D>
|
||||||
void SQLStorageLoaderBase<T>::convert_from_str(uint32 /*field_pos*/, char * /*src*/, D& dst)
|
void SQLStorageLoaderBase<T>::convert_from_str(uint32 /*field_pos*/, char const* /*src*/, D& dst)
|
||||||
{
|
{
|
||||||
dst = 0;
|
dst = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
template<class V>
|
template<class V>
|
||||||
void SQLStorageLoaderBase<T>::storeValue(V value, SQLStorage &store, char *p, int x, uint32 &offset)
|
void SQLStorageLoaderBase<T>::storeValue(V value, SQLStorage &store, char *p, uint32 x, uint32 &offset)
|
||||||
{
|
{
|
||||||
T * subclass = (static_cast<T*>(this));
|
T * subclass = (static_cast<T*>(this));
|
||||||
switch(store.dst_format[x])
|
switch(store.dst_format[x])
|
||||||
|
|
@ -89,7 +89,7 @@ void SQLStorageLoaderBase<T>::storeValue(V value, SQLStorage &store, char *p, in
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void SQLStorageLoaderBase<T>::storeValue(char * value, SQLStorage &store, char *p, int x, uint32 &offset)
|
void SQLStorageLoaderBase<T>::storeValue(char const* value, SQLStorage &store, char *p, uint32 x, uint32 &offset)
|
||||||
{
|
{
|
||||||
T * subclass = (static_cast<T*>(this));
|
T * subclass = (static_cast<T*>(this));
|
||||||
switch(store.dst_format[x])
|
switch(store.dst_format[x])
|
||||||
|
|
@ -203,7 +203,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
|
||||||
case FT_FLOAT:
|
case FT_FLOAT:
|
||||||
storeValue((float)fields[x].GetFloat(), store, p, x, offset); break;
|
storeValue((float)fields[x].GetFloat(), store, p, x, offset); break;
|
||||||
case FT_STRING:
|
case FT_STRING:
|
||||||
storeValue((char*)fields[x].GetString(), store, p, x, offset); break;
|
storeValue((char const*)fields[x].GetString(), store, p, x, offset); break;
|
||||||
}
|
}
|
||||||
++count;
|
++count;
|
||||||
}while( result->NextRow() );
|
}while( result->NextRow() );
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ void SqlDelayThread::run()
|
||||||
// empty the queue before exiting
|
// empty the queue before exiting
|
||||||
|
|
||||||
ACE_Based::Thread::Sleep(loopSleepms);
|
ACE_Based::Thread::Sleep(loopSleepms);
|
||||||
SqlOperation* s;
|
SqlOperation* s = NULL;
|
||||||
while (m_sqlQueue.next(s))
|
while (m_sqlQueue.next(s))
|
||||||
{
|
{
|
||||||
s->Execute(m_dbEngine);
|
s->Execute(m_dbEngine);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ void SqlQuery::Execute(Database *db)
|
||||||
void SqlResultQueue::Update()
|
void SqlResultQueue::Update()
|
||||||
{
|
{
|
||||||
/// execute the callbacks waiting in the synchronization queue
|
/// execute the callbacks waiting in the synchronization queue
|
||||||
MaNGOS::IQueryCallback* callback;
|
MaNGOS::IQueryCallback* callback = NULL;
|
||||||
while (next(callback))
|
while (next(callback))
|
||||||
{
|
{
|
||||||
callback->Execute();
|
callback->Execute();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10791"
|
#define REVISION_NR "10792"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue