Merge pull request #4026 from lioncash/constness

EXI: Misc const correctness changes
This commit is contained in:
Pierre Bourdon 2016-07-18 18:19:23 +02:00 committed by GitHub
commit dac1c2d4fe
10 changed files with 14 additions and 14 deletions

View File

@ -43,7 +43,7 @@ bool CEXIETHERNET::IsActivated()
return fd != -1; return fd != -1;
} }
bool CEXIETHERNET::SendFrame(u8* frame, u32 size) bool CEXIETHERNET::SendFrame(const u8* frame, u32 size)
{ {
INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str()); INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str());

View File

@ -100,7 +100,7 @@ bool CEXIETHERNET::IsActivated()
#endif #endif
} }
bool CEXIETHERNET::SendFrame(u8* frame, u32 size) bool CEXIETHERNET::SendFrame(const u8* frame, u32 size)
{ {
#ifdef __linux__ #ifdef __linux__
INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str()); INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str());

View File

@ -307,7 +307,7 @@ static void ReadThreadHandler(CEXIETHERNET* self)
} }
} }
bool CEXIETHERNET::SendFrame(u8* frame, u32 size) bool CEXIETHERNET::SendFrame(const u8* frame, u32 size)
{ {
DEBUG_LOG(SP1, "SendFrame %u bytes:\n%s", size, ArrayToString(frame, size, 0x10).c_str()); DEBUG_LOG(SP1, "SendFrame %u bytes:\n%s", size, ArrayToString(frame, size, 0x10).c_str());

View File

@ -38,7 +38,7 @@ CEXIAgp::~CEXIAgp()
SaveFileFromEEPROM(gbapath + ".sav"); SaveFileFromEEPROM(gbapath + ".sav");
} }
void CEXIAgp::CRC8(u8* data, u32 size) void CEXIAgp::CRC8(const u8* data, u32 size)
{ {
for (u32 it = 0; it < size; it++) for (u32 it = 0; it < size; it++)
{ {

View File

@ -57,7 +57,7 @@ private:
void LoadFileToEEPROM(const std::string& filename); void LoadFileToEEPROM(const std::string& filename);
void SaveFileFromEEPROM(const std::string& filename); void SaveFileFromEEPROM(const std::string& filename);
void LoadRom(); void LoadRom();
void CRC8(u8* data, u32 size); void CRC8(const u8* data, u32 size);
u8 m_hash = 0; u8 m_hash = 0;
u32 m_current_cmd = 0; u32 m_current_cmd = 0;

View File

@ -370,7 +370,7 @@ void CEXIETHERNET::MXCommandHandler(u32 data, u32 size)
} }
} }
void CEXIETHERNET::DirectFIFOWrite(u8* data, u32 size) void CEXIETHERNET::DirectFIFOWrite(const u8* data, u32 size)
{ {
// In direct mode, the hardware handles creating the state required by the // In direct mode, the hardware handles creating the state required by the
// GMAC instead of finagling with packet descriptors and such // GMAC instead of finagling with packet descriptors and such
@ -412,7 +412,7 @@ void CEXIETHERNET::SendComplete()
mBbaMem[BBA_LTPS] = 0; mBbaMem[BBA_LTPS] = 0;
} }
inline u8 CEXIETHERNET::HashIndex(u8* dest_eth_addr) inline u8 CEXIETHERNET::HashIndex(const u8* dest_eth_addr)
{ {
// Calculate CRC // Calculate CRC
u32 crc = 0xffffffff; u32 crc = 0xffffffff;

View File

@ -297,11 +297,11 @@ public:
const char* GetRegisterName() const; const char* GetRegisterName() const;
void MXHardReset(); void MXHardReset();
void MXCommandHandler(u32 data, u32 size); void MXCommandHandler(u32 data, u32 size);
void DirectFIFOWrite(u8* data, u32 size); void DirectFIFOWrite(const u8* data, u32 size);
void SendFromDirectFIFO(); void SendFromDirectFIFO();
void SendFromPacketBuffer(); void SendFromPacketBuffer();
void SendComplete(); void SendComplete();
u8 HashIndex(u8* dest_eth_addr); u8 HashIndex(const u8* dest_eth_addr);
bool RecvMACFilter(); bool RecvMACFilter();
void inc_rwp(); void inc_rwp();
bool RecvHandlePacket(); bool RecvHandlePacket();
@ -313,7 +313,7 @@ public:
bool Activate(); bool Activate();
void Deactivate(); void Deactivate();
bool IsActivated(); bool IsActivated();
bool SendFrame(u8* frame, u32 size); bool SendFrame(const u8* frame, u32 size);
bool RecvInit(); bool RecvInit();
void RecvStart(); void RecvStart();
void RecvStop(); void RecvStop();

View File

@ -59,7 +59,7 @@ static int Pa_Callback(const void* inputBuffer, void* outputBuffer, unsigned lon
if (mic->stream_wpos + mic->buff_size_samples > mic->stream_size) if (mic->stream_wpos + mic->buff_size_samples > mic->stream_size)
mic->stream_wpos = 0; mic->stream_wpos = 0;
s16* buff_in = (s16*)inputBuffer; const s16* buff_in = static_cast<const s16*>(inputBuffer);
s16* buff_out = &mic->stream_buffer[mic->stream_wpos]; s16* buff_out = &mic->stream_buffer[mic->stream_wpos];
if (buff_in == nullptr) if (buff_in == nullptr)

View File

@ -58,9 +58,9 @@ void InitSRAM()
} }
} }
void SetCardFlashID(u8* buffer, u8 card_index) void SetCardFlashID(const u8* buffer, u8 card_index)
{ {
u64 rand = Common::swap64(*(u64*)&(buffer[12])); u64 rand = Common::swap64(&buffer[12]);
u8 csum = 0; u8 csum = 0;
for (int i = 0; i < 12; i++) for (int i = 0; i < 12; i++)
{ {

View File

@ -79,7 +79,7 @@ union SRAM {
}; };
#pragma pack(pop) #pragma pack(pop)
void InitSRAM(); void InitSRAM();
void SetCardFlashID(u8* buffer, u8 card_index); void SetCardFlashID(const u8* buffer, u8 card_index);
void FixSRAMChecksums(); void FixSRAMChecksums();
extern SRAM sram_dump; extern SRAM sram_dump;