Skip to content

Commit

Permalink
Cleanup more use of the "long" data type.
Browse files Browse the repository at this point in the history
This datatype varies in length between platforms so its use is not portable.
  • Loading branch information
OmniBlade committed Jun 25, 2024
1 parent f4a3cff commit 3c91025
Show file tree
Hide file tree
Showing 40 changed files with 185 additions and 185 deletions.
4 changes: 2 additions & 2 deletions common/blowfish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ void BlowfishEngine::Submit_Key(void const* key, int length)
** the table data WHILE it is using the table data, the tables are
** thoroughly obfuscated by this process.
*/
unsigned int left = 0x00000000L;
unsigned int right = 0x00000000L;
unsigned int left = 0x00000000;
unsigned int right = 0x00000000;
unsigned int* p_en = &P_Encrypt[0]; // Encryption table.
unsigned int* p_de = &P_Decrypt[ROUNDS + 1]; // Decryption table.
for (int p_index = 0; p_index < ROUNDS + 2; p_index += 2) {
Expand Down
144 changes: 72 additions & 72 deletions common/combuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ void CommBufferClass::Init(void)
//------------------------------------------------------------------------
// Init data members
//------------------------------------------------------------------------
SendTotal = 0L;
ReceiveTotal = 0L;
SendTotal = 0;
ReceiveTotal = 0;

DelaySum = 0L;
NumDelay = 0L;
MeanDelay = 0L;
MaxDelay = 0L;
DelaySum = 0;
NumDelay = 0;
MeanDelay = 0;
MaxDelay = 0;

SendCount = 0;

Expand All @@ -202,9 +202,9 @@ void CommBufferClass::Init(void)
for (i = 0; i < MaxSend; i++) {
SendQueue[i].IsActive = 0;
SendQueue[i].IsACK = 0;
SendQueue[i].FirstTime = 0L;
SendQueue[i].LastTime = 0L;
SendQueue[i].SendCount = 0L;
SendQueue[i].FirstTime = 0;
SendQueue[i].LastTime = 0;
SendQueue[i].SendCount = 0;
SendQueue[i].BufLen = 0;
SendQueue[i].ExtraLen = 0;

Expand Down Expand Up @@ -261,9 +261,9 @@ void CommBufferClass::Init_Send_Queue(void)
for (i = 0; i < MaxSend; i++) {
SendQueue[i].IsActive = 0;
SendQueue[i].IsACK = 0;
SendQueue[i].FirstTime = 0L;
SendQueue[i].LastTime = 0L;
SendQueue[i].SendCount = 0L;
SendQueue[i].FirstTime = 0;
SendQueue[i].LastTime = 0;
SendQueue[i].SendCount = 0;
SendQueue[i].BufLen = 0;
SendQueue[i].ExtraLen = 0;

Expand Down Expand Up @@ -319,9 +319,9 @@ int CommBufferClass::Queue_Send(void* buf, int buflen, void* extrabuf, int extra
//------------------------------------------------------------------------
SendQueue[index].IsActive = 1; // entry is now active
SendQueue[index].IsACK = 0; // entry hasn't been ACK'd
SendQueue[index].FirstTime = 0L; // filled in by Manager when sent
SendQueue[index].LastTime = 0L; // filled in by Manager when sent
SendQueue[index].SendCount = 0L; // filled in by Manager when sent
SendQueue[index].FirstTime = 0; // filled in by Manager when sent
SendQueue[index].LastTime = 0; // filled in by Manager when sent
SendQueue[index].SendCount = 0; // filled in by Manager when sent
SendQueue[index].BufLen = buflen; // save buffer size

//------------------------------------------------------------------------
Expand Down Expand Up @@ -409,9 +409,9 @@ int CommBufferClass::UnQueue_Send(void* buf, int* buflen, int index, void* extra
//------------------------------------------------------------------------
SendQueue[SendIndex[index]].IsActive = 0;
SendQueue[SendIndex[index]].IsACK = 0;
SendQueue[SendIndex[index]].FirstTime = 0L;
SendQueue[SendIndex[index]].LastTime = 0L;
SendQueue[SendIndex[index]].SendCount = 0L;
SendQueue[SendIndex[index]].FirstTime = 0;
SendQueue[SendIndex[index]].LastTime = 0;
SendQueue[SendIndex[index]].SendCount = 0;
SendQueue[SendIndex[index]].BufLen = 0;
SendQueue[SendIndex[index]].ExtraLen = 0;

Expand Down Expand Up @@ -745,10 +745,10 @@ unsigned int CommBufferClass::Max_Response_Time(void)
*=========================================================================*/
void CommBufferClass::Reset_Response_Time(void)
{
DelaySum = 0L;
NumDelay = 0L;
MeanDelay = 0L;
MaxDelay = 0L;
DelaySum = 0;
NumDelay = 0;
MeanDelay = 0;
MaxDelay = 0;

} /* end of Reset_Response_Time */

Expand Down Expand Up @@ -832,31 +832,31 @@ void CommBufferClass::Mono_Debug_Print(int refresh)
//------------------------------------------------------------------------
if (refresh) {
Mono_Clear_Screen();
Mono_Printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
Mono_Printf("³ ³\n");
Mono_Printf("³ ³\n");
Mono_Printf("³ ³\n");
Mono_Printf("ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\n");
Mono_Printf("³ Send Queue ³ Receive Queue ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ID Ct ACK ID Ct ACK ID Ct ACK³ ID Rd ACK ID Rd ACK ID Rd ACK³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ");
Mono_Printf("�����������������������������������������������������������������������������Ŀ\n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf("�����������������������������������������������������������������������������Ĵ\n");
Mono_Printf(" Send Queue Receive Queue \n");
Mono_Printf(" \n");
Mono_Printf(" ID Ct ACK ID Ct ACK ID Ct ACK ID Rd ACK ID Rd ACK ID Rd ACK\n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf("�������������������������������������������������������������������������������");
}

//------------------------------------------------------------------------
Expand Down Expand Up @@ -956,31 +956,31 @@ void CommBufferClass::Mono_Debug_Print2(int refresh)
//------------------------------------------------------------------------
if (refresh) {
Mono_Clear_Screen();
Mono_Printf("ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\n");
Mono_Printf("³ ³\n");
Mono_Printf("³ ³\n");
Mono_Printf("³ ³\n");
Mono_Printf("ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\n");
Mono_Printf("³ Send Queue ³ Receive Queue ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ID Ct Type Data Name ACK ³ ID Rd Type Data Name ACK ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("³ ³ ³\n");
Mono_Printf("ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ");
Mono_Printf("�����������������������������������������������������������������������������Ŀ\n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf("�����������������������������������������������������������������������������Ĵ\n");
Mono_Printf(" Send Queue Receive Queue \n");
Mono_Printf(" \n");
Mono_Printf(" ID Ct Type Data Name ACK ID Rd Type Data Name ACK \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf(" \n");
Mono_Printf("�������������������������������������������������������������������������������");
}

//------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion common/delay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void Delay(int duration)
TimerClass timer(BT_SYSTEM, true);

while (duration--) {
count = timer.Time() + 1L;
count = timer.Time() + 1;
while (count >= (unsigned)timer.Time()) {
;
}
Expand Down
6 changes: 3 additions & 3 deletions common/iff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ unsigned int Get_Iff_Chunk_Size(int fh, int id)

/* Otherwise, go to the next chunk in the file */

chunksize = (chunksize + 1) & 0xFFFFFFFEL;
chunksize = (chunksize + 1) & 0xFFFFFFFE;
Seek_File(fh, chunksize, SEEK_CUR);
}
}
Expand Down Expand Up @@ -228,7 +228,7 @@ unsigned int Read_Iff_Chunk(int fh, int id, void* buffer, unsigned int maxsize)
maxsize = MIN(maxsize, chunksize);
Read_File(fh, buffer, maxsize); // Read the buffer.

chunksize = (chunksize + 1) & 0xFFFFFFFEL;
chunksize = (chunksize + 1) & 0xFFFFFFFE;
if (maxsize < chunksize) {
Seek_File(fh, chunksize - maxsize, SEEK_CUR);
}
Expand All @@ -243,7 +243,7 @@ unsigned int Read_Iff_Chunk(int fh, int id, void* buffer, unsigned int maxsize)

/* Otherwise, go to the next chunk in the file */

chunksize = (chunksize + 1) & 0xFFFFFFFEL;
chunksize = (chunksize + 1) & 0xFFFFFFFE;
Seek_File(fh, chunksize, SEEK_CUR);
}
}
Expand Down
16 changes: 8 additions & 8 deletions common/keyframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ uintptr_t Build_Frame(void const* dataptr, unsigned short framenumber, void* buf
ptr = (char*)Add_Long_To_Pointer(dataptr, (offset[0] & 0x00FFFFFFL));

if (keyfr.flags & 1) {
ptr = (char*)Add_Long_To_Pointer(ptr, 768L);
ptr = (char*)Add_Long_To_Pointer(ptr, 768);
}
length = LCW_Uncompress(ptr, buffptr, buffsize);
} else { // key delta or delta
Expand All @@ -366,19 +366,19 @@ uintptr_t Build_Frame(void const* dataptr, unsigned short framenumber, void* buf
}

// key frame
offcurr = offset[1] & 0x00FFFFFFL;
offcurr = offset[1] & 0x00FFFFFF;

// key delta
offdiff = (offset[0] & 0x00FFFFFFL) - offcurr;
offdiff = (offset[0] & 0x00FFFFFF) - offcurr;

ptr = (char*)Add_Long_To_Pointer(dataptr, offcurr);

if (keyfr.flags & 1) {
ptr = (char*)Add_Long_To_Pointer(ptr, 768L);
ptr = (char*)Add_Long_To_Pointer(ptr, 768);
}

#ifndef FIXIT_SCORE_CRASH
off16 = (unsigned int)lockptr & 0x00003FFFL;
off16 = (unsigned int)lockptr & 0x00003FFF;
#endif

length = LCW_Uncompress(ptr, buffptr, buffsize);
Expand All @@ -391,7 +391,7 @@ uintptr_t Build_Frame(void const* dataptr, unsigned short framenumber, void* buf
if (((offset[2] & 0x00FFFFFFL) - offcurr) >= (0x00010000L - off16)) {

ptr = (char*)Add_Long_To_Pointer(ptr, offdiff);
off16 = (unsigned int)ptr & 0x00003FFFL;
off16 = (unsigned int)ptr & 0x00003FFF;

offcurr += offdiff;
offdiff = 0;
Expand All @@ -414,7 +414,7 @@ uintptr_t Build_Frame(void const* dataptr, unsigned short framenumber, void* buf
if (((offset[subframe + 2] & 0x00FFFFFFL) - offcurr) >= (0x00010000L - off16)) {

ptr = (char*)Add_Long_To_Pointer(ptr, offdiff);
off16 = (unsigned int)lockptr & 0x00003FFFL;
off16 = (unsigned int)lockptr & 0x00003FFF;

offcurr += offdiff;
offdiff = 0;
Expand Down Expand Up @@ -637,7 +637,7 @@ bool Get_Build_Frame_Palette(void const* dataptr, void* palette)
frames = le16toh(frames);
if (flags & 1) {
char const* ptr = (char const*)Add_Long_To_Pointer(
dataptr, ((((long)sizeof(unsigned long) << 1) * frames + 16 + sizeof(KeyFrameHeaderType))));
dataptr, ((((int)sizeof(unsigned) << 1) * frames + 16 + sizeof(KeyFrameHeaderType))));

memcpy(palette, ptr, 768L);
return (true);
Expand Down
Loading

0 comments on commit 3c91025

Please sign in to comment.