diff --git a/OSBindings/Mac/Clock SignalTests/6502InterruptTests.swift b/OSBindings/Mac/Clock SignalTests/6502InterruptTests.swift index a6c0def50..691ef4613 100644 --- a/OSBindings/Mac/Clock SignalTests/6502InterruptTests.swift +++ b/OSBindings/Mac/Clock SignalTests/6502InterruptTests.swift @@ -31,7 +31,7 @@ class MOS6502InterruptTests: XCTestCase { machine.setValue(0x4000, for: CSTestMachine6502Register.programCounter) } - func testIRQLine() { + func testIRQLine() { // run for six cycles; check that no interrupt has occurred machine.runForNumber(ofCycles: 6) XCTAssert(machine.value(for: .programCounter) == 0x4003, "No interrupt should have occurred with line low") @@ -46,9 +46,9 @@ class MOS6502InterruptTests: XCTestCase { XCTAssert(machine.value(for: .programCounter) != 0x1234, "Interrupt routine should not yet have begun") machine.runForNumber(ofCycles: 1) XCTAssert(machine.value(for: .programCounter) == 0x1234, "Interrupt routine should just have begun") - } + } - func testIFlagSet() { + func testIFlagSet() { // enable the interrupt line, run for eleven cycles to get past the CLIP and the following NOP and into the interrupt routine machine.irqLine = true machine.runForNumber(ofCycles: 11) @@ -57,7 +57,7 @@ class MOS6502InterruptTests: XCTestCase { XCTAssert(machine.value(for: .flags) & 0x04 == 0x04, "Interrupt status flag should be set") } - func testCLISEIFlagClear() { + func testCLISEIFlagClear() { // set up an SEI as the second instruction, enable the IRQ line machine.setValue(0x78, forAddress: 0x4001) machine.irqLine = true diff --git a/OSBindings/SDL/main.cpp b/OSBindings/SDL/main.cpp index e1a608e97..ea5b21a4c 100644 --- a/OSBindings/SDL/main.cpp +++ b/OSBindings/SDL/main.cpp @@ -287,16 +287,16 @@ std::string final_path_component(const std::string &path) { Executes @c command and returns its STDOUT. */ std::string system_get(const char *command) { - std::unique_ptr pipe(popen(command, "r"), pclose); - if(!pipe) return ""; + std::unique_ptr pipe(popen(command, "r"), pclose); + if(!pipe) return ""; std::string result; - while(!feof(pipe.get())) { + while(!feof(pipe.get())) { std::array buffer; - if (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) - result += buffer.data(); - } - return result; + if(fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) + result += buffer.data(); + } + return result; } } diff --git a/Storage/Disk/DiskImage/Formats/NIB.cpp b/Storage/Disk/DiskImage/Formats/NIB.cpp index da6e883d1..f0c7d2480 100644 --- a/Storage/Disk/DiskImage/Formats/NIB.cpp +++ b/Storage/Disk/DiskImage/Formats/NIB.cpp @@ -179,7 +179,7 @@ void NIB::set_tracks(const std::map> &tra // Lock the file and spool out. std::lock_guard lock_guard(file_.get_file_access_mutex()); for(const auto &track: tracks_by_address) { - file_.seek(file_offset(track.first), SEEK_SET); - file_.write(track.second); + file_.seek(file_offset(track.first), SEEK_SET); + file_.write(track.second); } } diff --git a/Storage/FileHolder.cpp b/Storage/FileHolder.cpp index dbba21d97..7a2f6f614 100644 --- a/Storage/FileHolder.cpp +++ b/Storage/FileHolder.cpp @@ -42,55 +42,55 @@ FileHolder::FileHolder(const std::string &file_name, FileMode ideal_mode) } uint32_t FileHolder::get32le() { - uint32_t result = static_cast(std::fgetc(file_)); - result |= static_cast(std::fgetc(file_)) << 8; - result |= static_cast(std::fgetc(file_)) << 16; - result |= static_cast(std::fgetc(file_)) << 24; + uint32_t result = static_cast(std::fgetc(file_)); + result |= static_cast(std::fgetc(file_)) << 8; + result |= static_cast(std::fgetc(file_)) << 16; + result |= static_cast(std::fgetc(file_)) << 24; - return result; + return result; } uint32_t FileHolder::get32be() { - uint32_t result = static_cast(std::fgetc(file_)) << 24; - result |= static_cast(std::fgetc(file_)) << 16; - result |= static_cast(std::fgetc(file_)) << 8; - result |= static_cast(std::fgetc(file_)); + uint32_t result = static_cast(std::fgetc(file_)) << 24; + result |= static_cast(std::fgetc(file_)) << 16; + result |= static_cast(std::fgetc(file_)) << 8; + result |= static_cast(std::fgetc(file_)); - return result; + return result; } uint32_t FileHolder::get24le() { - uint32_t result = static_cast(std::fgetc(file_)); - result |= static_cast(std::fgetc(file_)) << 8; - result |= static_cast(std::fgetc(file_)) << 16; + uint32_t result = static_cast(std::fgetc(file_)); + result |= static_cast(std::fgetc(file_)) << 8; + result |= static_cast(std::fgetc(file_)) << 16; - return result; + return result; } uint32_t FileHolder::get24be() { - uint32_t result = static_cast(std::fgetc(file_)) << 16; - result |= static_cast(std::fgetc(file_)) << 8; - result |= static_cast(std::fgetc(file_)); + uint32_t result = static_cast(std::fgetc(file_)) << 16; + result |= static_cast(std::fgetc(file_)) << 8; + result |= static_cast(std::fgetc(file_)); - return result; + return result; } uint16_t FileHolder::get16le() { - uint16_t result = static_cast(std::fgetc(file_)); - result |= static_cast(static_cast(std::fgetc(file_)) << 8); + uint16_t result = static_cast(std::fgetc(file_)); + result |= static_cast(static_cast(std::fgetc(file_)) << 8); - return result; + return result; } uint16_t FileHolder::get16be() { - uint16_t result = static_cast(static_cast(std::fgetc(file_)) << 8); - result |= static_cast(std::fgetc(file_)); + uint16_t result = static_cast(static_cast(std::fgetc(file_)) << 8); + result |= static_cast(std::fgetc(file_)); - return result; + return result; } uint8_t FileHolder::get8() { - return static_cast(std::fgetc(file_)); + return static_cast(std::fgetc(file_)); } void FileHolder::put16be(uint16_t value) { @@ -118,7 +118,7 @@ std::vector FileHolder::read(std::size_t size) { } std::size_t FileHolder::read(uint8_t *buffer, std::size_t size) { - return std::fread(buffer, 1, size, file_); + return std::fread(buffer, 1, size, file_); } std::size_t FileHolder::write(const std::vector &buffer) { @@ -126,7 +126,7 @@ std::size_t FileHolder::write(const std::vector &buffer) { } std::size_t FileHolder::write(const uint8_t *buffer, std::size_t size) { - return std::fwrite(buffer, 1, size, file_); + return std::fwrite(buffer, 1, size, file_); } void FileHolder::seek(long offset, int whence) { @@ -160,22 +160,22 @@ bool FileHolder::check_signature(const char *signature, std::size_t length) { } std::string FileHolder::extension() { - std::size_t pointer = name_.size() - 1; - while(pointer > 0 && name_[pointer] != '.') pointer--; - if(name_[pointer] == '.') pointer++; + std::size_t pointer = name_.size() - 1; + while(pointer > 0 && name_[pointer] != '.') pointer--; + if(name_[pointer] == '.') pointer++; - std::string extension = name_.substr(pointer); - std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); - return extension; + std::string extension = name_.substr(pointer); + std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); + return extension; } void FileHolder::ensure_is_at_least_length(long length) { - std::fseek(file_, 0, SEEK_END); - long bytes_to_write = length - ftell(file_); - if(bytes_to_write > 0) { - std::vector empty(static_cast(bytes_to_write), 0); - std::fwrite(empty.data(), sizeof(uint8_t), static_cast(bytes_to_write), file_); - } + std::fseek(file_, 0, SEEK_END); + long bytes_to_write = length - ftell(file_); + if(bytes_to_write > 0) { + std::vector empty(static_cast(bytes_to_write), 0); + std::fwrite(empty.data(), sizeof(uint8_t), static_cast(bytes_to_write), file_); + } } bool FileHolder::get_is_known_read_only() {