Silence some compiler warnings.

This commit is contained in:
rogerman 2023-02-27 16:36:08 -08:00
parent cda8cb5686
commit 1daebcd670
4 changed files with 93 additions and 94 deletions

View File

@ -1,7 +1,7 @@
/* /*
Copyright 2006 yopyop Copyright 2006 yopyop
Copyright 2007 shash Copyright 2007 shash
Copyright 2007-2022 DeSmuME team Copyright 2007-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -353,24 +353,24 @@ void DISP_FIFOsend(const T val)
case 1: case 1:
{ {
#ifndef MSB_FIRST #ifndef MSB_FIRST
HostWriteByte((u8 *)disp_fifo.buf, finalWriteAddress, val); HostWriteByte((u8 *)disp_fifo.buf, (u32)finalWriteAddress, val);
#else #else
switch (ADDROFFSET) switch (ADDROFFSET)
{ {
case 0: case 0:
HostWriteByte((u8 *)disp_fifo.buf, baseWriteAddress + 2, val); HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 2, val);
break; break;
case 1: case 1:
HostWriteByte((u8 *)disp_fifo.buf, baseWriteAddress + 3, val); HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 3, val);
break; break;
case 2: case 2:
HostWriteByte((u8 *)disp_fifo.buf, baseWriteAddress + 0, val); HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 0, val);
break; break;
case 3: case 3:
HostWriteByte((u8 *)disp_fifo.buf, baseWriteAddress + 1, val); HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 1, val);
break; break;
default: default:
@ -392,16 +392,16 @@ void DISP_FIFOsend(const T val)
case 2: case 2:
{ {
#ifndef MSB_FIRST #ifndef MSB_FIRST
HostWriteWord((u8 *)disp_fifo.buf, finalWriteAddress, val); HostWriteWord((u8 *)disp_fifo.buf, (u32)finalWriteAddress, val);
#else #else
switch (ADDROFFSET) switch (ADDROFFSET)
{ {
case 0: case 0:
HostWriteWord((u8 *)disp_fifo.buf, baseWriteAddress + 2, val); HostWriteWord((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 2, val);
break; break;
case 2: case 2:
HostWriteWord((u8 *)disp_fifo.buf, baseWriteAddress + 0, val); HostWriteWord((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 0, val);
break; break;
default: default:
@ -421,7 +421,7 @@ void DISP_FIFOsend(const T val)
} }
case 4: case 4:
HostWriteTwoWords((u8 *)disp_fifo.buf, finalWriteAddress, val); HostWriteTwoWords((u8 *)disp_fifo.buf, (u32)finalWriteAddress, val);
disp_fifo.tail++; disp_fifo.tail++;
break; break;

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2008-2018 DeSmuME team Copyright 2008-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -179,7 +179,7 @@ public:
int advancedTiming; int advancedTiming;
int jitBlockSize; int jitBlockSize;
int getNumRecords() { return records.size(); } int getNumRecords() { return (int)records.size(); }
class TDictionary : public std::map<std::string,std::string> class TDictionary : public std::map<std::string,std::string>
{ {

View File

@ -1,7 +1,7 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 shash Copyright (C) 2006-2007 shash
Copyright (C) 2008-2022 DeSmuME team Copyright (C) 2008-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -1757,7 +1757,7 @@ void NDSTextureUnpackA5I3(const size_t srcSize, const u8 *__restrict srcData, co
template <TextureStoreUnpackFormat TEXCACHEFORMAT> template <TextureStoreUnpackFormat TEXCACHEFORMAT>
void NDSTextureUnpack4x4(const size_t srcSize, const u32 *__restrict srcData, const u16 *__restrict srcIndex, const u32 palAddress, const u32 sizeX, const u32 sizeY, u32 *__restrict dstBuffer) void NDSTextureUnpack4x4(const size_t srcSize, const u32 *__restrict srcData, const u16 *__restrict srcIndex, const u32 palAddress, const u32 sizeX, const u32 sizeY, u32 *__restrict dstBuffer)
{ {
const u32 limit = srcSize * sizeof(u32); const size_t limit = srcSize * sizeof(u32);
const u32 xTmpSize = sizeX >> 2; const u32 xTmpSize = sizeX >> 2;
const u32 yTmpSize = sizeY >> 2; const u32 yTmpSize = sizeY >> 2;

View File

@ -1,20 +1,20 @@
/* /*
Copyright (C) 2010 DeSmuME team Copyright (C) 2010-2023 DeSmuME team
This file is based on System.DateTime.cs and System.TimeSpan.cs from mono-2.6.7 This file is based on System.DateTime.cs and System.TimeSpan.cs from mono-2.6.7
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or the Free Software Foundation, either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This file is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>. along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/ */
// //
@ -78,19 +78,19 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// //
#ifndef _DATETIME_H_ #ifndef _DATETIME_H_
#define _DATETIME_H_ #define _DATETIME_H_
#include <math.h> #include <math.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include "../types.h" #include "../types.h"
enum DayOfWeek { enum DayOfWeek {
DayOfWeek_Sunday=0, DayOfWeek_Sunday=0,
DayOfWeek_Monday=1, DayOfWeek_Monday=1,
@ -99,41 +99,41 @@ enum DayOfWeek {
DayOfWeek_Thursday=4, DayOfWeek_Thursday=4,
DayOfWeek_Friday=5, DayOfWeek_Friday=5,
DayOfWeek_Saturday=6 DayOfWeek_Saturday=6
}; };
class TimeSpan class TimeSpan
{ {
friend class DateTime; friend class DateTime;
public: public:
static const TimeSpan& get_MaxValue() static const TimeSpan& get_MaxValue()
{ {
static TimeSpan val(0x7FFFFFFFFFFFFFFFLL); static TimeSpan val(0x7FFFFFFFFFFFFFFFLL);
return val; return val;
} }
static const TimeSpan& get_MinValue() static const TimeSpan& get_MinValue()
{ {
static TimeSpan val(0x8000000000000000LL); static TimeSpan val(0x8000000000000000LL);
return val; return val;
} }
static const TimeSpan& get_Zero() static const TimeSpan& get_Zero()
{ {
static TimeSpan val(0); static TimeSpan val(0);
return val; return val;
} }
static const s64 TicksPerDay = 864000000000LL; static const s64 TicksPerDay = 864000000000LL;
static const s64 TicksPerHour = 36000000000LL; static const s64 TicksPerHour = 36000000000LL;
static const s64 TicksPerMillisecond = 10000LL; static const s64 TicksPerMillisecond = 10000LL;
static const s64 TicksPerMinute = 600000000LL; static const s64 TicksPerMinute = 600000000LL;
static const s64 TicksPerSecond = 10000000LL; static const s64 TicksPerSecond = 10000000LL;
TimeSpan () TimeSpan ()
{ {
} }
TimeSpan (s64 ticks) TimeSpan (s64 ticks)
: _ticks(ticks) : _ticks(ticks)
{ {
@ -294,8 +294,8 @@ public:
private: private:
s64 _ticks; s64 _ticks;
static s64 CalculateTicks (int days, int hours, int minutes, int seconds, int milliseconds) static s64 CalculateTicks (int days, int hours, int minutes, int seconds, int milliseconds)
{ {
// there's no overflow checks for hours, minutes, ... // there's no overflow checks for hours, minutes, ...
@ -369,18 +369,18 @@ private:
//} //}
}; };
class DateTime
{
private:
TimeSpan ticks;
static inline double round(const double x) { return floor(x + 0.5); } class DateTime
{
private:
TimeSpan ticks;
static inline double round(const double x) { return floor(x + 0.5); }
static const int dp400 = 146097; static const int dp400 = 146097;
static const int dp100 = 36524; static const int dp100 = 36524;
static const int dp4 = 1461; static const int dp4 = 1461;
// w32 file time starts counting from 1/1/1601 00:00 GMT // w32 file time starts counting from 1/1/1601 00:00 GMT
// which is the constant ticks from the .NET epoch // which is the constant ticks from the .NET epoch
static const s64 w32file_epoch = 504911232000000000LL; static const s64 w32file_epoch = 504911232000000000LL;
@ -394,7 +394,7 @@ private:
// in Ticks // in Ticks
// //
static const s64 UnixEpoch = 621355968000000000LL; static const s64 UnixEpoch = 621355968000000000LL;
static const int daysmonth[13]; static const int daysmonth[13];
static const int daysmonthleap[13]; static const int daysmonthleap[13];
@ -415,7 +415,7 @@ private:
ticks = TimeSpan (AbsoluteDays(year,month,day), hour, minute, second, millisecond); ticks = TimeSpan (AbsoluteDays(year,month,day), hour, minute, second, millisecond);
} }
static int AbsoluteDays (int year, int month, int day) static int AbsoluteDays (int year, int month, int day)
@ -589,8 +589,8 @@ public:
static DateTime get_Now () static DateTime get_Now ()
{ {
time_t timer; time_t timer;
time(&timer); time(&timer);
struct tm *tm = localtime(&timer); struct tm *tm = localtime(&timer);
return DateTime(tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec); return DateTime(tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
} }
@ -657,7 +657,6 @@ public:
DateTime AddMonths (int months) const DateTime AddMonths (int months) const
{ {
int day, month, year, maxday ; int day, month, year, maxday ;
DateTime temp;
day = get_Day(); day = get_Day();
month = get_Month() + (months % 12); month = get_Month() + (months % 12);
@ -677,7 +676,7 @@ public:
if (day > maxday) if (day > maxday)
day = maxday; day = maxday;
temp = (year, month, day); DateTime temp(year, month, day);
return temp.Add (get_TimeOfDay()); return temp.Add (get_TimeOfDay());
} }
@ -784,7 +783,7 @@ public:
std::string ToString() const std::string ToString() const
{ {
char tmp[32]; char tmp[32];
sprintf(tmp,"%04d-%s-%02d %02d:%02d:%02d:%03d",get_Year(),monthnames[get_Month()],get_Day(),get_Hour(),get_Minute(),get_Second(),get_Millisecond()); snprintf(tmp, sizeof(tmp), "%04d-%s-%02d %02d:%02d:%02d:%03d",get_Year(),monthnames[get_Month()],get_Day(),get_Hour(),get_Minute(),get_Second(),get_Millisecond());
return tmp; return tmp;
} }
@ -812,7 +811,7 @@ public:
return ret; return ret;
} }
}; };
#endif //_DATETIME_H_ #endif //_DATETIME_H_