Removed duplicate code

This commit is contained in:
Uwe Seimet 2021-08-25 13:00:26 +02:00
parent 12cafe7ff5
commit 99807a9dbe

View File

@ -20,6 +20,7 @@
#include "os.h" #include "os.h"
#include "xm6.h" #include "xm6.h"
#include "controllers/sasidev_ctrl.h" #include "controllers/sasidev_ctrl.h"
#include "device_factory.h"
#include "exceptions.h" #include "exceptions.h"
#include "disk.h" #include "disk.h"
#include <sstream> #include <sstream>
@ -1753,7 +1754,8 @@ int Disk::GetSectorSizeInBytes() const
void Disk::SetSectorSizeInBytes(int size, bool sasi) void Disk::SetSectorSizeInBytes(int size, bool sasi)
{ {
if (sasi && size != 256 && size != 1024) { vector<int> sector_sizes = sasi ? DeviceFactory::instance().GetSasiSectorSizes() : DeviceFactory::instance().GetScsiSectorSizes();
if (find(sector_sizes.begin(), sector_sizes.end(), size) == sector_sizes.end()) {
stringstream error; stringstream error;
error << "Invalid sector size of " << size << " bytes"; error << "Invalid sector size of " << size << " bytes";
throw io_exception(error.str()); throw io_exception(error.str());
@ -1781,9 +1783,8 @@ void Disk::SetSectorSizeInBytes(int size, bool sasi)
break; break;
default: default:
stringstream error; assert(false);
error << "Invalid sector size of " << size << " bytes"; disk.size = 9;
throw io_exception(error.str());
break; break;
} }
} }