Core: Fix more warnings and fix compile under linux 64
--HG-- branch : trunk
This commit is contained in:
@@ -34,28 +34,37 @@ struct RawData
|
||||
char time_str[200];
|
||||
};
|
||||
|
||||
void extractDataFromSvn(FILE* EntriesFile, bool url, RawData& data)
|
||||
bool extractDataFromSvn(std::string filename, bool url, RawData& data)
|
||||
{
|
||||
char buf[200];
|
||||
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
||||
if (!EntriesFile)
|
||||
return false;
|
||||
|
||||
char aux[800];
|
||||
char buf[200];
|
||||
char repo_str[200];
|
||||
char num_str[200];
|
||||
bool ret = false;
|
||||
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile); sscanf(buf,"%s",num_str);
|
||||
fgets(buf,200,EntriesFile); sscanf(buf,"%s",repo_str);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile);
|
||||
fgets(buf,200,EntriesFile); sscanf(buf,"%10sT%8s",data.date_str,data.time_str);
|
||||
|
||||
if (fgets(aux, 600, EntriesFile) && fgets(buf, 200, EntriesFile))
|
||||
{
|
||||
sscanf(buf, "%s", num_str);
|
||||
if (fgets(buf, 200, EntriesFile))
|
||||
{
|
||||
sscanf(buf, "%s", repo_str);
|
||||
if (fgets(aux, 800, EntriesFile) && fgets(buf, 200, EntriesFile))
|
||||
{
|
||||
sscanf(buf, "%10sT%8s", data.date_str, data.time_str);
|
||||
if (url)
|
||||
sprintf(data.rev_str,"%s at %s",num_str,repo_str);
|
||||
else
|
||||
strcpy(data.rev_str,num_str);
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(EntriesFile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void extractDataFromHG(FILE* EntriesFile, std::string /*path*/, bool /*url*/, RawData& data)
|
||||
@@ -106,7 +115,8 @@ void extractDataFromArchive(FILE* EntriesFile, std::string /*path*/, bool /*url*
|
||||
char revision_str[200];
|
||||
|
||||
bool found = false;
|
||||
fgets(buf,200,EntriesFile);
|
||||
if (fgets(buf,200,EntriesFile))
|
||||
{
|
||||
while (fgets(buf,200,EntriesFile))
|
||||
{
|
||||
if (sscanf(buf,"%s %s",revision_str,hash_str)==2)
|
||||
@@ -115,6 +125,7 @@ void extractDataFromArchive(FILE* EntriesFile, std::string /*path*/, bool /*url*
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
@@ -252,17 +263,6 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
|
||||
}
|
||||
}
|
||||
|
||||
bool extractDataFromSvn(std::string filename, bool url, RawData& data)
|
||||
{
|
||||
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
||||
if(!EntriesFile)
|
||||
return false;
|
||||
|
||||
extractDataFromSvn(EntriesFile,url,data);
|
||||
fclose(EntriesFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool extractDataFromGit(std::string filename, std::string path, bool url, RawData& data)
|
||||
{
|
||||
FILE* EntriesFile = fopen(filename.c_str(), "r");
|
||||
|
||||
@@ -388,7 +388,8 @@ namespace VMAP
|
||||
// update tree
|
||||
uint32 referencedVal;
|
||||
|
||||
fread(&referencedVal, sizeof(uint32), 1, tf);
|
||||
if (fread(&referencedVal, sizeof(uint32), 1, tf) == 1)
|
||||
{
|
||||
if (!iLoadedSpawns.count(referencedVal))
|
||||
{
|
||||
#ifdef VMAP_DEBUG
|
||||
@@ -412,6 +413,9 @@ namespace VMAP
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
iLoadedTiles[packTileID(tileX, tileY)] = true;
|
||||
fclose(tf);
|
||||
@@ -458,11 +462,12 @@ namespace VMAP
|
||||
// update tree
|
||||
uint32 referencedNode;
|
||||
|
||||
fread(&referencedNode, sizeof(uint32), 1, tf);
|
||||
if (!iLoadedSpawns.count(referencedNode))
|
||||
if (fread(&referencedNode, sizeof(uint32), 1, tf) != 1)
|
||||
result = false;
|
||||
else
|
||||
{
|
||||
if (!iLoadedSpawns.count(referencedNode))
|
||||
sLog.outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
|
||||
}
|
||||
else if (--iLoadedSpawns[referencedNode] == 0)
|
||||
{
|
||||
iTreeValues[referencedNode].setUnloaded();
|
||||
@@ -470,6 +475,7 @@ namespace VMAP
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(tf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1188,7 +1188,7 @@ void MovementInfo::OutDebug()
|
||||
sLog.outString("guid " UI64FMTD, guid);
|
||||
sLog.outString("flags %u", flags);
|
||||
sLog.outString("flags2 %u", flags2);
|
||||
sLog.outString("time %u current time %u", flags2, ::time(NULL));
|
||||
sLog.outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
|
||||
sLog.outString("position: `%s`", pos.ToString().c_str());
|
||||
if (flags & MOVEMENTFLAG_ONTRANSPORT)
|
||||
{
|
||||
|
||||
@@ -85,28 +85,25 @@ bool Map::ExistMap(uint32 mapid,int gx,int gy)
|
||||
char* tmp = new char[len];
|
||||
snprintf(tmp, len, (char *)(sWorld.GetDataPath()+"maps/%03u%02u%02u.map").c_str(),mapid,gx,gy);
|
||||
|
||||
bool ret = false;
|
||||
FILE *pf=fopen(tmp,"rb");
|
||||
|
||||
if (!pf)
|
||||
{
|
||||
sLog.outError("Map file '%s': does not exist!",tmp);
|
||||
delete[] tmp;
|
||||
return false;
|
||||
}
|
||||
|
||||
map_fileheader header;
|
||||
fread(&header, sizeof(header), 1, pf);
|
||||
if (header.mapMagic != uint32(MAP_MAGIC) || header.versionMagic != uint32(MAP_VERSION_MAGIC))
|
||||
else
|
||||
{
|
||||
map_fileheader header;
|
||||
if (fread(&header, sizeof(header), 1, pf) == 1)
|
||||
{
|
||||
if (header.mapMagic != uint32(MAP_MAGIC) || header.versionMagic != uint32(MAP_VERSION_MAGIC))
|
||||
sLog.outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.",tmp);
|
||||
else
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
delete [] tmp;
|
||||
fclose(pf); //close file before return
|
||||
return false;
|
||||
}
|
||||
|
||||
delete [] tmp;
|
||||
fclose(pf);
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Map::ExistVMap(uint32 mapid,int gx,int gy)
|
||||
@@ -1109,7 +1106,13 @@ bool GridMap::loadData(char *filename)
|
||||
FILE *in = fopen(filename, "rb");
|
||||
if (!in)
|
||||
return true;
|
||||
fread(&header, sizeof(header),1,in);
|
||||
|
||||
if (fread(&header, sizeof(header),1,in) != 1)
|
||||
{
|
||||
fclose(in);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header.mapMagic == uint32(MAP_MAGIC) && header.versionMagic == uint32(MAP_VERSION_MAGIC))
|
||||
{
|
||||
// loadup area data
|
||||
@@ -1160,15 +1163,16 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
map_areaHeader header;
|
||||
fseek(in, offset, SEEK_SET);
|
||||
fread(&header, sizeof(header), 1, in);
|
||||
if (header.fourcc != uint32(MAP_AREA_MAGIC))
|
||||
|
||||
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_AREA_MAGIC))
|
||||
return false;
|
||||
|
||||
m_gridArea = header.gridArea;
|
||||
if (!(header.flags & MAP_AREA_NO_AREA))
|
||||
{
|
||||
m_area_map = new uint16 [16*16];
|
||||
fread(m_area_map, sizeof(uint16), 16*16, in);
|
||||
if (fread(m_area_map, sizeof(uint16), 16*16, in) != 16*16)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1177,8 +1181,8 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
map_heightHeader header;
|
||||
fseek(in, offset, SEEK_SET);
|
||||
fread(&header, sizeof(header), 1, in);
|
||||
if (header.fourcc != uint32(MAP_HEIGHT_MAGIC))
|
||||
|
||||
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_HEIGHT_MAGIC))
|
||||
return false;
|
||||
|
||||
m_gridHeight = header.gridHeight;
|
||||
@@ -1188,8 +1192,9 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
m_uint16_V9 = new uint16 [129*129];
|
||||
m_uint16_V8 = new uint16 [128*128];
|
||||
fread(m_uint16_V9, sizeof(uint16), 129*129, in);
|
||||
fread(m_uint16_V8, sizeof(uint16), 128*128, in);
|
||||
if (fread(m_uint16_V9, sizeof(uint16), 129*129, in) != 129*129 ||
|
||||
fread(m_uint16_V8, sizeof(uint16), 128*128, in) != 128*128)
|
||||
return false;
|
||||
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
|
||||
m_gridGetHeight = &GridMap::getHeightFromUint16;
|
||||
}
|
||||
@@ -1197,8 +1202,9 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
m_uint8_V9 = new uint8 [129*129];
|
||||
m_uint8_V8 = new uint8 [128*128];
|
||||
fread(m_uint8_V9, sizeof(uint8), 129*129, in);
|
||||
fread(m_uint8_V8, sizeof(uint8), 128*128, in);
|
||||
if (fread(m_uint8_V9, sizeof(uint8), 129*129, in) != 129*129 ||
|
||||
fread(m_uint8_V8, sizeof(uint8), 128*128, in) != 128*128)
|
||||
return false;
|
||||
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
|
||||
m_gridGetHeight = &GridMap::getHeightFromUint8;
|
||||
}
|
||||
@@ -1206,8 +1212,9 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
m_V9 = new float [129*129];
|
||||
m_V8 = new float [128*128];
|
||||
fread(m_V9, sizeof(float), 129*129, in);
|
||||
fread(m_V8, sizeof(float), 128*128, in);
|
||||
if (fread(m_V9, sizeof(float), 129*129, in) != 129*129 ||
|
||||
fread(m_V8, sizeof(float), 128*128, in) != 128*128)
|
||||
return false;
|
||||
m_gridGetHeight = &GridMap::getHeightFromFloat;
|
||||
}
|
||||
}
|
||||
@@ -1220,8 +1227,8 @@ bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
{
|
||||
map_liquidHeader header;
|
||||
fseek(in, offset, SEEK_SET);
|
||||
fread(&header, sizeof(header), 1, in);
|
||||
if (header.fourcc != uint32(MAP_LIQUID_MAGIC))
|
||||
|
||||
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_LIQUID_MAGIC))
|
||||
return false;
|
||||
|
||||
m_liquidType = header.liquidType;
|
||||
@@ -1234,12 +1241,14 @@ bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
|
||||
if (!(header.flags & MAP_LIQUID_NO_TYPE))
|
||||
{
|
||||
m_liquid_type = new uint8 [16*16];
|
||||
fread(m_liquid_type, sizeof(uint8), 16*16, in);
|
||||
if (fread(m_liquid_type, sizeof(uint8), 16*16, in) != 16*16)
|
||||
return false;
|
||||
}
|
||||
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
|
||||
{
|
||||
m_liquid_map = new float [m_liquid_width*m_liquid_height];
|
||||
fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in);
|
||||
if (fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in) != m_liquid_width*m_liquid_height)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ void TCSoapRunnable::run()
|
||||
pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE);
|
||||
|
||||
struct soap soap;
|
||||
SOCKET m, s;
|
||||
int m, s;
|
||||
soap_init(&soap);
|
||||
soap_set_imode(&soap, SOAP_C_UTFSTRING);
|
||||
soap_set_omode(&soap, SOAP_C_UTFSTRING);
|
||||
|
||||
Reference in New Issue
Block a user