From 77aa4b52ec0dcd0c83b4183eac3ba5340b0085f9 Mon Sep 17 00:00:00 2001 From: sh95014 <95387068+sh95014@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:26:52 -0800 Subject: [PATCH] consistent formatting of 'else' --- source/frontends/mariani/AppDelegate.mm | 3 +- source/frontends/mariani/UserDefaults.m | 3 +- .../mariani/browser/DataFormatBASIC.m | 42 ++++++++++++------- .../DiskImageBrowserWindowController.mm | 6 ++- .../debugger/DebuggerWindowController.mm | 3 +- .../DisassemblyTableViewController.mm | 6 ++- .../preferences/PreferencesViewController.mm | 9 ++-- 7 files changed, 48 insertions(+), 24 deletions(-) diff --git a/source/frontends/mariani/AppDelegate.mm b/source/frontends/mariani/AppDelegate.mm index d127708cb..13daa220b 100644 --- a/source/frontends/mariani/AppDelegate.mm +++ b/source/frontends/mariani/AppDelegate.mm @@ -253,7 +253,8 @@ - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { NSArray *supportedTypes = nil; if ([sender isEqual:self.diskOpenPanel]) { supportedTypes = @[ @"BIN", @"DO", @"DSK", @"NIB", @"PO", @"WOZ", @"ZIP", @"GZIP", @"GZ" ]; - } else if ([sender isEqual:self.tapeOpenPanel]) { + } + else if ([sender isEqual:self.tapeOpenPanel]) { supportedTypes = @[ @"WAV" ]; } return [supportedTypes containsObject:url.pathExtension.uppercaseString]; diff --git a/source/frontends/mariani/UserDefaults.m b/source/frontends/mariani/UserDefaults.m index 061e4818c..f2783b3f0 100644 --- a/source/frontends/mariani/UserDefaults.m +++ b/source/frontends/mariani/UserDefaults.m @@ -66,7 +66,8 @@ - (NSString *)gameController { if ([fullName isEqualToString:GameControllerNone] || [fullName isEqualToString:GameControllerNumericKeypad]) { return fullName; - } else if (fullName.length > 0) { + } + else if (fullName.length > 0) { // make sure the selected controller is still conected for (GCController *controller in [GCController controllers]) { if ([controller.fullName isEqualToString:fullName]) { diff --git a/source/frontends/mariani/browser/DataFormatBASIC.m b/source/frontends/mariani/browser/DataFormatBASIC.m index ca9315050..e1e1d11ea 100644 --- a/source/frontends/mariani/browser/DataFormatBASIC.m +++ b/source/frontends/mariani/browser/DataFormatBASIC.m @@ -52,7 +52,8 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) val = *(*pBuf)++; val |= *(*pBuf)++ << 8; *pLength -= 2; - } else { + } + else { // ought to throw an exception here assert(false); val = (uint16_t) -1; @@ -169,31 +170,38 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) if (!inRem) { [outputString RTFSetColor:kDefaultColor]; } - } else { + } + else { /* simple character */ if (fUseRTF) { if (*srcPtr == '"' && !inRem) { if (!inQuote) { [outputString RTFSetColor:kStringColor]; [outputString appendCharacter:*srcPtr]; - } else { + } + else { [outputString appendCharacter:*srcPtr]; [outputString RTFSetColor:kDefaultColor]; } inQuote = !inQuote; - } else if (*srcPtr == ':' && !inRem && !inQuote) { + } + else if (*srcPtr == ':' && !inRem && !inQuote) { [outputString RTFSetColor:kColonColor]; [outputString appendCharacter:*srcPtr]; [outputString RTFSetColor:kDefaultColor]; - } else if (inRem && *srcPtr == '\r') { + } + else if (inRem && *srcPtr == '\r') { [outputString RTFNewPara]; - } else { + } + else { [outputString appendCharacter:*srcPtr]; } - } else { + } + else { if (inRem && *srcPtr == '\r') { [outputString appendString:@"\r\n"]; - } else { + } + else { [outputString appendCharacter:*srcPtr]; } } @@ -328,7 +336,8 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) [outputString RTFSetColor:kDefaultColor]; srcPtr++; length--; - } else if (*srcPtr == 0x5d) { + } + else if (*srcPtr == 0x5d) { /* start of REM statement, run to EOL */ [outputString RTFSetColor:kCommentColor]; [outputString appendFormat:@"%sREM ", trailingSpace ? "" : " "]; @@ -345,7 +354,8 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) NSLog(@" INT ended while in a REM statement"); break; } - } else if (*srcPtr >= 0xb0 && *srcPtr <= 0xb9) { + } + else if (*srcPtr >= 0xb0 && *srcPtr <= 0xb9) { /* start of integer constant */ srcPtr++; length--; @@ -356,7 +366,8 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) int val; val = Read16(&srcPtr, &length); [outputString appendFormat:@"%d", val]; - } else if (*srcPtr >= 0xc1 && *srcPtr <= 0xda) { + } + else if (*srcPtr >= 0xc1 && *srcPtr <= 0xda) { /* start of variable name */ while ((*srcPtr >= 0xc1 && *srcPtr <= 0xda) || (*srcPtr >= 0xb0 && *srcPtr <= 0xb9)) @@ -366,7 +377,8 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) srcPtr++; length--; } - } else if (*srcPtr < 0x80) { + } + else if (*srcPtr < 0x80) { /* found a token; try to get the whitespace right */ /* (maybe should've left whitespace on the ends of tokens that are always followed by whitespace...?) */ @@ -379,7 +391,8 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) if ((token[0] >= 0x21 && token[0] <= 0x3f) || *srcPtr < 0x12) { /* does not need leading space */ [outputString appendFormat:@"%s", token]; - } else { + } + else { /* needs leading space; combine with prev if it exists */ if (trailingSpace) [outputString appendFormat:@"%s", token]; @@ -391,7 +404,8 @@ static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) [outputString RTFSetColor:kDefaultColor]; srcPtr++; length--; - } else { + } + else { /* should not happen */ NSLog(@" INT unexpected value 0x%02x at byte %ld", *srcPtr, srcPtr - (const uint8_t *)data.bytes); diff --git a/source/frontends/mariani/browser/DiskImageBrowserWindowController.mm b/source/frontends/mariani/browser/DiskImageBrowserWindowController.mm index 9268af1a1..dea1e19cf 100644 --- a/source/frontends/mariani/browser/DiskImageBrowserWindowController.mm +++ b/source/frontends/mariani/browser/DiskImageBrowserWindowController.mm @@ -303,9 +303,11 @@ - (FSItem *)newFSItemFromA2File:(A2File *)file { uint64_t size; if (file->IsDirectory()) { size = file->GetDataLength(); - } else if (file->GetRsrcLength() >= 0) { + } + else if (file->GetRsrcLength() >= 0) { size = file->GetDataLength() + file->GetRsrcLength(); - } else { + } + else { size = file->GetDataLength(); } if (size > 999999999) { diff --git a/source/frontends/mariani/debugger/DebuggerWindowController.mm b/source/frontends/mariani/debugger/DebuggerWindowController.mm index 5e1554e05..f2a1a4669 100644 --- a/source/frontends/mariani/debugger/DebuggerWindowController.mm +++ b/source/frontends/mariani/debugger/DebuggerWindowController.mm @@ -307,7 +307,8 @@ - (void)refresh:(NSNumber *)type { self.toggleRunningButton.image = [NSImage imageWithSystemSymbolName:@"forward.frame" accessibilityDescription:toolTip]; self.toggleRunningButton.toolTip = toolTip; self.toggleRunningButton.state = NSControlStateValueOff; - } else { + } + else { NSString *toolTip = NSLocalizedString(@"Pause Execution", @""); self.toggleRunningButton.image = [NSImage imageWithSystemSymbolName:@"pause" accessibilityDescription:toolTip]; self.toggleRunningButton.toolTip = toolTip; diff --git a/source/frontends/mariani/debugger/DisassemblyTableViewController.mm b/source/frontends/mariani/debugger/DisassemblyTableViewController.mm index f4d37a2ce..71d99a677 100644 --- a/source/frontends/mariani/debugger/DisassemblyTableViewController.mm +++ b/source/frontends/mariani/debugger/DisassemblyTableViewController.mm @@ -262,7 +262,8 @@ - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn [NSColor colorForType:NSColorTypeBreakpoint], [NSColor colorForType:NSColorTypeBreakpointBackground] ]]; imageView = [NSImageView imageViewWithImage:[image imageWithSymbolConfiguration:config]]; - } else { + } + else { imageView = [NSImageView imageViewWithImage:image]; imageView.contentTintColor = [NSColor colorForType:NSColorTypeBreakpointBackground]; } @@ -294,7 +295,8 @@ - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn [NSColor colorForType:NSColorTypeBookmark], [NSColor colorForType:NSColorTypeBookmarkBackground] ]]; imageView = [NSImageView imageViewWithImage:[image imageWithSymbolConfiguration:config]]; - } else { + } + else { imageView = [NSImageView imageViewWithImage:image]; imageView.contentTintColor = [NSColor colorForType:NSColorTypeBookmarkBackground]; } diff --git a/source/frontends/mariani/preferences/PreferencesViewController.mm b/source/frontends/mariani/preferences/PreferencesViewController.mm index 22ae48fce..7894792ea 100644 --- a/source/frontends/mariani/preferences/PreferencesViewController.mm +++ b/source/frontends/mariani/preferences/PreferencesViewController.mm @@ -324,9 +324,11 @@ - (void)configureGameController { if ([defaults.gameController isEqualToString:GameControllerNone]) { [self.gameController selectItemAtIndex:0]; - } else if ([defaults.gameController isEqualToString:GameControllerNumericKeypad]) { + } + else if ([defaults.gameController isEqualToString:GameControllerNumericKeypad]) { [self.gameController selectItem:self.gameController.lastItem]; - } else { + } + else { [self.gameController selectItemWithTitle:defaults.gameController]; } @@ -652,7 +654,8 @@ - (IBAction)gameControllerAction:(id)sender { UserDefaults *defaults = [UserDefaults sharedInstance]; if (self.gameController.selectedItem == self.gameController.itemArray[0]) { defaults.gameController = GameControllerNone; - } else if (self.gameController.selectedItem == self.gameController.lastItem) { + } + else if (self.gameController.selectedItem == self.gameController.lastItem) { defaults.gameController = GameControllerNumericKeypad; } else {