- cleanup compiler warnings

This commit is contained in:
Mark Vejvoda 2012-11-10 07:31:21 +00:00
parent 2e14844a24
commit 8a0390db35
4 changed files with 21 additions and 12 deletions

View File

@ -284,6 +284,7 @@ unsigned int NetworkMessagePing::getPackedSize() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.pingTime = 0;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormat(),
packedData.messageType,
@ -382,6 +383,7 @@ unsigned int NetworkMessageReady::getPackedSize() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.messageType = nmtReady;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormat(),
packedData.messageType,
@ -1571,6 +1573,7 @@ unsigned int NetworkMessageQuit::getPackedSize() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.messageType = nmtQuit;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormat(),
packedData.messageType);
@ -2527,6 +2530,7 @@ unsigned int PlayerIndexMessage::getPackedSize() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.messageType = nmtPlayerIndexMessage;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormat(),
packedData.messageType,
@ -2615,6 +2619,7 @@ unsigned int NetworkMessageLoadingStatus::getPackedSize() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.messageType = nmtLoadingStatusMessage;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormat(),
packedData.messageType,
@ -2833,6 +2838,7 @@ unsigned int NetworkMessageUnMarkCell::getPackedSize() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.messageType = nmtUnMarkCell;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormat(),
packedData.messageType,
@ -2936,6 +2942,7 @@ unsigned int NetworkMessageHighlightCell::getPackedSize() {
static unsigned int result = 0;
if(result == 0) {
Data packedData;
packedData.messageType = nmtHighlightCell;
unsigned char *buf = new unsigned char[sizeof(packedData)*3];
result = pack(buf, getPackedMessageFormat(),
packedData.messageType,

View File

@ -264,7 +264,7 @@ unsigned int pack(unsigned char *buf, const char *format, ...) {
unsigned int size = 0;
uint16 maxstrlen=0, count;
uint16 maxstrlen=0;
unsigned char *bufStart = buf;
@ -330,7 +330,7 @@ unsigned int pack(unsigned char *buf, const char *format, ...) {
packi64(buf, q);
buf += 8;
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("pack int64 = " MG_I64_SPECIFIER " [%X] q = %ld [%lX] buf pos = %lu\n",(int64)*(buf-8),*(buf-8),q,q,(unsigned long)(buf - bufStart));
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("pack int64 = " MG_I64_SPECIFIER " [%X] q = " MG_I64_SPECIFIER " [%lX] buf pos = %lu\n",(int64)*(buf-8),*(buf-8),q,q,(unsigned long)(buf - bufStart));
break;
case 'Q': // 64-bit unsigned

View File

@ -470,6 +470,8 @@ void PixmapIoBmp::openWrite(const string &path, int w, int h, int components) {
fileHeader.type2='M';
fileHeader.offsetBits=sizeof(BitmapFileHeader)+sizeof(BitmapInfoHeader);
fileHeader.size=sizeof(BitmapFileHeader)+sizeof(BitmapInfoHeader)+3*h*w;
fileHeader.reserved1 = 0;
fileHeader.reserved2 = 0;
static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian();
if(bigEndianSystem == true) {

View File

@ -641,7 +641,7 @@ float LuaArguments::getFloat(int argumentIndex) const {
if(!lua_isnumber(luaState, argumentIndex)) {
throwLuaError("Can not get int from Lua state");
}
float result = luaL_checknumber(luaState, argumentIndex);
float result = static_cast<float>(luaL_checknumber(luaState, argumentIndex));
return result;
}
Vec2f LuaArguments::getVec2f(int argumentIndex) const {
@ -668,7 +668,7 @@ Vec2f LuaArguments::getVec2f(int argumentIndex) const {
//printf("xa = %s argumentIndex = %d\n",lua_tostring(luaState, argumentIndex),argumentIndex);
//v.x= luaL_checkint(luaState, argumentIndex);
v.x= lua_tonumber(luaState, argumentIndex);
v.x= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
//printf("X = %d\n",v.x);
@ -677,7 +677,7 @@ Vec2f LuaArguments::getVec2f(int argumentIndex) const {
//printf("ya = %s\n",lua_tostring(luaState, argumentIndex));
//v.y= luaL_checkint(luaState, argumentIndex);
v.y= lua_tonumber(luaState, argumentIndex);
v.y= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
//printf("Y = %d\n",v.y);
@ -709,7 +709,7 @@ Vec3f LuaArguments::getVec3f(int argumentIndex) const {
//printf("xa = %s argumentIndex = %d\n",lua_tostring(luaState, argumentIndex),argumentIndex);
//v.x= luaL_checkint(luaState, argumentIndex);
v.x= lua_tonumber(luaState, argumentIndex);
v.x= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
//printf("X = %d\n",v.x);
@ -718,7 +718,7 @@ Vec3f LuaArguments::getVec3f(int argumentIndex) const {
//printf("ya = %s\n",lua_tostring(luaState, argumentIndex));
//v.y= luaL_checkint(luaState, argumentIndex);
v.y= lua_tonumber(luaState, argumentIndex);
v.y= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
//printf("Y = %d\n",v.y);
@ -727,7 +727,7 @@ Vec3f LuaArguments::getVec3f(int argumentIndex) const {
//printf("ya = %s\n",lua_tostring(luaState, argumentIndex));
//v.y= luaL_checkint(luaState, argumentIndex);
v.z= lua_tonumber(luaState, argumentIndex);
v.z= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
return v;
@ -757,7 +757,7 @@ Vec4f LuaArguments::getVec4f(int argumentIndex) const {
//printf("xa = %s argumentIndex = %d\n",lua_tostring(luaState, argumentIndex),argumentIndex);
//v.x= luaL_checkint(luaState, argumentIndex);
v.x= lua_tonumber(luaState, argumentIndex);
v.x= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
//printf("X = %d\n",v.x);
@ -766,7 +766,7 @@ Vec4f LuaArguments::getVec4f(int argumentIndex) const {
//printf("ya = %s\n",lua_tostring(luaState, argumentIndex));
//v.y= luaL_checkint(luaState, argumentIndex);
v.y= lua_tonumber(luaState, argumentIndex);
v.y= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
//printf("Y = %d\n",v.y);
@ -775,14 +775,14 @@ Vec4f LuaArguments::getVec4f(int argumentIndex) const {
//printf("ya = %s\n",lua_tostring(luaState, argumentIndex));
//v.y= luaL_checkint(luaState, argumentIndex);
v.z= lua_tonumber(luaState, argumentIndex);
v.z= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
lua_rawgeti(luaState, argumentIndex, 4);
//printf("ya = %s\n",lua_tostring(luaState, argumentIndex));
//v.y= luaL_checkint(luaState, argumentIndex);
v.w= lua_tonumber(luaState, argumentIndex);
v.w= static_cast<float>(lua_tonumber(luaState, argumentIndex));
lua_pop(luaState, 1);
return v;