- cleaned up a whole pile of compiler warnings

This commit is contained in:
Mark Vejvoda 2010-10-21 15:21:46 +00:00
parent d5117ed7fa
commit 06b9d7eef7
7 changed files with 25 additions and 22 deletions

View File

@ -42,7 +42,7 @@ static const int MAX_MAP_CELL_DIMENSION = 1024;
static const int MIN_MAP_CELL_HEIGHT = 0;
static const int MAX_MAP_CELL_HEIGHT = 20;
static const int DEFAULT_MAP_CELL_HEIGHT = 10;
static const int DEFAULT_MAP_CELL_HEIGHT = 10;
static const int MIN_MAP_FACTIONCOUNT = 1;
static const int MAX_MAP_FACTIONCOUNT = 8;

View File

@ -13,10 +13,13 @@
#define _SHARED_UTIL_CONVERSION_H_
#include <string>
#include "types.h"
#include "leak_dumper.h"
using std::string;
using namespace Shared::Platform;
namespace Shared { namespace Util {
bool strToBool(const string &s);
@ -28,7 +31,7 @@ bool strToInt(const string &s, int *i);
bool strToFloat(const string &s, float *f);
string boolToStr(bool b);
string intToStr(int i);
string intToStr(int64 i);
string intToHex(int i);
string floatToStr(float f,int precsion=2);
string doubleToStr(double f,int precsion=2);

View File

@ -203,7 +203,7 @@ void * LuaArguments::getGenericData(int argumentIndex) const{
// return (void *)result;
//}
else if(lua_isnumber(luaState, argumentIndex)) {
int result = luaL_checkinteger(luaState, argumentIndex);
lua_Integer result = luaL_checkinteger(luaState, argumentIndex);
printf("\nGENERIC param %d is an int, %d!\n",argumentIndex,result);
return (void *)result;
}

View File

@ -35,7 +35,7 @@ MapPreview::MapPreview() {
cells.clear();
//startLocations = NULL;
startLocations.clear();
reset(DEFAULT_MAP_CELL_WIDTH, DEFAULT_MAP_CELL_LENGTH, DEFAULT_MAP_CELL_HEIGHT, DEFAULT_MAP_CELL_SURFACE_TYPE);
reset(DEFAULT_MAP_CELL_WIDTH, DEFAULT_MAP_CELL_LENGTH, (float)DEFAULT_MAP_CELL_HEIGHT, DEFAULT_MAP_CELL_SURFACE_TYPE);
resetFactions(DEFAULT_MAP_FACTIONCOUNT);
title = "";
desc = "";
@ -144,22 +144,22 @@ void MapPreview::pirateChangeHeight(int x, int y, int height, int radius) {
int indexJ = 0;
for (int j = y - radius; j <= y + radius; j += radius) {
// round off the corners
int ti, tj;
int ti=0, tj=0;
if (abs(i - x) == abs(j - y)) {
ti = (i - x) * 0.707 + x + 0.5;
tj = (j - y) * 0.707 + y + 0.5;
ti = (int)((i - x) * 0.707 + x + 0.5);
tj = (int)((j - y) * 0.707 + y + 0.5);
} else {
ti = i;
tj = j;
}
if (inside(ti, tj)) {
gradient[indexI][indexJ] = (cells[ti][tj].height - goalAlt) / radius;
gradient[indexI][indexJ] = (cells[ti][tj].height - (float)goalAlt) / (float)radius;
//} else if (dist == 0) {
//gradient[indexI][indexJ] = 0;
}
else {
// assume outside the map bounds is height 10
gradient[indexI][indexJ] = (10.0 - goalAlt) / radius;
gradient[indexI][indexJ] = (10.0f - (float)goalAlt) / (float)radius;
}
//std::cout << "gradient[" << indexI << "][" << indexJ << "] = " << gradient[indexI][indexJ] << std::endl;
//std::cout << "derived from height " << cells[ti][tj].height << " at " << ti << " " << tj << std::endl;
@ -658,7 +658,7 @@ void MapPreview::loadFromFile(const string &path) {
}
//read Heights
reset(header.width, header.height, DEFAULT_MAP_CELL_HEIGHT, DEFAULT_MAP_CELL_SURFACE_TYPE);
reset(header.width, header.height, (float)DEFAULT_MAP_CELL_HEIGHT, DEFAULT_MAP_CELL_SURFACE_TYPE);
for (int j = 0; j < h; ++j) {
for (int i = 0; i < w; ++i) {
bytes = fread(&cells[i][j].height, sizeof(float), 1, f1);

View File

@ -838,7 +838,7 @@ bool Socket::hasDataToRead(std::map<PLATFORM_SOCKET,bool> &socketTriggeredList)
int retval = 0;
{
//MutexSafeWrapper safeMutex(&dataSynchAccessor);
retval = select(imaxsocket + 1, &rfds, NULL, NULL, &tv);
retval = select((int)imaxsocket + 1, &rfds, NULL, NULL, &tv);
}
if(retval < 0)
{
@ -899,7 +899,7 @@ bool Socket::hasDataToRead(PLATFORM_SOCKET socket)
int retval = 0;
{
//MutexSafeWrapper safeMutex(&dataSynchAccessor);
retval = select(socket + 1, &rfds, NULL, NULL, &tv);
retval = select((int)socket + 1, &rfds, NULL, NULL, &tv);
}
if(retval)
{
@ -1188,7 +1188,7 @@ bool Socket::isReadable() {
int i = 0;
{
//MutexSafeWrapper safeMutex(&dataSynchAccessor);
i= select(sock+1, &set, NULL, NULL, &tv);
i= select((int)sock + 1, &set, NULL, NULL, &tv);
}
if(i < 0) {
if(difftime(time(NULL),lastDebugEvent) >= 1) {
@ -1218,7 +1218,7 @@ bool Socket::isWritable(bool waitOnDelayedResponse) {
int i = 0;
{
//MutexSafeWrapper safeMutex(&dataSynchAccessor);
i = select(sock+1, NULL, &set, NULL, &tv);
i = select((int)sock + 1, NULL, &set, NULL, &tv);
}
if(i < 0 ) {
if(difftime(time(NULL),lastDebugEvent) >= 1) {
@ -1395,7 +1395,7 @@ void ClientSocket::connect(const Ip &ip, int port)
{
MutexSafeWrapper safeMutex(&dataSynchAccessor);
err = select(sock+1, NULL, &myset, NULL, &tv);
err = select((int)sock + 1, NULL, &myset, NULL, &tv);
}
if (err < 0 && getLastSocketError() != PLATFORM_SOCKET_INTERRUPTED)

View File

@ -104,7 +104,7 @@ string boolToStr(bool b){
}
}
string intToStr(int i){
string intToStr(int64 i){
char str[strSize]="";
sprintf(str, "%d", i);
return str;

View File

@ -41,7 +41,7 @@ public:
char msgStr[strSize], fileStr[strSize];
XMLString::transcode(domError.getMessage(), msgStr, strSize-1);
XMLString::transcode(domError.getLocation()->getURI(), fileStr, strSize-1);
int lineNumber= domError.getLocation()->getLineNumber();
XMLFileLoc lineNumber= domError.getLocation()->getLineNumber();
throw runtime_error("Error parsing XML, file: " + string(fileStr) + ", line: " + intToStr(lineNumber) + ": " + string(msgStr));
}
return true;
@ -54,23 +54,23 @@ public:
bool XmlIo::initialized= false;
XmlIo::XmlIo(){
XmlIo::XmlIo() {
try{
XMLPlatformUtils::Initialize();
}
catch(const XMLException &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system\n",__FILE__,__FUNCTION__,__LINE__);
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system, msg %s\n",__FILE__,__FUNCTION__,__LINE__,e.getMessage());
throw runtime_error("Error initializing XML system");
}
try{
try {
XMLCh str[strSize];
XMLString::transcode("LS", str, strSize-1);
implementation = DOMImplementationRegistry::getDOMImplementation(str);
}
catch(const DOMException &ex){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while creating XML parser\n",__FILE__,__FUNCTION__,__LINE__);
catch(const DOMException &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while creating XML parser, msg: %s\n",__FILE__,__FUNCTION__,__LINE__,ex.getMessage());
throw runtime_error("Exception while creating XML parser");
}
}