Remove several BSPF defines that are obsolete.

Changed valid() method Serializer to an explicit bool() operator,
to function similar to C++ streams.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3185 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-07-11 22:03:12 +00:00
parent 4c8fb3c17d
commit 05623c52eb
7 changed files with 13 additions and 19 deletions

View File

@ -66,9 +66,9 @@ using StringList = vector<string>;
using BytePtr = unique_ptr<uInt8[]>;
// Defines to help with path handling
#if (defined(BSPF_UNIX) || defined(BSPF_MAC_OSX))
#if defined(BSPF_UNIX) || defined(BSPF_MAC_OSX)
#define BSPF_PATH_SEPARATOR "/"
#elif (defined(BSPF_DOS) || defined(BSPF_WINDOWS) || defined(BSPF_OS2))
#elif defined(BSPF_WINDOWS)
#define BSPF_PATH_SEPARATOR "\\"
#else
#error Update src/common/bspf.hxx for path separator

View File

@ -667,7 +667,7 @@ bool Debugger::RewindManager::addState()
myStateList[myTop] = new Serializer();
Serializer& s = *(myStateList[myTop]);
if(s.valid())
if(s)
{
s.reset();
if(myOSystem.state().saveState(s) && myOSystem.console().tia().saveDisplay(s))

View File

@ -450,7 +450,7 @@ void CartridgeCTY::loadTune(uInt8 index)
void CartridgeCTY::loadScore(uInt8 index)
{
Serializer serializer(myEEPROMFile, true);
if(serializer.valid())
if(serializer)
{
uInt8 scoreRAM[256];
try
@ -470,7 +470,7 @@ void CartridgeCTY::loadScore(uInt8 index)
void CartridgeCTY::saveScore(uInt8 index)
{
Serializer serializer(myEEPROMFile);
if(serializer.valid())
if(serializer)
{
// Load score RAM
uInt8 scoreRAM[256];
@ -504,7 +504,7 @@ void CartridgeCTY::saveScore(uInt8 index)
void CartridgeCTY::wipeAllScores()
{
Serializer serializer(myEEPROMFile);
if(serializer.valid())
if(serializer)
{
// Erase score RAM
uInt8 scoreRAM[256];

View File

@ -371,7 +371,7 @@ uInt8 CartridgeFA2::ramReadWrite()
// We go ahead and do the access now, and only return when a sufficient
// amount of time has passed
Serializer serializer(myFlashFile);
if(serializer.valid())
if(serializer)
{
if(myRAM[255] == 1) // read
{
@ -423,7 +423,7 @@ uInt8 CartridgeFA2::ramReadWrite()
void CartridgeFA2::flash(uInt8 operation)
{
Serializer serializer(myFlashFile);
if(serializer.valid())
if(serializer)
{
if(operation == 0) // erase
{

View File

@ -79,12 +79,6 @@ Serializer::Serializer()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Serializer::valid() const
{
return myStream != nullptr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Serializer::reset()
{

View File

@ -61,7 +61,7 @@ class Serializer
Answers whether the serializer is currently initialized for reading
and writing.
*/
bool valid() const;
explicit operator bool() const { return myStream != nullptr; }
/**
Resets the read/write location to the beginning of the stream.

View File

@ -173,7 +173,7 @@ void StateManager::loadState(int slot)
// Make sure the file can be opened in read-only mode
Serializer in(buf.str(), true);
if(!in.valid())
if(!in)
{
buf.str("");
buf << "Can't open/load from state file " << slot;
@ -221,7 +221,7 @@ void StateManager::saveState(int slot)
// Make sure the file can be opened for writing
Serializer out(buf.str());
if(!out.valid())
if(!out)
{
buf.str("");
buf << "Can't open/save to state file " << slot;
@ -282,7 +282,7 @@ bool StateManager::loadState(Serializer& in)
if(myOSystem.hasConsole())
{
// Make sure the file can be opened for reading
if(in.valid())
if(in)
{
// First test if we have a valid header and cart type
// If so, do a complete state load using the Console
@ -307,7 +307,7 @@ bool StateManager::saveState(Serializer& out)
if(myOSystem.hasConsole())
{
// Make sure the file can be opened for writing
if(out.valid())
if(out)
{
// Add header so that if the state format changes in the future,
// we'll know right away, without having to parse the rest of the file