Skip to content

Commit

Permalink
Merge pull request #3 from EQEmu/master
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
josheb committed May 6, 2013
2 parents 05d7c12 + 90c7fab commit 8e49ab9
Show file tree
Hide file tree
Showing 216 changed files with 4,167 additions and 4,149 deletions.
4 changes: 2 additions & 2 deletions common/BasePacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

BasePacket::BasePacket(const unsigned char *buf, uint32 len)
{
this->pBuffer=NULL;
this->pBuffer=nullptr;
this->size=0;
this->_wpos = 0;
this->_rpos = 0;
Expand All @@ -44,7 +44,7 @@ BasePacket::~BasePacket()
{
if (pBuffer)
delete[] pBuffer;
pBuffer=NULL;
pBuffer=nullptr;
}


Expand Down
2 changes: 1 addition & 1 deletion common/BasePacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class BasePacket {

protected:
virtual ~BasePacket();
BasePacket() { pBuffer=NULL; size=0; _wpos = 0; _rpos = 0; }
BasePacket() { pBuffer=nullptr; size=0; _wpos = 0; _rpos = 0; }
BasePacket(const unsigned char *buf, const uint32 len);
};

Expand Down
14 changes: 7 additions & 7 deletions common/Condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@

Condition::Condition()
{
m_events[SignalEvent] = CreateEvent (NULL, // security
m_events[SignalEvent] = CreateEvent (nullptr, // security
FALSE, // is auto-reset event?
FALSE, // is signaled initially?
NULL); // name
m_events[BroadcastEvent] = CreateEvent (NULL, // security
nullptr); // name
m_events[BroadcastEvent] = CreateEvent (nullptr, // security
TRUE, // is auto-reset event?
FALSE, // is signaled initially?
NULL); // name
nullptr); // name
m_waiters = 0;
InitializeCriticalSection(&CSMutex);
}
Expand Down Expand Up @@ -92,8 +92,8 @@ void Condition::Wait()

Condition::Condition()
{
pthread_cond_init(&cond,NULL);
pthread_mutex_init(&mutex,NULL);
pthread_cond_init(&cond,nullptr);
pthread_mutex_init(&mutex,nullptr);
}

void Condition::Signal()
Expand Down Expand Up @@ -129,7 +129,7 @@ struct timeval now;
struct timespec timeout;
int retcode=0;
pthread_mutex_lock(&mutex);
gettimeofday(&now,NULL);
gettimeofday(&now,nullptr);
now.tv_usec+=usec;
timeout.tv_sec = now.tv_sec + (now.tv_usec/1000000);
timeout.tv_nsec = (now.tv_usec%1000000) *1000;
Expand Down
4 changes: 2 additions & 2 deletions common/EQDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ EQDBRes * EQDB::query(Const_char *q) {
return new EQDBRes(r);
} else {
//no result, give them back a 'true but empty' result set
return(new EQDBRes(NULL));
return(new EQDBRes(nullptr));
}
}

return NULL;
return nullptr;
}

//NOT THREAD SAFE!
Expand Down
6 changes: 3 additions & 3 deletions common/EQDBRes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

vector<string> EQDBRes::fetch_row_array() {
vector<string> array;
if(res == NULL)
if(res == nullptr)
return(array);

int count=mysql_num_fields(res);
Expand All @@ -34,14 +34,14 @@ vector<string> EQDBRes::fetch_row_array() {

map<string,string> EQDBRes::fetch_row_hash() {
map<string,string> rowhash;
if(res == NULL)
if(res == nullptr)
return(rowhash);

MYSQL_FIELD *fields;
MYSQL_ROW row;
unsigned long num_fields,i;

if (res && (num_fields=mysql_num_fields(res)) && (row = mysql_fetch_row(res))!=NULL && (fields = mysql_fetch_fields(res))!=NULL) {
if (res && (num_fields=mysql_num_fields(res)) && (row = mysql_fetch_row(res))!=nullptr && (fields = mysql_fetch_fields(res))!=nullptr) {
for(i=0;i<num_fields;i++) {
rowhash[fields[i].name]=(row[i] ? row[i] : "");
}
Expand Down
2 changes: 1 addition & 1 deletion common/EQDBRes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EQDBRes {
unsigned long num_rows() { return (res) ? mysql_num_rows(res) : 0; }
unsigned long num_fields() { return (res) ? mysql_num_fields(res) : 0; }
void DESTROY() { }
void finish() { if (res) mysql_free_result(res); res=NULL; };
void finish() { if (res) mysql_free_result(res); res=nullptr; };
vector<string> fetch_row_array();
map<string,string> fetch_row_hash();
unsigned long * fetch_lengths() { return (res) ? mysql_fetch_lengths(res) : 0; }
Expand Down
12 changes: 6 additions & 6 deletions common/EQEmuConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <sstream>

string EQEmuConfig::ConfigFile = "eqemu_config.xml";
EQEmuConfig *EQEmuConfig::_config = NULL;
EQEmuConfig *EQEmuConfig::_config = nullptr;

void EQEmuConfig::do_world(TiXmlElement *ele) {
const char *text;
Expand Down Expand Up @@ -100,12 +100,12 @@ void EQEmuConfig::do_world(TiXmlElement *ele) {

// Check for locked
sub_ele = ele->FirstChildElement("locked");
if (sub_ele != NULL)
if (sub_ele != nullptr)
Locked=true;

// Get the <tcp> element
sub_ele = ele->FirstChildElement("tcp");
if(sub_ele != NULL) {
if(sub_ele != nullptr) {

text = sub_ele->Attribute("ip");
if (text)
Expand All @@ -123,7 +123,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele) {

// Get the <http> element
sub_ele = ele->FirstChildElement("http");
if(sub_ele != NULL) {
if(sub_ele != nullptr) {

// text = sub_ele->Attribute("ip");
// if (text)
Expand Down Expand Up @@ -228,7 +228,7 @@ void EQEmuConfig::do_zones(TiXmlElement *ele) {

// Get the <ports> element
sub_ele = ele->FirstChildElement("ports");
if(sub_ele != NULL) {
if(sub_ele != nullptr) {

text = sub_ele->Attribute("low");
if (text)
Expand Down Expand Up @@ -296,7 +296,7 @@ void EQEmuConfig::do_launcher(TiXmlElement *ele) {

// Get the <timers> element
sub_ele = ele->FirstChildElement("timers");
if(sub_ele != NULL) {
if(sub_ele != nullptr) {
text = sub_ele->Attribute("restart");
if (text)
RestartWait = atoi(text);
Expand Down
4 changes: 2 additions & 2 deletions common/EQEmuConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class EQEmuConfig : public XMLParser {

// Produce a const singleton
static const EQEmuConfig *get() {
if (_config == NULL)
if (_config == nullptr)
LoadConfig();
return(_config);
}
Expand All @@ -214,7 +214,7 @@ class EQEmuConfig : public XMLParser {

// Load the config
static bool LoadConfig() {
if (_config != NULL)
if (_config != nullptr)
delete _config;
_config=new EQEmuConfig;

Expand Down
4 changes: 2 additions & 2 deletions common/EQPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ uint32 offset;
memcpy(pBuffer,buf+offset,len-offset);
size=len-offset;
} else {
pBuffer=NULL;
pBuffer=nullptr;
size=0;
}
OpMgr=&RawOpcodeManager;
Expand Down Expand Up @@ -294,7 +294,7 @@ get running again... but might be a good thing some day.
bool EQApplicationPacket::combine(const EQApplicationPacket *rhs)
{
uint32 newsize=0, offset=0;
unsigned char *tmpbuffer=NULL;
unsigned char *tmpbuffer=nullptr;
if (opcode!=OP_AppCombined) {
newsize=app_opcode_size+size+(size>254?3:1)+app_opcode_size+rhs->size+(rhs->size>254?3:1);
Expand Down
8 changes: 4 additions & 4 deletions common/EQPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class EQPacket : public BasePacket {

EQPacket(EmuOpcode opcode, const unsigned char *buf, const uint32 len);
// EQPacket(const EQPacket &p) { }
EQPacket() { emu_opcode=OP_Unknown; pBuffer=NULL; size=0; }
EQPacket() { emu_opcode=OP_Unknown; pBuffer=nullptr; size=0; }

};

Expand Down Expand Up @@ -102,11 +102,11 @@ class EQApplicationPacket : public EQPacket {
// friend class EQProtocolPacket;
friend class EQStream;
public:
EQApplicationPacket() : EQPacket(OP_Unknown,NULL,0)
EQApplicationPacket() : EQPacket(OP_Unknown,nullptr,0)
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
EQApplicationPacket(const EmuOpcode op) : EQPacket(op,NULL,0)
EQApplicationPacket(const EmuOpcode op) : EQPacket(op,nullptr,0)
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op,NULL,len)
EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op,nullptr,len)
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
EQApplicationPacket(const EmuOpcode op, const unsigned char *buf, const uint32 len) : EQPacket(op,buf,len)
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
Expand Down
Loading

0 comments on commit 8e49ab9

Please sign in to comment.