Fixes for some issues picked up when compiling in OSX. This is

why compiling for multiple platforms with different compilers
really helps the robustness of code ...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2492 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-05-21 21:33:39 +00:00
parent beb18bfc43
commit e1ebfec032
1 changed files with 6 additions and 9 deletions

View File

@ -124,7 +124,7 @@ uInt8 Serializer::getByte(void)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Serializer::getByteArray(uInt8* array, uInt32 size) void Serializer::getByteArray(uInt8* array, uInt32 size)
{ {
myStream->read((char*)array, (streamsize)size); myStream->read((char*)array, size);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -162,8 +162,8 @@ string Serializer::getString(void)
{ {
int len = getInt(); int len = getInt();
string str; string str;
str.resize((string::size_type)len); str.resize(len);
myStream->read(&str[0], (streamsize)len); myStream->read(&str[0], len);
return str; return str;
} }
@ -171,7 +171,7 @@ string Serializer::getString(void)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Serializer::getBool(void) bool Serializer::getBool(void)
{ {
return getByte() == (char)TruePattern; return getByte() == TruePattern;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -183,7 +183,7 @@ void Serializer::putByte(uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Serializer::putByteArray(const uInt8* array, uInt32 size) void Serializer::putByteArray(const uInt8* array, uInt32 size)
{ {
myStream->write((char*)array, (streamsize)size); myStream->write((char*)array, size);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -215,10 +215,7 @@ void Serializer::putString(const string& str)
{ {
int len = str.length(); int len = str.length();
putInt(len); putInt(len);
myStream->write(str.data(), (streamsize)len); myStream->write(str.data(), len);
if(myStream->bad())
throw "Serializer::putString() file write failed";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -