More clang warnings fixed; these apply mostly to 'old-style-C' casts.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3205 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-09-14 21:33:50 +00:00
parent 687b638437
commit d83d91570e
32 changed files with 440 additions and 440 deletions

View File

@ -52,8 +52,8 @@ void EventHandlerSDL2::pollEvent()
case SDL_KEYDOWN:
{
if(!myEvent.key.repeat)
handleKeyEvent((StellaKey)myEvent.key.keysym.scancode,
(StellaMod)myEvent.key.keysym.mod,
handleKeyEvent(StellaKey(myEvent.key.keysym.scancode),
StellaMod(myEvent.key.keysym.mod),
myEvent.key.type == SDL_KEYDOWN);
break;
}

View File

@ -218,7 +218,7 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height,
////////////////////////////////////////////////////
// These *must* be set for the parent class
myPixels = (uInt32*) mySurface->pixels;
myPixels = reinterpret_cast<uInt32*>(mySurface->pixels);
myPitch = mySurface->pitch / pf->BytesPerPixel;
////////////////////////////////////////////////////

View File

@ -157,7 +157,7 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode)
{
int w, h;
SDL_GetWindowSize(myWindow, &w, &h);
if((uInt32)w != mode.screen.w || (uInt32)h != mode.screen.h)
if(uInt32(w) != mode.screen.w || uInt32(h) != mode.screen.h)
{
SDL_DestroyWindow(myWindow);
myWindow = nullptr;
@ -321,8 +321,8 @@ void FrameBufferSDL2::setWindowIcon()
const char* line = stella_icon[1 + ncols + h];
for(w = 0; w < 32; w++)
{
icon[w + 32 * h] = rgba[(int)line[w]];
if(rgba[(int)line[w]] & 0xFF000000)
icon[w + 32 * h] = rgba[int(line[w])];
if(rgba[int(line[w])] & 0xFF000000)
mask[h][w >> 3] |= 1 << (7 - (w & 0x07));
}
}
@ -338,7 +338,7 @@ void FrameBufferSDL2::setWindowIcon()
unique_ptr<FBSurface> FrameBufferSDL2::createSurface(uInt32 w, uInt32 h,
const uInt32* data) const
{
return make_ptr<FBSurfaceSDL2>((FrameBufferSDL2&)*this, w, h, data);
return make_ptr<FBSurfaceSDL2>(const_cast<FrameBufferSDL2&>(*this), w, h, data);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -39,8 +39,8 @@ MouseControl::MouseControl(Console& console, const string& mode)
mode[0] >= '0' && mode[0] <= '8' &&
mode[1] >= '0' && mode[1] <= '8')
{
Axis xaxis = (Axis) ((int)mode[0] - '0');
Axis yaxis = (Axis) ((int)mode[1] - '0');
Axis xaxis = Axis(int(mode[0]) - '0');
Axis yaxis = Axis(int(mode[1]) - '0');
ostringstream msg;
msg << "Mouse X-axis is ";
Controller::Type xtype = Controller::Joystick, ytype = Controller::Joystick;

View File

@ -99,7 +99,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface)
// The PNG read function expects an array of rows, not a single 1-D array
for(uInt32 irow = 0, offset = 0; irow < ReadInfo.height; ++irow, offset += ReadInfo.pitch)
ReadInfo.row_pointers[irow] = (png_bytep) (uInt8*)ReadInfo.buffer + offset;
ReadInfo.row_pointers[irow] = png_bytep(ReadInfo.buffer + offset);
// Read the entire image in one go
png_read_image(png_ptr, ReadInfo.row_pointers);
@ -113,7 +113,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface)
// Cleanup
done:
if(png_ptr)
png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : (png_infopp)0, (png_infopp)0);
png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : 0, 0);
if(err_message)
throw runtime_error(err_message);
@ -136,7 +136,7 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& comments)
// Set up pointers into "buffer" byte array
png_bytep* rows = new png_bytep[height];
for(png_uint_32 k = 0; k < height; ++k)
rows[k] = (png_bytep) (buffer + k*width*4);
rows[k] = png_bytep(buffer + k*width*4);
// And save the image
saveImage(out, buffer, rows, width, height, comments);
@ -165,7 +165,7 @@ void PNGLibrary::saveImage(const string& filename, const FBSurface& surface,
// Set up pointers into "buffer" byte array
png_bytep* rows = new png_bytep[height];
for(png_uint_32 k = 0; k < height; ++k)
rows[k] = (png_bytep) (buffer + k*width*4);
rows[k] = png_bytep(buffer + k*width*4);
// And save the image
saveImage(out, buffer, rows, width, height, comments);
@ -300,15 +300,15 @@ void PNGLibrary::loadImagetoSurface(FBSurface& surface)
void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr,
const VariantList& comments)
{
uInt32 numComments = (int)comments.size();
uInt32 numComments = comments.size();
if(numComments == 0)
return;
unique_ptr<png_text[]> text_ptr = make_ptr<png_text[]>(numComments);
for(uInt32 i = 0; i < numComments; ++i)
{
text_ptr[i].key = (char*) comments[i].first.c_str();
text_ptr[i].text = (char*) comments[i].second.toCString();
text_ptr[i].key = const_cast<char*>(comments[i].first.c_str());
text_ptr[i].text = const_cast<char*>(comments[i].second.toCString());
text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[i].text_length = 0;
}
@ -318,19 +318,21 @@ void PNGLibrary::writeComments(png_structp png_ptr, png_infop info_ptr,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_read_data(png_structp ctx, png_bytep area, png_size_t size)
{
((ifstream *) png_get_io_ptr(ctx))->read((char *)area, size);
(static_cast<ifstream*>(png_get_io_ptr(ctx)))->read(
reinterpret_cast<char *>(area), size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_write_data(png_structp ctx, png_bytep area, png_size_t size)
{
((ofstream *) png_get_io_ptr(ctx))->write((const char *)area, size);
(static_cast<ofstream*>(png_get_io_ptr(ctx)))->write(
reinterpret_cast<const char *>(area), size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_io_flush(png_structp ctx)
{
((ofstream *) png_get_io_ptr(ctx))->flush();
(static_cast<ofstream*>(png_get_io_ptr(ctx)))->flush();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -56,7 +56,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem)
desired.channels = 2;
desired.samples = myOSystem.settings().getInt("fragsize");
desired.callback = callback;
desired.userdata = (void*)this;
desired.userdata = static_cast<void*>(this);
ostringstream buf;
if(SDL_OpenAudio(&desired, &myHardwareSpec) < 0)
@ -69,7 +69,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem)
// Make sure the sample buffer isn't to big (if it is the sound code
// will not work so we'll need to disable the audio support)
if(((float)myHardwareSpec.samples / (float)myHardwareSpec.freq) >= 0.25)
if((float(myHardwareSpec.samples) / float(myHardwareSpec.freq)) >= 0.25)
{
buf << "WARNING: Sound device doesn't support realtime audio! Make "
<< "sure a sound" << endl
@ -81,7 +81,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem)
}
// Pre-compute fragment-related variables as much as possible
myFragmentSizeLogBase2 = log((double)myHardwareSpec.samples) / log(2.0);
myFragmentSizeLogBase2 = log(myHardwareSpec.samples) / log(2.0);
myFragmentSizeLogDiv1 = myFragmentSizeLogBase2 / 60.0;
myFragmentSizeLogDiv2 = (myFragmentSizeLogBase2 - 1) / 60.0;
@ -135,10 +135,10 @@ void SoundSDL2::open()
// Show some info
ostringstream buf;
buf << "Sound enabled:" << endl
<< " Volume: " << (int)myVolume << endl
<< " Frag size: " << (int)myHardwareSpec.samples << endl
<< " Frequency: " << (int)myHardwareSpec.freq << endl
<< " Channels: " << (int)myHardwareSpec.channels
<< " Volume: " << myVolume << endl
<< " Frag size: " << uInt32(myHardwareSpec.samples) << endl
<< " Frequency: " << uInt32(myHardwareSpec.freq) << endl
<< " Channels: " << uInt32(myHardwareSpec.channels)
<< " (" << chanResult << ")" << endl
<< endl;
myOSystem.logMessage(buf.str(), 1);
@ -255,8 +255,7 @@ void SoundSDL2::set(uInt16 addr, uInt8 value, Int32 cycle)
// First, calculate how many seconds would have past since the last
// register write on a real 2600
double delta = (((double)(cycle - myLastRegisterSetCycle)) /
(1193191.66666667));
double delta = double(cycle - myLastRegisterSetCycle) / 1193191.66666667;
// Now, adjust the time based on the frame rate the user has selected. For
// the sound to "scale" correctly, we have to know the games real frame
@ -302,8 +301,8 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length)
{
// There are no more pending TIA sound register updates so we'll
// use the current settings to finish filling the sound fragment
myTIASound.process(stream + ((uInt32)position * channels),
length - (uInt32)position);
myTIASound.process(stream + (uInt32(position) * channels),
length - uInt32(position));
// Since we had to fill the fragment we'll reset the cycle counter
// to zero. NOTE: This isn't 100% correct, however, it'll do for
@ -319,7 +318,7 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length)
RegWrite& info = myRegWriteQueue.front();
// How long will the remaining samples in the fragment take to play
double duration = remaining / (double)myHardwareSpec.freq;
double duration = remaining / myHardwareSpec.freq;
// Does the register update occur before the end of the fragment?
if(info.delta <= duration)
@ -331,9 +330,9 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length)
// Process the fragment upto the next TIA register write. We
// round the count passed to process up if needed.
double samples = (myHardwareSpec.freq * info.delta);
myTIASound.process(stream + ((uInt32)position * channels),
(uInt32)samples + (uInt32)(position + samples) -
((uInt32)position + (uInt32)samples));
myTIASound.process(stream + (uInt32(position) * channels),
uInt32(samples) + uInt32(position + samples) -
(uInt32(position) + uInt32(samples)));
position += samples;
remaining -= samples;
@ -346,8 +345,8 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length)
// The next register update occurs in the next fragment so finish
// this fragment with the current TIA settings and reduce the register
// update delay by the corresponding amount of time
myTIASound.process(stream + ((uInt32)position * channels),
length - (uInt32)position);
myTIASound.process(stream + (uInt32(position) * channels),
length - uInt32(position));
info.delta -= duration;
break;
}
@ -358,13 +357,13 @@ void SoundSDL2::processFragment(Int16* stream, uInt32 length)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL2::callback(void* udata, uInt8* stream, int len)
{
SoundSDL2* sound = (SoundSDL2*)udata;
SoundSDL2* sound = static_cast<SoundSDL2*>(udata);
if(sound->myIsEnabled)
{
// The callback is requesting 8-bit (unsigned) data, but the TIA sound
// emulator deals in 16-bit (signed) data
// So, we need to convert the pointer and half the length
sound->processFragment((Int16*)stream, (uInt32)len >> 1);
sound->processFragment(reinterpret_cast<Int16*>(stream), uInt32(len) >> 1);
}
else
SDL_memset(stream, 0, len); // Write 'silence'
@ -428,7 +427,7 @@ bool SoundSDL2::load(Serializer& in)
for(int i = 0; i < 6; ++i)
in.getByte();
myLastRegisterSetCycle = (Int32) in.getInt();
myLastRegisterSetCycle = in.getInt();
}
catch(...)
{

View File

@ -27,7 +27,7 @@ class Settings;
#include "atari_ntsc.hxx"
#define SCALE_FROM_100(x) ((x/50.0)-1.0)
#define SCALE_TO_100(x) (uInt32)(50*(x+1.0))
#define SCALE_TO_100(x) uInt32(50*(x+1.0))
/**
This class is based on the Blargg NTSC filter code from Atari800,

View File

@ -129,7 +129,7 @@ void EventHandler::reset(State state)
// We wait a little while, since 'hold' events may be present, and we want
// time for the ROM to process them
if(state == S_EMULATE)
SDL_AddTimer(500, resetEventsCallback, (void*)this);
SDL_AddTimer(500, resetEventsCallback, static_cast<void*>(this));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -101,7 +101,7 @@ void M6502::reset()
myLastAccessWasRead = true;
// Load PC from the reset vector
PC = (uInt16)mySystem->peek(0xfffc) | ((uInt16)mySystem->peek(0xfffd) << 8);
PC = uInt16(mySystem->peek(0xfffc)) | (uInt16(mySystem->peek(0xfffd)) << 8);
myLastAddress = myLastPeekAddress = myLastPokeAddress = 0;
myLastSrcAddressS = myLastSrcAddressA =
@ -262,7 +262,7 @@ void M6502::interruptHandler()
mySystem->poke(0x0100 + SP--, PS() & (~0x10));
D = false;
I = true;
PC = (uInt16)mySystem->peek(0xFFFE) | ((uInt16)mySystem->peek(0xFFFF) << 8);
PC = uInt16(mySystem->peek(0xFFFE)) | (uInt16(mySystem->peek(0xFFFF)) << 8);
}
else if(myExecutionStatus & NonmaskableInterruptBit)
{
@ -271,7 +271,7 @@ void M6502::interruptHandler()
mySystem->poke(0x0100 + SP--, (PC - 1) & 0x00ff);
mySystem->poke(0x0100 + SP--, PS() & (~0x10));
D = false;
PC = (uInt16)mySystem->peek(0xFFFA) | ((uInt16)mySystem->peek(0xFFFB) << 8);
PC = uInt16(mySystem->peek(0xFFFA)) | (uInt16(mySystem->peek(0xFFFB)) << 8);
}
// Clear the interrupt bits in myExecutionStatus
@ -386,7 +386,7 @@ uInt32 M6502::addCondBreak(Expression* e, const string& name)
{
myBreakConds.emplace_back(unique_ptr<Expression>(e));
myBreakCondNames.push_back(name);
return (uInt32)myBreakConds.size() - 1;
return myBreakConds.size() - 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

File diff suppressed because it is too large Load Diff

View File

@ -63,26 +63,26 @@ define(M6502_IMMEDIATE_READ, `{
define(M6502_ABSOLUTE_READ, `{
intermediateAddress = peek(PC++, DISASM_CODE);
intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8);
intermediateAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
operand = peek(intermediateAddress, DISASM_DATA);
}')
define(M6502_ABSOLUTE_WRITE, `{
operandAddress = peek(PC++, DISASM_CODE);
operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8);
operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
}')
define(M6502_ABSOLUTE_READMODIFYWRITE, `{
operandAddress = peek(PC++, DISASM_CODE);
operandAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8);
operandAddress |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
}')
define(M6502_ABSOLUTEX_READ, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8);
intermediateAddress = high | (uInt8)(low + X);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
intermediateAddress = high | uInt8(low + X);
operand = peek(intermediateAddress, DISASM_DATA);
if((low + X) > 0xFF)
{
@ -93,15 +93,15 @@ define(M6502_ABSOLUTEX_READ, `{
define(M6502_ABSOLUTEX_WRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8);
peek(high | (uInt8)(low + X), DISASM_DATA);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + X), DISASM_DATA);
operandAddress = (high | low) + X;
}')
define(M6502_ABSOLUTEX_READMODIFYWRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8);
peek(high | (uInt8)(low + X), DISASM_DATA);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + X), DISASM_DATA);
operandAddress = (high | low) + X;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
@ -109,8 +109,8 @@ define(M6502_ABSOLUTEX_READMODIFYWRITE, `{
define(M6502_ABSOLUTEY_READ, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8);
intermediateAddress = high | (uInt8)(low + Y);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
intermediateAddress = high | uInt8(low + Y);
operand = peek(intermediateAddress, DISASM_DATA);
if((low + Y) > 0xFF)
{
@ -121,15 +121,15 @@ define(M6502_ABSOLUTEY_READ, `{
define(M6502_ABSOLUTEY_WRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8);
peek(high | (uInt8)(low + Y), DISASM_DATA);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
operandAddress = (high | low) + Y;
}')
define(M6502_ABSOLUTEY_READMODIFYWRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = ((uInt16)peek(PC++, DISASM_CODE) << 8);
peek(high | (uInt8)(low + Y), DISASM_DATA);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
operandAddress = (high | low) + Y;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
@ -194,13 +194,13 @@ define(M6502_ZEROY_READMODIFYWRITE, `{
define(M6502_INDIRECT, `{
uInt16 addr = peek(PC++, DISASM_CODE);
addr |= ((uInt16)peek(PC++, DISASM_CODE) << 8);
addr |= (uInt16(peek(PC++, DISASM_CODE)) << 8);
// Simulate the error in the indirect addressing mode!
uInt16 high = NOTSAMEPAGE(addr, addr + 1) ? (addr & 0xff00) : (addr + 1);
operandAddress = peek(addr, DISASM_DATA);
operandAddress |= ((uInt16)peek(high, DISASM_DATA) << 8);
operandAddress |= (uInt16(peek(high, DISASM_DATA)) << 8);
}')
define(M6502_INDIRECTX_READ, `{
@ -208,7 +208,7 @@ define(M6502_INDIRECTX_READ, `{
peek(pointer, DISASM_DATA);
pointer += X;
intermediateAddress = peek(pointer++, DISASM_DATA);
intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8);
intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
operand = peek(intermediateAddress, DISASM_DATA);
}')
@ -217,7 +217,7 @@ define(M6502_INDIRECTX_WRITE, `{
peek(pointer, DISASM_DATA);
pointer += X;
operandAddress = peek(pointer++, DISASM_DATA);
operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8);
operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
}')
define(M6502_INDIRECTX_READMODIFYWRITE, `{
@ -225,7 +225,7 @@ define(M6502_INDIRECTX_READMODIFYWRITE, `{
peek(pointer, DISASM_DATA);
pointer += X;
operandAddress = peek(pointer++, DISASM_DATA);
operandAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8);
operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
}')
@ -233,8 +233,8 @@ define(M6502_INDIRECTX_READMODIFYWRITE, `{
define(M6502_INDIRECTY_READ, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
uInt16 low = peek(pointer++, DISASM_DATA);
uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8);
intermediateAddress = high | (uInt8)(low + Y);
uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
intermediateAddress = high | uInt8(low + Y);
operand = peek(intermediateAddress, DISASM_DATA);
if((low + Y) > 0xFF)
{
@ -246,16 +246,16 @@ define(M6502_INDIRECTY_READ, `{
define(M6502_INDIRECTY_WRITE, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
uInt16 low = peek(pointer++, DISASM_DATA);
uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8);
peek(high | (uInt8)(low + Y), DISASM_DATA);
uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
operandAddress = (high | low) + Y;
}')
define(M6502_INDIRECTY_READMODIFYWRITE, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
uInt16 low = peek(pointer++, DISASM_DATA);
uInt16 high = ((uInt16)peek(pointer, DISASM_DATA) << 8);
peek(high | (uInt8)(low + Y), DISASM_DATA);
uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
operandAddress = (high | low) + Y;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
@ -266,7 +266,7 @@ define(M6502_BCC, `{
if(!C)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -277,7 +277,7 @@ define(M6502_BCS, `{
if(C)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -288,7 +288,7 @@ define(M6502_BEQ, `{
if(!notZ)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -299,7 +299,7 @@ define(M6502_BMI, `{
if(N)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -310,7 +310,7 @@ define(M6502_BNE, `{
if(notZ)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -321,7 +321,7 @@ define(M6502_BPL, `{
if(!N)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -332,7 +332,7 @@ define(M6502_BVC, `{
if(!V)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -343,7 +343,7 @@ define(M6502_BVS, `{
if(V)
{
peek(PC, DISASM_NONE);
uInt16 address = PC + (Int8)operand;
uInt16 address = PC + Int8(operand);
if(NOTSAMEPAGE(PC, address))
peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE);
PC = address;
@ -359,7 +359,7 @@ define(M6502_ADC, `{
notZ = sum & 0xff;
C = sum & 0xff00;
A = (uInt8) sum;
A = uInt8(sum);
}
else
{
@ -495,7 +495,7 @@ define(M6502_BRK, `{
I = true;
PC = peek(0xfffe, DISASM_NONE);
PC |= ((uInt16)peek(0xffff, DISASM_NONE) << 8);
PC |= (uInt16(peek(0xffff, DISASM_NONE)) << 8);
}')
define(M6502_CLC, `{
@ -515,7 +515,7 @@ define(M6502_CLV, `{
}')
define(M6502_CMP, `{
uInt16 value = (uInt16)A - (uInt16)operand;
uInt16 value = uInt16(A) - uInt16(operand);
notZ = value;
N = value & 0x0080;
@ -523,7 +523,7 @@ define(M6502_CMP, `{
}')
define(M6502_CPX, `{
uInt16 value = (uInt16)X - (uInt16)operand;
uInt16 value = uInt16(X) - uInt16(operand);
notZ = value;
N = value & 0x0080;
@ -531,7 +531,7 @@ define(M6502_CPX, `{
}')
define(M6502_CPY, `{
uInt16 value = (uInt16)Y - (uInt16)operand;
uInt16 value = uInt16(Y) - uInt16(operand);
notZ = value;
N = value & 0x0080;
@ -542,7 +542,7 @@ define(M6502_DCP, `{
uInt8 value = operand - 1;
poke(operandAddress, value);
uInt16 value2 = (uInt16)A - (uInt16)value;
uInt16 value2 = uInt16(A) - uInt16(value);
notZ = value2;
N = value2 & 0x0080;
C = !(value2 & 0x0100);
@ -609,7 +609,7 @@ define(M6502_ISB, `{
if(!D)
{
A = (uInt8) sum;
A = uInt8(sum);
}
else
{
@ -642,7 +642,7 @@ define(M6502_JSR, `{
poke(0x0100 + SP--, PC >> 8);
poke(0x0100 + SP--, PC & 0xff);
PC = (low | ((uInt16)peek(PC, DISASM_CODE) << 8));
PC = (low | (uInt16(peek(PC, DISASM_CODE)) << 8));
}')
define(M6502_LAS, `{
@ -812,7 +812,7 @@ define(M6502_RRA, `{
notZ = sum & 0xff;
C = sum & 0xff00;
A = (uInt8) sum;
A = uInt8(sum);
}
else
{
@ -838,13 +838,13 @@ define(M6502_RTI, `{
peek(0x0100 + SP++, DISASM_NONE);
PS(peek(0x0100 + SP++, DISASM_NONE));
PC = peek(0x0100 + SP++, DISASM_NONE);
PC |= ((uInt16)peek(0x0100 + SP, DISASM_NONE) << 8);
PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8);
}')
define(M6502_RTS, `{
peek(0x0100 + SP++, DISASM_NONE);
PC = peek(0x0100 + SP++, DISASM_NONE);
PC |= ((uInt16)peek(0x0100 + SP, DISASM_NONE) << 8);
PC |= (uInt16(peek(0x0100 + SP, DISASM_NONE)) << 8);
peek(PC++, DISASM_CODE);
}')
@ -861,7 +861,7 @@ define(M6502_SBC, `{
if(!D)
{
A = (uInt8) sum;
A = uInt8(sum);
}
else
{
@ -881,7 +881,7 @@ define(M6502_SBC, `{
}')
define(M6502_SBX, `{
uInt16 value = (uInt16)(X & A) - (uInt16)operand;
uInt16 value = uInt16(X & A) - uInt16(operand);
X = (value & 0xff);
notZ = X;

View File

@ -78,10 +78,10 @@ MT24LC256::MT24LC256(const string& filename, const System& system)
{
// Get length of file; it must be 32768
in.seekg(0, ios::end);
if((int)in.tellg() == 32768)
if(in.tellg() == 32768)
{
in.seekg(0, ios::beg);
in.read((char*)myData, 32768);
in.read(reinterpret_cast<char*>(myData), 32768);
myDataFileExists = true;
}
}
@ -100,7 +100,7 @@ MT24LC256::~MT24LC256()
{
ofstream out(myDataFile, ios_base::binary);
if(out.is_open())
out.write((char*)myData, 32768);
out.write(reinterpret_cast<char*>(myData), 32768);
}
}
@ -258,7 +258,7 @@ void MT24LC256::jpee_clock_fall()
{
if (!jpee_pptr)
{
jpee_packet[0] = (uInt8)jpee_nb;
jpee_packet[0] = uInt8(jpee_nb);
if (jpee_smallmode && ((jpee_nb & 0xF0) == 0xA0))
{
jpee_packet[1] = (jpee_nb >> 1) & 7;
@ -300,7 +300,7 @@ void MT24LC256::jpee_clock_fall()
{
if (!jpee_pptr)
{
jpee_packet[0] = (uInt8)jpee_nb;
jpee_packet[0] = uInt8(jpee_nb);
if (jpee_smallmode)
jpee_pptr=2;
else
@ -309,7 +309,7 @@ void MT24LC256::jpee_clock_fall()
else if (jpee_pptr < 70)
{
JPEE_LOG1("I2C_SENT(%02X)",jpee_nb & 0xFF);
jpee_packet[jpee_pptr++] = (uInt8)jpee_nb;
jpee_packet[jpee_pptr++] = uInt8(jpee_nb);
jpee_address = (jpee_packet[1] << 8) | jpee_packet[2];
if (jpee_pptr > 2)
jpee_ad_known = 1;
@ -370,7 +370,7 @@ bool MT24LC256::jpee_timercheck(int mode)
if(myTimerActive)
{
uInt32 elapsed = mySystem.cycles() - myCyclesWhenTimerSet;
myTimerActive = elapsed < (uInt32)(5000000.0 / 838.0);
myTimerActive = elapsed < uInt32(5000000.0 / 838.0);
}
return myTimerActive;
}

View File

@ -255,7 +255,7 @@ PropertyType Properties::getPropertyType(const string& name)
{
for(int i = 0; i < LastPropType; ++i)
if(ourPropertyNames[i] == name)
return (PropertyType)i;
return PropertyType(i);
// Otherwise, indicate that the item wasn't found
return LastPropType;

View File

@ -569,7 +569,7 @@ int Settings::setInternal(const string& key, const Variant& value,
{
int idx = -1;
if(pos >= 0 && pos < (int)myInternalSettings.size() &&
if(pos >= 0 && pos < int(myInternalSettings.size()) &&
myInternalSettings[pos].key == key)
{
idx = pos;
@ -624,7 +624,7 @@ int Settings::setExternal(const string& key, const Variant& value,
{
int idx = -1;
if(pos >= 0 && pos < (int)myExternalSettings.size() &&
if(pos >= 0 && pos < int(myExternalSettings.size()) &&
myExternalSettings[pos].key == key)
{
idx = pos;

View File

@ -377,13 +377,13 @@ bool TIA::load(Serializer& in)
if(in.getString() != device)
return false;
myClockWhenFrameStarted = (Int32) in.getInt();
myClockStartDisplay = (Int32) in.getInt();
myClockStopDisplay = (Int32) in.getInt();
myClockAtLastUpdate = (Int32) in.getInt();
myClocksToEndOfScanLine = (Int32) in.getInt();
myClockWhenFrameStarted = in.getInt();
myClockStartDisplay = in.getInt();
myClockStopDisplay = in.getInt();
myClockAtLastUpdate = in.getInt();
myClocksToEndOfScanLine = in.getInt();
myScanlineCountForLastFrame = in.getInt();
myVSYNCFinishClock = (Int32) in.getInt();
myVSYNCFinishClock = in.getInt();
myEnabledObjects = in.getByte();
myDisabledObjects = in.getByte();
@ -424,24 +424,24 @@ bool TIA::load(Serializer& in)
myCurrentGRP1 = in.getByte();
myDumpEnabled = in.getBool();
myDumpDisabledCycle = (Int32) in.getInt();
myDumpDisabledCycle = in.getInt();
myPOSP0 = (Int16) in.getShort();
myPOSP1 = (Int16) in.getShort();
myPOSM0 = (Int16) in.getShort();
myPOSM1 = (Int16) in.getShort();
myPOSBL = (Int16) in.getShort();
myPOSP0 = in.getShort();
myPOSP1 = in.getShort();
myPOSM0 = in.getShort();
myPOSM1 = in.getShort();
myPOSBL = in.getShort();
myMotionClockP0 = (Int32) in.getInt();
myMotionClockP1 = (Int32) in.getInt();
myMotionClockM0 = (Int32) in.getInt();
myMotionClockM1 = (Int32) in.getInt();
myMotionClockBL = (Int32) in.getInt();
myMotionClockP0 = in.getInt();
myMotionClockP1 = in.getInt();
myMotionClockM0 = in.getInt();
myMotionClockM1 = in.getInt();
myMotionClockBL = in.getInt();
myStartP0 = (Int32) in.getInt();
myStartP1 = (Int32) in.getInt();
myStartM0 = (Int32) in.getInt();
myStartM1 = (Int32) in.getInt();
myStartP0 = in.getInt();
myStartP1 = in.getInt();
myStartM0 = in.getInt();
myStartM1 = in.getInt();
mySuppressP0 = in.getByte();
mySuppressP1 = in.getByte();
@ -452,8 +452,8 @@ bool TIA::load(Serializer& in)
myHMM1mmr = in.getBool();
myHMBLmmr = in.getBool();
myCurrentHMOVEPos = (Int32) in.getInt();
myPreviousHMOVEPos = (Int32) in.getInt();
myCurrentHMOVEPos = in.getInt();
myPreviousHMOVEPos = in.getInt();
myHMOVEBlankEnabled = in.getBool();
myFrameCounter = in.getInt();
@ -674,7 +674,7 @@ inline void TIA::endFrame()
// Make sure currentFrameBuffer() doesn't return a pointer that
// results in memory being accessed outside of the 160*320 bytes
// allocated for the frame buffer
if(myNextFrameJitter < -(Int32)(myFrameYStart))
if(myNextFrameJitter < -Int32(myFrameYStart))
myNextFrameJitter = myFrameYStart;
}
else if(myNextFrameJitter > 1)
@ -684,7 +684,7 @@ inline void TIA::endFrame()
// Make sure currentFrameBuffer() doesn't return a pointer that
// results in memory being accessed outside of the 160*320 bytes
// allocated for the frame buffer
if(myNextFrameJitter > 320 - (Int32)myFrameYStart - (Int32)myFrameHeight)
if(myNextFrameJitter > 320 - Int32(myFrameYStart) - Int32(myFrameHeight))
myNextFrameJitter = 320 - myFrameYStart - myFrameHeight;
}
else
@ -1292,7 +1292,7 @@ inline uInt8 TIA::dumpedInputPort(int resistance)
else
{
// Constant here is derived from '1.6 * 0.01e-6 * 228 / 3'
uInt32 needed = (uInt32)
uInt32 needed = uInt32
(1.216e-6 * resistance * myScanlineCountForLastFrame * myFramerate);
if((mySystem->cycles() - myDumpDisabledCycle) > needed)
return 0x80;
@ -1314,7 +1314,7 @@ uInt8 TIA::peek(uInt16 addr)
// valid bits in a TIA read), and selectively enable them
uInt8 value = 0x3F & (!myTIAPinsDriven ? mySystem->getDataBusState() :
mySystem->getDataBusState(0xFF));
uInt16 collision = myCollision & (uInt16)myCollisionEnabledMask;
uInt16 collision = myCollision & uInt16(myCollisionEnabledMask);
switch(addr & 0x000f)
{
@ -1423,7 +1423,7 @@ bool TIA::poke(uInt16 addr, uInt8 value)
updateFrame(clock + delay);
// If a VSYNC hasn't been generated in time go ahead and end the frame
if(((clock - myClockWhenFrameStarted) / 228) >= (Int32)myMaximumNumberOfScanlines)
if(((clock - myClockWhenFrameStarted) / 228) >= Int32(myMaximumNumberOfScanlines))
{
mySystem->m6502().stop();
myPartialFrameFlag = false;
@ -1624,7 +1624,7 @@ bool TIA::poke(uInt16 addr, uInt8 value)
case PF1: // Playfield register byte 1
{
myPF = (myPF & 0x000FF00F) | ((uInt32)value << 4);
myPF = (myPF & 0x000FF00F) | (uInt32(value) << 4);
if(myPF == 0)
myEnabledObjects &= ~PFBit;
@ -1641,7 +1641,7 @@ bool TIA::poke(uInt16 addr, uInt8 value)
case PF2: // Playfield register byte 2
{
myPF = (myPF & 0x00000FFF) | ((uInt32)value << 12);
myPF = (myPF & 0x00000FFF) | (uInt32(value) << 12);
if(myPF == 0)
myEnabledObjects &= ~PFBit;

View File

@ -70,14 +70,14 @@ void TIASurface::initialize(const Console& console, const VideoMode& mode)
bool p_enable = console.properties().get(Display_Phosphor) == "YES";
int p_blend = atoi(console.properties().get(Display_PPBlend).c_str());
enablePhosphor(p_enable, p_blend);
setNTSC((NTSCFilter::Preset)myOSystem.settings().getInt("tv.filter"), false);
setNTSC(NTSCFilter::Preset(myOSystem.settings().getInt("tv.filter")), false);
// Scanline repeating is sensitive to non-integral vertical resolution,
// so rounding is performed to eliminate it
// This won't be 100% accurate, but non-integral scaling isn't 100%
// accurate anyway
mySLineSurface->setSrcSize(1, int(2 * float(mode.image.height()) /
floor(((float)mode.image.height() / myTIA->height()) + 0.5)));
floor((float(mode.image.height()) / myTIA->height()) + 0.5)));
#if 0
cerr << "INITIALIZE:\n"
@ -109,9 +109,9 @@ void TIASurface::setPalette(const uInt32* tia_palette, const uInt32* rgb_palette
uInt8 gj = (rgb_palette[j] >> 8) & 0xff;
uInt8 bj = rgb_palette[j] & 0xff;
Uint8 r = (Uint8) getPhosphor(ri, rj);
Uint8 g = (Uint8) getPhosphor(gi, gj);
Uint8 b = (Uint8) getPhosphor(bi, bj);
uInt8 r = getPhosphor(ri, rj);
uInt8 g = getPhosphor(gi, gj);
uInt8 b = getPhosphor(bi, bj);
myPhosphorPalette[i][j] = myFB.mapRGB(r, g, b);
}
@ -169,7 +169,7 @@ void TIASurface::setNTSC(NTSCFilter::Preset preset, bool show)
const string& mode = myNTSCFilter.setPreset(preset);
buf << "TV filtering (" << mode << " mode)";
}
myOSystem.settings().setValue("tv.filter", (int)preset);
myOSystem.settings().setValue("tv.filter", int(preset));
if(show) myFB.showMessage(buf.str());
}
@ -326,7 +326,7 @@ void TIASurface::render()
{
uInt32 pos = screenofsY;
for(uInt32 x = 0; x < width; ++x)
buffer[pos++] = (uInt32) myPalette[currentFrame[bufofsY + x]];
buffer[pos++] = myPalette[currentFrame[bufofsY + x]];
bufofsY += width;
screenofsY += pitch;
@ -343,8 +343,7 @@ void TIASurface::render()
for(uInt32 x = 0; x < width; ++x)
{
const uInt32 bufofs = bufofsY + x;
buffer[pos++] = (uInt32)
myPhosphorPalette[currentFrame[bufofs]][previousFrame[bufofs]];
buffer[pos++] = myPhosphorPalette[currentFrame[bufofs]][previousFrame[bufofs]];
}
bufofsY += width;
screenofsY += pitch;

View File

@ -54,7 +54,7 @@ TrackBall::~TrackBall()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TrackBall::read()
{
int scanline = ((System&)mySystem).tia().scanlines();
int scanline = mySystem.tia().scanlines();
if(myScanCountV > scanline) myScanCountV = 0;
if(myScanCountH > scanline) myScanCountH = 0;

View File

@ -64,8 +64,8 @@ void CheckListWidget::setList(const StringList& list, const BoolArray& state)
_checkList[i]->setFlags(WIDGET_ENABLED);
// Then turn off any extras
if((int)_stateList.size() < _rows)
for(int i = (int)_stateList.size(); i < _rows; ++i)
if(int(_stateList.size()) < _rows)
for(int i = int(_stateList.size()); i < _rows; ++i)
_checkList[i]->clearFlags(WIDGET_ENABLED);
ListWidget::recalc();
@ -74,7 +74,7 @@ void CheckListWidget::setList(const StringList& list, const BoolArray& state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckListWidget::setLine(int line, const string& str, const bool& state)
{
if(line >= (int)_list.size())
if(line >= int(_list.size()))
return;
_list[line] = str;
@ -86,7 +86,7 @@ void CheckListWidget::drawWidget(bool hilite)
{
//cerr << "CheckListWidget::drawWidget\n";
FBSurface& s = _boss->dialog().surface();
int i, pos, len = (int)_list.size();
int i, pos, len = _list.size();
// Draw a thin frame around the list and to separate columns
s.hLine(_x, _y, _x + _w - 1, kColor);
@ -151,7 +151,7 @@ GUI::Rect CheckListWidget::getEditRect() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CheckListWidget::getState(int line)
{
if(line >= 0 && line < (int)_stateList.size())
if(line >= 0 && line < int(_stateList.size()))
return _stateList[line];
else
return false;

View File

@ -72,14 +72,14 @@ void InputTextDialog::initialize(const GUI::Font& lfont, const GUI::Font& nfont,
// Calculate real dimensions
_w = fontWidth * 35;
_h = lineHeight * 4 + (int)labels.size() * (lineHeight + 5);
_h = lineHeight * 4 + labels.size() * (lineHeight + 5);
// Determine longest label
for(i = 0; i < labels.size(); ++i)
{
if(labels[i].length() > lwidth)
{
lwidth = (int)labels[i].length();
lwidth = labels[i].length();
maxIdx = i;
}
}
@ -163,7 +163,7 @@ void InputTextDialog::setTitle(const string& title)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& InputTextDialog::getResult(int idx)
{
if((uInt32)idx < myInput.size())
if(uInt32(idx) < myInput.size())
return myInput[idx]->getText();
else
return EmptyString;
@ -172,21 +172,21 @@ const string& InputTextDialog::getResult(int idx)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setText(const string& str, int idx)
{
if((uInt32)idx < myInput.size())
if(uInt32(idx) < myInput.size())
myInput[idx]->setText(str);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setTextFilter(const EditableWidget::TextFilter& f, int idx)
{
if((uInt32)idx < myInput.size())
if(uInt32(idx) < myInput.size())
myInput[idx]->setTextFilter(f);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void InputTextDialog::setFocus(int idx)
{
if((uInt32)idx < myInput.size())
if(uInt32(idx) < myInput.size())
Dialog::setFocus(getFocusList()[idx]);
}

View File

@ -37,10 +37,10 @@ Launcher::Launcher(OSystem& osystem)
// The launcher dialog is resizable, within certain bounds
// We check those bounds now
myWidth = BSPF_max(myWidth, (uInt32)FrameBuffer::kFBMinW);
myHeight = BSPF_max(myHeight, (uInt32)FrameBuffer::kFBMinH);
myWidth = BSPF_min(myWidth, (uInt32)d.w);
myHeight = BSPF_min(myHeight, (uInt32)d.h);
myWidth = BSPF_max(myWidth, uInt32(FrameBuffer::kFBMinW));
myHeight = BSPF_max(myHeight, uInt32(FrameBuffer::kFBMinH));
myWidth = BSPF_min(myWidth, uInt32(d.w));
myHeight = BSPF_min(myHeight, uInt32(d.h));
myOSystem.settings().setValue("launcherres",
GUI::Size(myWidth, myHeight));

View File

@ -275,7 +275,7 @@ void LauncherDialog::updateListing(const string& nameToSelect)
// Now fill the list widget with the contents of the GameList
StringList l;
for (int i = 0; i < (int) myGameList->size(); ++i)
for(uInt32 i = 0; i < myGameList->size(); ++i)
l.push_back(myGameList->name(i));
myList->setList(l);
@ -398,7 +398,7 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
const char* haystack = s.c_str();
const char* needle = pattern.c_str();
uInt8 b = tolower((uInt8) *needle);
uInt8 b = tolower(*needle);
needle++;
for(;; haystack++)
@ -407,7 +407,7 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
return false;
/* The first character matches */
if (tolower ((uInt8) *haystack) == b)
if(tolower(*haystack) == b)
{
const char* rhaystack = haystack + 1;
const char* rneedle = needle;
@ -420,8 +420,7 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
return false;
/* Nothing in this round */
if (tolower ((uInt8) *rhaystack)
!= tolower ((uInt8) *rneedle))
if(tolower(*rhaystack) != tolower(*rneedle))
break;
}
}

View File

@ -68,7 +68,7 @@ ListWidget::~ListWidget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ListWidget::setSelected(int item)
{
if(item < 0 || item >= (int)_list.size())
if(item < 0 || item >= int(_list.size()))
{
setDirty(); // Simply redraw and exit
return;
@ -117,7 +117,7 @@ void ListWidget::setSelected(const string& item)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ListWidget::setHighlighted(int item)
{
if(item < -1 || item >= (int)_list.size())
if(item < -1 || item >= int(_list.size()))
return;
if(isEnabled())
@ -140,14 +140,14 @@ void ListWidget::setHighlighted(int item)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& ListWidget::getSelectedString() const
{
return (_selectedItem >= 0 && _selectedItem < (int)_list.size())
return (_selectedItem >= 0 && _selectedItem < int(_list.size()))
? _list[_selectedItem] : EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ListWidget::scrollTo(int item)
{
int size = (int)_list.size();
int size = _list.size();
if (item >= size)
item = size - 1;
if (item < 0)
@ -163,7 +163,7 @@ void ListWidget::scrollTo(int item)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ListWidget::recalc()
{
int size = (int)_list.size();
int size = _list.size();
if (_currentPos >= size)
_currentPos = size - 1;
@ -175,7 +175,7 @@ void ListWidget::recalc()
_editMode = false;
_scrollBar->_numEntries = (int)_list.size();
_scrollBar->_numEntries = _list.size();
_scrollBar->_entriesPerPage = _rows;
// Reset to normal data entry
@ -199,7 +199,7 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount)
// First check whether the selection changed
int newSelectedItem;
newSelectedItem = findItem(x, y);
if (newSelectedItem >= (int)_list.size())
if (newSelectedItem >= int(_list.size()))
return;
if (_selectedItem != newSelectedItem)
@ -340,6 +340,7 @@ bool ListWidget::handleEvent(Event::Type e)
bool handled = true;
int oldSelectedItem = _selectedItem;
int size = _list.size();
switch(e)
{
@ -359,7 +360,7 @@ bool ListWidget::handleEvent(Event::Type e)
break;
case Event::UIDown:
if (_selectedItem < (int)_list.size() - 1)
if (_selectedItem < size - 1)
_selectedItem++;
break;
@ -371,8 +372,8 @@ bool ListWidget::handleEvent(Event::Type e)
case Event::UIPgDown:
_selectedItem += _rows - 1;
if (_selectedItem >= (int)_list.size() )
_selectedItem = (int)_list.size() - 1;
if (_selectedItem >= size)
_selectedItem = size - 1;
break;
case Event::UIHome:
@ -380,7 +381,7 @@ bool ListWidget::handleEvent(Event::Type e)
break;
case Event::UIEnd:
_selectedItem = (int)_list.size() - 1;
_selectedItem = size - 1;
break;
case Event::UIPrevDir:
@ -417,7 +418,7 @@ void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
switch (cmd)
{
case kSetPositionCmd:
if (_currentPos != (int)data)
if (_currentPos != data)
{
_currentPos = data;
setDirty();
@ -444,10 +445,10 @@ void ListWidget::scrollToCurrent(int item)
_currentPos = item - _rows + 1;
}
if (_currentPos < 0 || _rows > (int)_list.size())
if (_currentPos < 0 || _rows > int(_list.size()))
_currentPos = 0;
else if (_currentPos + _rows > (int)_list.size())
_currentPos = (int)_list.size() - _rows;
else if (_currentPos + _rows > int(_list.size()))
_currentPos = int(_list.size()) - _rows;
int oldScrollPos = _scrollBar->_currentPos;
_scrollBar->_currentPos = _currentPos;

View File

@ -74,9 +74,9 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text)
// Set real dimensions
int str_w = 0;
for(const auto& s: text)
str_w = BSPF_max((int)s.length(), str_w);
str_w = BSPF_max(int(s.length()), str_w);
_w = BSPF_min(str_w * fontWidth + 20, _w);
_h = BSPF_min((uInt32)((text.size() + 2) * lineHeight + 20), (uInt32)_h);
_h = BSPF_min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h));
xpos = 10; ypos = 10;
for(const auto& s: text)

View File

@ -74,7 +74,7 @@ void ProgressDialog::setRange(int start, int finish, int step)
{
myStart = start;
myFinish = finish;
myStep = (int)((step / 100.0) * (myFinish - myStart + 1));
myStep = int((step / 100.0) * (myFinish - myStart + 1));
mySlider->setMinValue(myStart);
mySlider->setMaxValue(myFinish);

View File

@ -129,7 +129,7 @@ void RomAuditDialog::auditRoms()
// the ROMs, since this is usually a time-consuming operation
ProgressDialog progress(this, instance().frameBuffer().font(),
"Auditing ROM files ...");
progress.setRange(0, (int)files.size() - 1, 5);
progress.setRange(0, files.size() - 1, 5);
// Create a entry for the GameList for each file
Properties props;

View File

@ -48,7 +48,7 @@ void StringListWidget::setList(const StringList& list)
void StringListWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
int i, pos, len = (int)_list.size();
int i, pos, len = _list.size();
// Draw a thin frame around the list.
s.hLine(_x, _y, _x + _w - 1, kColor);

View File

@ -70,7 +70,7 @@ int TabWidget::addTab(const string& title)
{
// Add a new tab page
_tabs.push_back(Tab(title));
int numTabs = (int)_tabs.size();
int numTabs = _tabs.size();
// Determine the new tab width
int newWidth = _font.getStringWidth(title) + 2 * kTabPadding;
@ -90,7 +90,7 @@ int TabWidget::addTab(const string& title)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::setActiveTab(int tabID, bool show)
{
assert(0 <= tabID && tabID < (int)_tabs.size());
assert(0 <= tabID && tabID < int(_tabs.size()));
if (_activeTab != -1)
{
@ -110,7 +110,7 @@ void TabWidget::setActiveTab(int tabID, bool show)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::disableTab(int tabID)
{
assert(0 <= tabID && tabID < (int)_tabs.size());
assert(0 <= tabID && tabID < int(_tabs.size()));
_tabs[tabID].enabled = false;
// TODO - also disable all widgets belonging to this tab
@ -152,12 +152,12 @@ void TabWidget::cycleTab(int direction)
{
tabID--;
if(tabID == -1)
tabID = (int)_tabs.size() - 1;
tabID = int(_tabs.size()) - 1;
}
else if(direction == 1) // Go to the next tab, wrap around at end
{
tabID++;
if(tabID == (int)_tabs.size())
if(tabID == int(_tabs.size()))
tabID = 0;
}
@ -169,7 +169,7 @@ void TabWidget::cycleTab(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::setParentWidget(int tabID, Widget* parent)
{
assert(0 <= tabID && tabID < (int)_tabs.size());
assert(0 <= tabID && tabID < int(_tabs.size()));
_tabs[tabID].parentWidget = parent;
}
@ -184,7 +184,7 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount)
if (x >= 0 && x % (_tabWidth + kTabSpacing) < _tabWidth)
{
tabID = x / (_tabWidth + kTabSpacing);
if (tabID >= (int)_tabs.size())
if (tabID >= int(_tabs.size()))
tabID = -1;
}
@ -284,7 +284,7 @@ void TabWidget::drawWidget(bool hilite)
// Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset;
for (i = 0; i < (int)_tabs.size(); ++i)
for (i = 0; i < int(_tabs.size()); ++i)
{
uInt32 fontcolor = _tabs[i].enabled ? kTextColor : kColor;
uInt32 boxcolor = (i == _activeTab) ? kColor : kShadowColor;

View File

@ -315,8 +315,8 @@ void UIDialog::loadConfig()
const GUI::Size& ls = instance().settings().getSize("launcherres");
uInt32 w = ls.w, h = ls.h;
w = BSPF_max(w, (uInt32)FrameBuffer::kFBMinW);
h = BSPF_max(h, (uInt32)FrameBuffer::kFBMinH);
w = BSPF_max(w, uInt32(FrameBuffer::kFBMinW));
h = BSPF_max(h, uInt32(FrameBuffer::kFBMinH));
w = BSPF_min(w, instance().frameBuffer().desktopSize().w);
h = BSPF_min(h, instance().frameBuffer().desktopSize().h);
@ -341,8 +341,8 @@ void UIDialog::loadConfig()
// Debugger size
const GUI::Size& ds = instance().settings().getSize("dbg.res");
w = ds.w, h = ds.h;
w = BSPF_max(w, (uInt32)DebuggerDialog::kSmallFontMinW);
h = BSPF_max(h, (uInt32)DebuggerDialog::kSmallFontMinH);
w = BSPF_max(w, uInt32(DebuggerDialog::kSmallFontMinW));
h = BSPF_max(h, uInt32(DebuggerDialog::kSmallFontMinH));
w = BSPF_min(w, ds.w);
h = BSPF_min(h, ds.h);
@ -437,8 +437,8 @@ void UIDialog::setDefaults()
case 1: // Debugger options
{
#ifdef DEBUGGER_SUPPORT
uInt32 w = BSPF_min(instance().frameBuffer().desktopSize().w, (uInt32)DebuggerDialog::kMediumFontMinW);
uInt32 h = BSPF_min(instance().frameBuffer().desktopSize().h, (uInt32)DebuggerDialog::kMediumFontMinH);
uInt32 w = BSPF_min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW));
uInt32 h = BSPF_min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH));
myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w);
myDebuggerHeightSlider->setValue(h);

View File

@ -370,7 +370,7 @@ void VideoDialog::loadConfig()
myTVMode->setSelected(
instance().settings().getString("tv.filter"), "0");
int preset = instance().settings().getInt("tv.filter");
handleTVModeChange((NTSCFilter::Preset)preset);
handleTVModeChange(NTSCFilter::Preset(preset));
// TV Custom adjustables
loadTVAdjustables(NTSCFilter::PRESET_CUSTOM);
@ -562,7 +562,7 @@ void VideoDialog::loadTVAdjustables(NTSCFilter::Preset preset)
{
NTSCFilter::Adjustable adj;
instance().frameBuffer().tiaSurface().ntsc().getAdjustables(
adj, (NTSCFilter::Preset)preset);
adj, NTSCFilter::Preset(preset));
myTVSharp->setValue(adj.sharpness);
myTVSharpLabel->setValue(adj.sharpness);
myTVHue->setValue(adj.hue);
@ -616,7 +616,7 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kTVModeChanged:
handleTVModeChange((NTSCFilter::Preset)myTVMode->getSelectedTag().toInt());
handleTVModeChange(NTSCFilter::Preset(myTVMode->getSelectedTag().toInt()));
case kTVSharpChanged: myTVSharpLabel->setValue(myTVSharp->getValue());
break;

View File

@ -201,7 +201,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
bool emitFocusEvents)
{
FBSurface& s = boss->dialog().surface();
int size = (int)arr.size(), pos = -1;
int size = arr.size(), pos = -1;
Widget* tmp;
for(int i = 0; i < size; ++i)
{
@ -605,7 +605,7 @@ void SliderWidget::handleMouseMoved(int x, int y, int button)
{
// TODO: when the mouse is dragged outside the widget, the slider should
// snap back to the old value.
if(isEnabled() && _isDragging && x >= (int)_labelWidth)
if(isEnabled() && _isDragging && x >= int(_labelWidth))
setValue(posToValue(x - _labelWidth));
}

View File

@ -17,7 +17,7 @@ void yyerror(const char *e) {
errMsg = e;
// be extra paranoid about deletion
if(lastExp && dynamic_cast<Expression*>(lastExp))
if(lastExp && reinterpret_cast<Expression*>(lastExp))
delete lastExp;
lastExp = nullptr;

View File

@ -82,7 +82,7 @@ void yyerror(const char *e) {
errMsg = e;
// be extra paranoid about deletion
if(lastExp && dynamic_cast<Expression*>(lastExp))
if(lastExp && reinterpret_cast<Expression*>(lastExp))
delete lastExp;
lastExp = nullptr;