Skip to content

Commit

Permalink
consistent formatting of 'else'
Browse files Browse the repository at this point in the history
  • Loading branch information
sh95014 committed Dec 20, 2023
1 parent 9e98b39 commit 77aa4b5
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 24 deletions.
3 changes: 2 additions & 1 deletion source/frontends/mariani/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
3 changes: 2 additions & 1 deletion source/frontends/mariani/UserDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
42 changes: 28 additions & 14 deletions source/frontends/mariani/browser/DataFormatBASIC.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
}
}
Expand Down Expand Up @@ -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 ? "" : " "];
Expand All @@ -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--;
Expand All @@ -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))
Expand All @@ -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...?) */
Expand All @@ -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];
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 77aa4b5

Please sign in to comment.