fixed some signed/unsigned warnings

This was SVN commit r259.
This commit is contained in:
janwas 2004-05-24 20:27:25 +00:00
parent df6fceba62
commit d63248d276
11 changed files with 241 additions and 238 deletions

View File

@ -1,3 +1,5 @@
#include "precompiled.h"
#include "EntityHandles.h" #include "EntityHandles.h"
#include "EntityManager.h" #include "EntityManager.h"

View File

@ -21,8 +21,13 @@
#include "CStr.h" #include "CStr.h"
#include "Vector3D.h" #include "Vector3D.h"
#pragma warning(push)
#pragma warning(disable:4996)
#include <hash_map> #include <hash_map>
#pragma warning(pop)
class CGenericProperty class CGenericProperty
{ {
public: public:

View File

@ -38,7 +38,7 @@ void CFilePacker::Write(const char* filename,u32 version,const char magicstr[4])
} }
// get size of data // get size of data
u32 datasize=m_Data.size(); u32 datasize=(u32)m_Data.size();
if (fwrite(&datasize,sizeof(datasize),1,fp)!=1) { if (fwrite(&datasize,sizeof(datasize),1,fp)!=1) {
fclose(fp); fclose(fp);
throw CFileWriteError(); throw CFileWriteError();
@ -59,7 +59,7 @@ void CFilePacker::Write(const char* filename,u32 version,const char magicstr[4])
// PackRaw: pack given number of bytes onto the end of the data stream // PackRaw: pack given number of bytes onto the end of the data stream
void CFilePacker::PackRaw(const void* rawdata,u32 rawdatalen) void CFilePacker::PackRaw(const void* rawdata,u32 rawdatalen)
{ {
u32 start=m_Data.size(); u32 start=(u32)m_Data.size();
m_Data.resize(m_Data.size()+rawdatalen); m_Data.resize(m_Data.size()+rawdatalen);
memcpy(&m_Data[start],rawdata,rawdatalen); memcpy(&m_Data[start],rawdata,rawdatalen);
@ -69,7 +69,7 @@ void CFilePacker::PackRaw(const void* rawdata,u32 rawdatalen)
// PackString: pack a string onto the end of the data stream // PackString: pack a string onto the end of the data stream
void CFilePacker::PackString(const CStr& str) void CFilePacker::PackString(const CStr& str)
{ {
u32 len=str.Length(); u32 len=(u32)str.Length();
PackRaw(&len,sizeof(len)); PackRaw(&len,sizeof(len));
PackRaw((const char*) str,len); PackRaw((const char*) str,len);
} }

View File

@ -67,7 +67,7 @@ void CFileUnpacker::Read(const char* filename,const char magicstr[4])
// UnpackRaw: unpack given number of bytes from the input stream into the given array // UnpackRaw: unpack given number of bytes from the input stream into the given array
// - throws CFileEOFError if the end of the data stream is reached before the given // - throws CFileEOFError if the end of the data stream is reached before the given
// number of bytes have been read // number of bytes have been read
void CFileUnpacker::UnpackRaw(void* rawdata,u32 rawdatalen) void CFileUnpacker::UnpackRaw(void* rawdata,size_t rawdatalen)
{ {
// got enough data to unpack? // got enough data to unpack?
if (m_UnpackPos+rawdatalen<=m_Data.size()) { if (m_UnpackPos+rawdatalen<=m_Data.size()) {

View File

@ -40,7 +40,7 @@ public:
// UnpackRaw: unpack given number of bytes from the input stream into the given array // UnpackRaw: unpack given number of bytes from the input stream into the given array
// - throws CFileEOFError if the end of the data stream is reached before the given // - throws CFileEOFError if the end of the data stream is reached before the given
// number of bytes have been read // number of bytes have been read
void UnpackRaw(void* rawdata,u32 rawdatalen); void UnpackRaw(void* rawdata,size_t rawdatalen);
// UnpackString: unpack a string from the raw data stream // UnpackString: unpack a string from the raw data stream
void UnpackString(CStr& result); void UnpackString(CStr& result);

View File

@ -5,6 +5,7 @@
#include "MapReader.h" #include "MapReader.h"
#include "UnitManager.h" #include "UnitManager.h"
#include "ObjectManager.h" #include "ObjectManager.h"
#include "BaseEntity.h" #include "BaseEntity.h"
#include "BaseEntityCollection.h" #include "BaseEntityCollection.h"
#include "EntityManager.h" #include "EntityManager.h"

View File

@ -101,7 +101,8 @@ void CPatchRData::BuildBlends()
} }
} }
if (neighbourTextures.size()>0) { if (neighbourTextures.size()>0) {
u32 count=neighbourTextures.size(); // u32 count=neighbourTextures.size();
// janwas fixing warnings: not used?
// sort textures from lowest to highest priority // sort textures from lowest to highest priority
std::sort(neighbourTextures.begin(),neighbourTextures.end()); std::sort(neighbourTextures.begin(),neighbourTextures.end());
@ -476,7 +477,7 @@ void CPatchRData::RenderStreams(u32 streamflags)
if (streamflags & STREAM_UV0) glTexCoordPointer(2,GL_FLOAT,sizeof(SBaseVertex),base+offsetof(SBaseVertex,m_UVs)); if (streamflags & STREAM_UV0) glTexCoordPointer(2,GL_FLOAT,sizeof(SBaseVertex),base+offsetof(SBaseVertex,m_UVs));
// render all base splats at once // render all base splats at once
glDrawElements(GL_QUADS,m_Indices.size(),GL_UNSIGNED_SHORT,&m_Indices[0]); glDrawElements(GL_QUADS,(GLsizei)m_Indices.size(),GL_UNSIGNED_SHORT,&m_Indices[0]);
// bump stats // bump stats
g_Renderer.m_Stats.m_DrawCalls++; g_Renderer.m_Stats.m_DrawCalls++;

View File

@ -24,7 +24,7 @@ void CTextureManager::AddTextureType(const char* name)
m_TerrainTextures.resize(m_TerrainTextures.size()+1); m_TerrainTextures.resize(m_TerrainTextures.size()+1);
STextureType& ttype=m_TerrainTextures.back(); STextureType& ttype=m_TerrainTextures.back();
ttype.m_Name=name; ttype.m_Name=name;
ttype.m_Index=m_TerrainTextures.size()-1; ttype.m_Index=(int)(m_TerrainTextures.size()-1);
} }
CTextureEntry* CTextureManager::FindTexture(const char* filename) CTextureEntry* CTextureManager::FindTexture(const char* filename)

View File

@ -7,16 +7,10 @@
#include "ObjectManager.h" #include "ObjectManager.h"
#include "Prometheus.h" #include "Prometheus.h"
#include "time.h"
#include "sdl.h" #include "sdl.h"
#include "res/tex.h" #include "res/tex.h"
#include "detect.h" #include "detect.h"
#include <malloc.h>
// TODO: fix scrolling hack - framerate independent, use SDL
//#include "win.h" // REMOVEME
void InitScene (); void InitScene ();
void InitResources (); void InitResources ();
void RenderScene (); void RenderScene ();