- bugfixes for malformed debug statements

- updated version to 3.3.5.1
- added more null checks
- changes to try to fix crash when ending a game (delete cells bug)
This commit is contained in:
Mark Vejvoda
2010-07-06 05:30:34 +00:00
parent 35cf6204d6
commit 8478ab80b3
17 changed files with 313 additions and 179 deletions

View File

@@ -17,6 +17,7 @@
#include <map>
#include "thread.h"
#include <curl/curl.h>
#include <cstdio>
using std::string;
using namespace Shared::Platform;
@@ -130,6 +131,9 @@ public:
#ifndef WIN32
#define OutputDebug(type, fmt, ...) SystemFlags::handleDebug (type, fmt, ##__VA_ARGS__)
// Uncomment the line below to get the compiler to warn us of badly formatted printf like statements which could trash memory
//#define OutputDebug(type, fmt, ...) type; printf(fmt, ##__VA_ARGS__)
#else
#define OutputDebug(type, fmt, ...) handleDebug (type, fmt, ##__VA_ARGS__)
#endif

View File

@@ -920,10 +920,10 @@ int Socket::getDataToRead(){
break;
}
else if(hasDataToRead() == true) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, (hasDataToRead() == true) err = %d, sock = %d, size = %u, loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, (hasDataToRead() == true) err = %d, sock = %d, size = %lu, loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount);
}
else {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, err = %d, sock = %d, size = %u, loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING PEEKING SOCKET DATA, err = %d, sock = %d, size = %lu, loopCount = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,size,loopCount);
break;
}
@@ -1320,7 +1320,7 @@ void ClientSocket::connect(const Ip &ip, int port)
}
else
{
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Connected to host [%s] on port = %d sock = %d err = %d", ip.getString().c_str(),port,err);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"Connected to host [%s] on port = %d sock = %d err = %d", ip.getString().c_str(),port,sock,err);
}
}

View File

@@ -249,18 +249,23 @@ bool Window::handleEvent() {
break;
}
}
catch(std::runtime_error& e) {
std::cerr << "(a) Couldn't process event: " << e.what() << " codelocation = " << codeLocation << "\n";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (a) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
catch(const char *e){
std::cerr << "(a1) Couldn't process event: " << e << " codelocation = " << codeLocation << "\n";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str());
throw runtime_error(e);
}
catch(const std::runtime_error& e) {
std::cerr << "(a2) Couldn't process event: " << e.what() << " codelocation = " << codeLocation << "\n";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
throw runtime_error(e.what());
}
catch(std::exception& e) {
catch(const std::exception& e) {
std::cerr << "(b) Couldn't process event: " << e.what() << " codelocation = " << codeLocation << "\n";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
}
catch(...) {
std::cerr << "(c) Couldn't process event: [UNKNOWN ERROR] " << " codelocation = " << codeLocation << "\n";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (b) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -448,7 +453,13 @@ void Window::toggleFullscreen() {
#else
if(Window::allowAltEnterFullscreenToggle == true) {
SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
SDL_Surface *cur_surface = SDL_GetVideoSurface();
if(cur_surface != NULL) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
SDL_WM_ToggleFullScreen(cur_surface);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
#endif

View File

@@ -159,7 +159,7 @@ void OggSoundFileLoader::open(const string &path, SoundInfo *soundInfo){
throw runtime_error("Can't read ogg header info for file: "+path);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] vi->version = %d, vi->channels = %d, vi->rate = %d, vi->bitrate_upper = %d, vi->bitrate_nominal = %d, vi->bitrate_lower = %d, vi->bitrate_window = %d\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),vi->version,vi->channels,vi->rate,vi->bitrate_upper,vi->bitrate_nominal,vi->bitrate_lower,vi->bitrate_window);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] vi->version = %d, vi->channels = %d, vi->rate = %ld, vi->bitrate_upper = %ld, vi->bitrate_nominal = %ld, vi->bitrate_lower = %ld, vi->bitrate_window = %ld\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),vi->version,vi->channels,vi->rate,vi->bitrate_upper,vi->bitrate_nominal,vi->bitrate_lower,vi->bitrate_window);
soundInfo->setChannels(vi->channels);
soundInfo->setsamplesPerSecond(vi->rate);