MSVC warnings.

This commit is contained in:
comex 2013-08-30 00:35:36 -04:00
parent de0a5fdfbb
commit 4f5729dd59
8 changed files with 20 additions and 21 deletions

View File

@ -164,12 +164,11 @@ bool TryParse(const std::string &str, u32 *const output)
if (errno == ERANGE)
return false;
if (ULONG_MAX > UINT_MAX) {
// Note: The typecasts avoid GCC warnings when long is 32 bits wide.
if (value >= static_cast<unsigned long>(0x100000000ull)
&& value <= static_cast<unsigned long>(0xFFFFFFFF00000000ull))
#if ULONG_MAX > UINT_MAX
if (value >= 0x100000000ull
&& value <= 0xFFFFFFFF00000000ull)
return false;
}
#endif
*output = static_cast<u32>(value);
return true;
@ -270,7 +269,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
{
while(1)
{
const int pos = result.find(src);
size_t pos = result.find(src);
if (pos == -1) break;
result.replace(pos, src.size(), dest);
}
@ -317,7 +316,7 @@ std::string UriDecode(const std::string & sSrc)
// for future extension"
const unsigned char * pSrc = (const unsigned char *)sSrc.c_str();
const int SRC_LEN = sSrc.length();
const size_t SRC_LEN = sSrc.length();
const unsigned char * const SRC_END = pSrc + SRC_LEN;
const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%'
@ -379,7 +378,7 @@ std::string UriEncode(const std::string & sSrc)
{
const char DEC2HEX[16 + 1] = "0123456789ABCDEF";
const unsigned char * pSrc = (const unsigned char *)sSrc.c_str();
const int SRC_LEN = sSrc.length();
const size_t SRC_LEN = sSrc.length();
unsigned char * const pStart = new unsigned char[SRC_LEN * 3];
unsigned char * pEnd = pStart;
const unsigned char * const SRC_END = pSrc + SRC_LEN;

View File

@ -878,7 +878,7 @@ bool ConditionalCode(const ARAddr addr, const u32 data, int* const pSkipCount)
// Skip lines until a "00000000 40000000" line is reached
case CONDTIONAL_ALL_LINES:
case CONDTIONAL_ALL_LINES_UNTIL:
*pSkipCount = -addr.subtype;
*pSkipCount = -(int) addr.subtype;
break;
default:

View File

@ -342,7 +342,7 @@ void DSPEmitter::Compile(u16 start_addr)
if (!unresolvedJumps[i].empty())
{
// Check if there were any blocks waiting for this block to be linkable
unsigned int size = unresolvedJumps[i].size();
size_t size = unresolvedJumps[i].size();
unresolvedJumps[i].remove(start_addr);
if (unresolvedJumps[i].size() < size)
{

View File

@ -932,12 +932,12 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
{
switch(regs[dreg].size)
{
case 2: emitter.MOV(16, reg, Imm16(arg.offset)); break;
case 4: emitter.MOV(32, reg, Imm32(arg.offset)); break;
case 2: emitter.MOV(16, reg, Imm16((u16) arg.offset)); break;
case 4: emitter.MOV(32, reg, Imm32((u32) arg.offset)); break;
#ifdef _M_X64
case 8:
if ((s32)arg.offset == (s64)arg.offset)
emitter.MOV(64, reg, Imm32(arg.offset));
if ((u32) arg.offset == arg.offset)
emitter.MOV(64, reg, Imm32((u32) arg.offset));
else
emitter.MOV(64, reg, Imm64(arg.offset));
break;

View File

@ -75,14 +75,14 @@ void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
m_RecordAnalyzer.AnalyzeGPCommand(data);
// Copy data to buffer
u32 currentSize = m_FifoData.size();
size_t currentSize = m_FifoData.size();
m_FifoData.resize(currentSize + size);
memcpy(&m_FifoData[currentSize], data, size);
}
if (m_FrameEnded && m_FifoData.size() > 0)
{
u32 dataSize = m_FifoData.size();
size_t dataSize = m_FifoData.size();
m_CurrentFrame.fifoDataSize = dataSize;
m_CurrentFrame.fifoData = new u8[dataSize];
memcpy(m_CurrentFrame.fifoData, &m_FifoData[0], dataSize);

View File

@ -410,7 +410,7 @@ u32 Read_Instruction(const u32 em_address)
return inst.hex;
}
void WriteBigEData(const u8 *_pData, const u32 _Address, const u32 _iSize)
void WriteBigEData(const u8 *_pData, const u32 _Address, const size_t _iSize)
{
memcpy(GetPointer(_Address), _pData, _iSize);
}

View File

@ -160,7 +160,7 @@ void Write_U64_Swap(const u64 _Data, const u32 _Address);
void WriteHW_U32(const u32 _Data, const u32 _Address);
void GetString(std::string& _string, const u32 _Address);
void WriteBigEData(const u8 *_pData, const u32 _Address, const u32 size);
void WriteBigEData(const u8 *_pData, const u32 _Address, const size_t size);
void ReadBigEData(u8 *_pDest, const u32 _Address, const u32 size);
u8* GetPointer(const u32 _Address);
void DMA_LCToMemory(const u32 _iMemAddr, const u32 _iCacheAddr, const u32 _iNumBlocks);

View File

@ -81,7 +81,7 @@ bool WbfsFileReader::ReadHeader()
hd_sector_count = Common::swap32(hd_sector_count);
m_files[0]->file.ReadBytes(&hd_sector_shift, 1);
hd_sector_size = 1 << hd_sector_shift;
hd_sector_size = 1ull << hd_sector_shift;
if(m_size != hd_sector_count * hd_sector_size)
{
@ -91,7 +91,7 @@ bool WbfsFileReader::ReadHeader()
// Read wbfs cluster info
m_files[0]->file.ReadBytes(&wbfs_sector_shift, 1);
wbfs_sector_size = 1 << wbfs_sector_shift;
wbfs_sector_size = 1ull << wbfs_sector_shift;
wbfs_sector_count = m_size / wbfs_sector_size;
if(wbfs_sector_size < wii_sector_size)