Commit 32ac53f3 authored by George Nachman's avatar George Nachman

Fix various analyzer issues and warnings. Enable selecting python version when...

Fix various analyzer issues and warnings. Enable selecting python version when creating a new full environment script
parent c295531e
......@@ -48,7 +48,7 @@
<textField verticalHuggingPriority="750" id="rwM-La-RBW">
<rect key="frame" x="18" y="36" width="62" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="XX:XX:XX MM" id="vJo-pj-XsO">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="Time" id="vJo-pj-XsO">
<font key="font" metaFont="miniSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
......
......@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) NSURL *url;
@property (nonatomic, readonly) BOOL verified;
@property (nonatomic, readonly) SIGArchiveReader *reader;
@property (nonatomic, readonly, nullable) SIGArchiveReader *reader;
- (instancetype)initWithURL:(NSURL *)url NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
......
......@@ -260,7 +260,9 @@ static NSInteger SIGArchiveVerifiedLowestSupportedVersion = 1;
return NO;
}
if (certificateDatas.count == 0) {
*error = [SIGError errorWithCode:SIGErrorCodeNoCertificate];
if (error) {
*error = [SIGError errorWithCode:SIGErrorCodeNoCertificate];
}
}
NSMutableArray<SIGCertificate *> *certs = [NSMutableArray array];
......
......@@ -54,7 +54,7 @@
}
_publicKey = [[SIGKey alloc] initWithSecKey:key];
CFRelease(key);
return _publicKey;
}
......@@ -172,6 +172,7 @@
return nil;
}
SecCertificateRef secCertificate = [SIGCertificate secCertificateWithName:issuerName];
CFRelease(issuerName);
if (secCertificate == NULL) {
return nil;
}
......
......@@ -72,7 +72,7 @@
CFErrorRef secError = NULL;
const BOOL trusted = SecTrustEvaluateWithError(self->_secTrust,
&secError);
if (secError) {
if (secError && error) {
*error = [SIGError errorWrapping:(__bridge NSError *)secError
code:SIGErrorCodeTrust
detail:@"Failed to evaluate certificate chain"];
......
......@@ -483,7 +483,7 @@
return textAttributedString;
}
NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init];
NSTextAttachment *textAttachment = [[[NSTextAttachment alloc] init] autorelease];
textAttachment.image = graphic;
textAttachment.bounds = NSMakeRect(0,
- (graphic.size.height - font.capHeight) / 2.0,
......
#warning TODO: DVR should show historic status bar info
// -*- mode:objc -*-
/*
** DVR.m
......
......@@ -1267,7 +1267,7 @@ static int Search(NSString* needle,
// position.
int limit = raw_line_length;
int tempResultLength;
int tempResultLength = 0;
int tempPosition;
NSString* haystack;
......
......@@ -219,7 +219,7 @@ NS_ASSUME_NONNULL_BEGIN
tState.imageSize.height * scale);
const CGSize viewportSize = CGSizeMake(tState.configuration.viewportSize.x,
tState.configuration.viewportSize.y);
NSEdgeInsets insets = tState.edgeInsets;
NSEdgeInsets insets;
CGFloat vmargin;
if (@available(macOS 10.14, *)) {
vmargin = 0;
......@@ -246,7 +246,7 @@ NS_ASSUME_NONNULL_BEGIN
viewHeight);
// pixel coordinates
CGRect textureFrame = CGRectMake(0, 0, nativeTextureSize.width, nativeTextureSize.height);
CGRect textureFrame;
const CGRect frame = tState.frame;
const CGSize containerSize = CGSizeMake(tState.containerSize.width * scale,
tState.containerSize.height * scale);
......
......@@ -100,7 +100,7 @@ namespace iTerm2 {
ITOwnershipLog(@"OWNERSHIP: retain %p as owner of %p with refcount %d", owner, this, (int)_owners[owner]);
}
void release(TexturePageOwner *owner) {
bool release(TexturePageOwner *owner) {
ITOwnershipLog(@"OWNERSHIP: release %p as owner of %p. New refcount for this owner will be %d", owner, this, (int)_owners[owner]-1);
ITExtraDebugAssert(_owners[owner] > 0);
......@@ -120,9 +120,10 @@ namespace iTerm2 {
if (_owners.empty()) {
ITOwnershipLog(@"OWNERSHIP: DELETE %p", this);
delete this;
return;
return true;
}
}
return false;
}
void record_use() {
......
......@@ -128,7 +128,10 @@ namespace iTerm2 {
_openPage = NULL;
}
_allPages.erase(pageToPrune);
pageToPrune->release(this);
bool freed = pageToPrune->release(this);
#if DEBUG
assert(!freed);
#endif
ITExtraDebugAssert(pageToPrune->get_retain_count() > 0);
// Make all glyph entries remove their references to the page. Remove our
......@@ -142,7 +145,10 @@ namespace iTerm2 {
for (int j = 0; j < count; j++) {
if (owner->texture_page_owner_is_glyph_entry()) {
GlyphEntry *glyph_entry = static_cast<GlyphEntry *>(owner);
pageToPrune->release(glyph_entry);
#if DEBUG
assert(!freed);
#endif
freed = pageToPrune->release(glyph_entry);
auto it = _pages.find(glyph_entry->_key);
if (it != _pages.end()) {
// Remove from _pages as soon as the first part is found for this glyph
......
......@@ -379,14 +379,24 @@ CGFloat PerceivedBrightness(CGFloat r, CGFloat g, CGFloat b) {
view.appearance = appearance;
NSImage *image = [view snapshot];
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithData:[image TIFFRepresentation]];
NSBitmapImageRep *imageRep = [[[NSBitmapImageRep alloc] initWithData:[image TIFFRepresentation]] autorelease];
result = [imageRep colorAtX:0 y:0];
dict[self] = result;
return result;
}
#warning TODO: This should use the theme
if ([self isEqual:[NSColor labelColor]]) {
switch ([iTermPreferences intForKey:kPreferenceKeyTabStyle]) {
case TAB_STYLE_DARK:
case TAB_STYLE_DARK_HIGH_CONTRAST:
return [NSColor whiteColor];
case TAB_STYLE_LIGHT:
case TAB_STYLE_LIGHT_HIGH_CONTRAST:
return self;
}
}
return self;
}
......
......@@ -86,7 +86,9 @@
if (errorMessage.length) {
NSString *errorString = [errorMessage stringWithEncoding:NSUTF8StringEncoding];
if (errorString) {
*error = [NSError errorWithDomain:@"com.googlecode.iterm2" code:1 userInfo:@{ @"errorMessage": errorString }];
if (error) {
*error = [NSError errorWithDomain:@"com.googlecode.iterm2" code:1 userInfo:@{ @"errorMessage": errorString }];
}
} else {
XLog(@"Error %s", errorMessage.bytes);
}
......
......@@ -262,7 +262,7 @@ NSString * const DirectoryLocationDomain = @"DirectoryLocationDomain";
} else {
path = networkPath;
}
if ([filename hasPrefix:networkPath]) {
if ([filename hasPrefix:path]) {
DLog(@"Filename %@ has prefix of ignored path %@", filename, networkPath);
return YES;
}
......
......@@ -330,7 +330,7 @@
NSPoint corner = NSMakePoint(-size.width / 2., -size.height / 2.);
[self drawAtPoint:corner fromRect:rect operation:NSCompositingOperationCopy fraction:1.0];
[image unlockFocus];
return image;
return [image autorelease];
}
- (NSImage *)it_imageOfSize:(NSSize)newSize {
......
......@@ -110,6 +110,7 @@
if (!name) {
[command setScriptErrorNumber:1];
[command setScriptErrorString:@"No name given"];
return nil;
}
id value = [self.variablesScope valueForVariableName:name];
......
......@@ -203,7 +203,6 @@ typedef enum {
// Returns the size of the tab in rows x cols. Initial tmux client size.
- (VT100GridSize)sessionTmuxSizeWithProfile:(Profile *)profile;
- (void)forceTmuxDetach;
// Whether metal is allowed has changed
- (void)sessionUpdateMetalAllowed;
......@@ -728,6 +727,7 @@ typedef enum {
- (NSDictionary *)arrangementWithContents:(BOOL)includeContents;
- (void)toggleTmuxZoom;
- (void)forceTmuxDetach;
// Kill the running command (if possible), print a banner, and rerun the profile's command.
- (void)restartSession;
......
......@@ -1150,7 +1150,7 @@ ITERM_WEAKLY_REFERENCEABLE
aSession.textview.highlightCursorLine = [arrangement[SESSION_ARRANGEMENT_CURSOR_GUIDE] boolValue];
}
aSession->_lastMark = [aSession.screen.lastMark retain];
aSession.lastRemoteHost = [aSession.screen.lastRemoteHost retain];
aSession.lastRemoteHost = aSession.screen.lastRemoteHost;
if (arrangement[SESSION_ARRANGEMENT_LAST_DIRECTORY]) {
[aSession->_lastDirectory autorelease];
aSession->_lastDirectory = [arrangement[SESSION_ARRANGEMENT_LAST_DIRECTORY] copy];
......@@ -1454,7 +1454,7 @@ ITERM_WEAKLY_REFERENCEABLE
oldCWD:oldCWD
forceUseOldCWD:contents != nil && oldCWD.length
command:commandArg
isUTF8:@(aSession.isUTF8)
isUTF8:isUTF8Arg
substitutions:substitutionsArg
windowController:(PseudoTerminal *)aSession.delegate.realParentWindow
completion:completion];
......@@ -5211,7 +5211,6 @@ ITERM_WEAKLY_REFERENCEABLE
}
return NO;
}
#warning TODO: This is wrong. Is it called too soon when closing the dropdown find panel?
if (_view.isDropDownSearchVisible) {
if (reason) {
*reason = iTermMetalUnavailableReasonFindPanel;
......@@ -10825,14 +10824,11 @@ ITERM_WEAKLY_REFERENCEABLE
NSArray<NSString *> *actions;
NSInteger thisProfile = 0;
NSInteger allProfiles = -1;
NSInteger stopAsking = -1;
if ([[[ProfileModel sharedInstance] bookmarks] count] == 1) {
actions = @[ @"Yes", @"Stop Asking" ];
stopAsking = 1;
} else {
actions = @[ @"Change This Profile", @"Change All Profiles", @"Stop Asking" ];
allProfiles = 1;
stopAsking = 2;
}
Profile *profileToChange = [[ProfileModel sharedInstance] bookmarkWithGuid:self.profile[KEY_GUID]];
......
......@@ -316,7 +316,7 @@ static int iTermForkToRunJobInServer(iTermForkState *forkState,
// This closes serverConnectionFd and deadMansPipe[1] in the parent process but not the child.
iTermFileDescriptorServerLog("Calling MyForkPty");
forkState->numFileDescriptorsToPreserve = kNumFileDescriptorsToDup;
int fd;
int fd = -1;
forkState->pid = MyForkPty(&fd, ttyState, serverConnectionFd, forkState->deadMansPipe[1]);
return fd;
}
......
......@@ -158,10 +158,6 @@ static const int kDragThreshold = 3;
// blinking cursor
NSTimeInterval _timeOfLastBlink;
// Previous tracking rect to avoid expensive calls to addTrackingRect.
#warning This is not used. Did I break tracking?
NSRect _trackingRect;
// Helps with "selection scroll"
iTermSelectionScrollHelper *_selectionScrollHelper;
......@@ -6586,8 +6582,8 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
#pragma mark - iTermSelectionDelegate
#warning TODO This should be a no-op if it changed only because of scrollback overflow
- (void)selectionDidChange:(iTermSelection *)selection {
NSLog(@"SEelction changed to %@", selection);
[_delegate refresh];
if (!_selection.live && selection.hasSelection) {
const NSInteger MAX_SELECTION_SIZE = 10 * 1000 * 1000;
......
......@@ -218,9 +218,9 @@ static NSInteger kNonAsciiFontButtonTag = 1;
type:kPreferenceInfoTypeCheckbox];
info.observer = ^{ [weakSelf updateWarnings]; };
info = [self defineControl:_powerline
key:KEY_POWERLINE
type:kPreferenceInfoTypeCheckbox];
[self defineControl:_powerline
key:KEY_POWERLINE
type:kPreferenceInfoTypeCheckbox];
[self updateFontsDescriptions];
[self updateNonAsciiFontViewVisibility];
......
......@@ -86,9 +86,9 @@
strongSelf->_useBlur.enabled = haveTransparency;
};
info = [self defineControl:_initialUseTransparency
key:KEY_INITIAL_USE_TRANSPARENCY
type:kPreferenceInfoTypeCheckbox];
[self defineControl:_initialUseTransparency
key:KEY_INITIAL_USE_TRANSPARENCY
type:kPreferenceInfoTypeCheckbox];
info = [self defineControl:_useBlur
key:KEY_BLUR
......
......@@ -1512,8 +1512,7 @@ ITERM_WEAKLY_REFERENCEABLE
}
}
NSString *message;
NSArray *sortedNames = [names sortedArrayUsingSelector:@selector(compare:)];
sortedNames = [names countedInstancesStrings];
NSArray *sortedNames = [names countedInstancesStrings];
if ([sortedNames count] == 1) {
message = [NSString stringWithFormat:@"%@ is running %@.", identifier, [sortedNames objectAtIndex:0]];
} else if ([sortedNames count] > 1 && [sortedNames count] <= 10) {
......@@ -8846,11 +8845,6 @@ ITERM_WEAKLY_REFERENCEABLE
} else {
objectType = iTermTabObject;
}
NSString *commandForSubs = command;
if (!command) {
commandForSubs = [ITAddressBookMgr bookmarkCommand:profile
forObjectType:objectType];
}
if (command) {
profile = [[profile
dictionaryBySettingObject:@"Yes" forKey:KEY_CUSTOM_COMMAND]
......
......@@ -5527,10 +5527,6 @@ static void SwapInt(int *a, int *b) {
}
- (iTermColorMap *)temporaryDoubleBufferedGridColorMapCopy {
return [[delegate_ screenColorMap] copy];
}
- (void)temporaryDoubleBufferedGridDidExpire {
[currentGrid_ setAllDirty:YES];
// Force the screen to redraw right away. Some users reported lag and this seems to fix it.
......
......@@ -585,9 +585,11 @@ static id sAPIHelperInstance;
[userinfo dictionaryBySettingObject:connectionKey
forKey:iTermAPIHelperFunctionCallErrorUserInfoKeyConnection];
}
*error = [NSError errorWithDomain:@"com.iterm2.api"
code:2
userInfo:userinfo];
if (error) {
*error = [NSError errorWithDomain:@"com.iterm2.api"
code:2
userInfo:userinfo];
}
return nil;
}
......
......@@ -161,7 +161,7 @@
task.launchPath = shell;
task.arguments = [self argumentsToRunScript:filename withVirtualEnv:virtualenv pythonVersion:pythonVersion];
NSString *cookie = [[iTermWebSocketCookieJar sharedInstance] newCookie];
NSString *cookie = [[iTermWebSocketCookieJar sharedInstance] randomStringForCooke];
task.environment = [self environmentFromEnvironment:task.environment shell:shell cookie:cookie key:key];
NSPipe *pipe = [[NSPipe alloc] init];
......
......@@ -136,8 +136,6 @@ static NSString *const kHotkeyWindowRestorableState = @"kHotkeyWindowRestorableS
static NSString *const kHotkeyWindowsRestorableStates = @"kHotkeyWindowsRestorableState"; // deprecated
static NSString *const iTermBuriedSessionState = @"iTermBuriedSessionState";
static NSString *const kHaveWarnedAboutIncompatibleSoftware = @"NoSyncHaveWarnedAboutIncompatibleSoftware"; // deprecated
static NSString *const kRestoreDefaultWindowArrangementShortcut = @"R";
NSString *const iTermApplicationWillTerminate = @"iTermApplicationWillTerminate";
......@@ -2023,7 +2021,7 @@ static BOOL hasBecomeActive = NO;
NSString *command = [[[[[iTermPythonRuntimeDownloader sharedInstance] pathToStandardPyenvPythonWithPythonVersion:nil] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"apython"] stringWithEscapedShellCharactersIncludingNewlines:YES];
NSURL *bannerURL = [[NSBundle mainBundle] URLForResource:@"repl_banner" withExtension:@"txt"];
command = [command stringByAppendingFormat:@" --banner=\"`cat %@`\"", [bannerURL.path stringWithEscapedShellCharactersIncludingNewlines:YES]];
NSString *cookie = [[iTermWebSocketCookieJar sharedInstance] newCookie];
NSString *cookie = [[iTermWebSocketCookieJar sharedInstance] randomStringForCooke];
NSDictionary *environment = @{ @"ITERM2_COOKIE": cookie };
[[iTermController sharedInstance] openSingleUseWindowWithCommand:command
inject:nil
......
......@@ -12,7 +12,6 @@
@class iTermBacktraceFrame;
NSString *iTermBacktraceForThread(pthread_t threadId);
int GetCallstack(pthread_t threadId, void **buffer, int size);
NSArray<iTermBacktraceFrame *> *GetBacktraceFrames(pthread_t threadId);
......
......@@ -210,12 +210,6 @@ NSString *DumpCallstack(void*const* buffer, int size) {
}
extern "C" {
NSString *iTermBacktraceForThread(pthread_t threadId) {
void *buffer[1024];
int n = InternalGetCallstack(threadId, buffer, 1024);
return DumpCallstack(buffer, n);
}
int GetCallstack(pthread_t threadId, void **buffer, int size) {
return InternalGetCallstack(threadId, buffer, size);
}
......
......@@ -1138,7 +1138,7 @@ static iTermController *gSharedInstance;
} else if ([urlType compare:@"telnet" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
return [self profileByModifyingProfile:prototype toTelnetTo:urlRep];
} else if (!aDict) {
return [prototype copy];
return [[prototype copy] autorelease];
} else {
return prototype;
}
......
......@@ -244,7 +244,7 @@
[self buildCacheForWidth:width];
[self updateCacheIfNeeded];
__block int r;
__block int r = 0;
const NSInteger result = [self internalIndexOfBlockContainingLineNumber:lineNumber width:width remainder:&r];
if (remainderPtr) {
*remainderPtr = r;
......
......@@ -55,7 +55,6 @@
_menu = menu;
menu.delegate = self;
NSArray *elementsToRelease = elements;
[self clickThroughElements:elements completion:^{
if (self->_menu.delegate == self) {
DLog(@"Done clicking through elements.");
......@@ -65,10 +64,6 @@
} else {
DLog(@"Delegate is no longer self");
}
for (NSInteger i = 0; i < elementsToRelease.count; i++) {
AXUIElementRef element = (__bridge AXUIElementRef)(elements[i]);
CFRelease(element);
}
}];
}
......@@ -160,7 +155,6 @@
NSInteger i = 0;
while (element != nil && i < path.count) {
element = [self childOfMenu:element withName:path[i]];
#warning TODO: I appear to be over-releasing these elements. See the analyzer.
[result addObject:(__bridge id _Nonnull)(element)];
i++;
if (i < path.count) {
......@@ -198,8 +192,8 @@
}
CFArrayRef children = nil;
// Despite what the name would suggest, the children array and its contents don't seen to need
// too be released by us.
// Despite what the name would suggest, the children array and its contents don't seem to need
// to be released by us.
error = AXUIElementCopyAttributeValues(menuBar,
kAXChildrenAttribute,
0,
......
......@@ -489,11 +489,6 @@ NSString *const kPreferenceDidChangeFromOtherPanelKeyUserInfoKey = @"key";
assert([info.control isKindOfClass:[NSTextField class]]);
NSTextField *textField = (NSTextField *)info.control;
int iv = [self intForString:[textField stringValue] inRange:info.range];
unichar lastChar = '0';
int numChars = [[textField stringValue] length];
if (numChars) {
lastChar = [[textField stringValue] characterAtIndex:numChars - 1];
}
if (iv != [textField separatorTolerantIntValue]) {
// If the int values don't match up or there are terminal non-number
// chars, then update the value.
......@@ -505,12 +500,7 @@ NSString *const kPreferenceDidChangeFromOtherPanelKeyUserInfoKey = @"key";
assert([info.control isKindOfClass:[NSTextField class]]);
NSTextField *textField = (NSTextField *)info.control;
NSUInteger iv = [self unsignedIntegerForString:[textField stringValue] inRange:info.range];
unichar lastChar = '0';
int numChars = [[textField stringValue] length];
if (numChars) {
lastChar = [[textField stringValue] characterAtIndex:numChars - 1];
}
if (iv != [textField separatorTolerantUnsignedIntegerValue] || (lastChar < '0' || lastChar > '9')) {
if (iv != [textField separatorTolerantUnsignedIntegerValue]) {
[textField setStringValue:[NSString stringWithFormat:@"%lu", iv]];
}
}
......
......@@ -46,7 +46,7 @@ static NSString *const kInitialDirectoryKey = @"Initial Directory";
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
(__bridge CFStringRef)extension,
NULL);
NSString *lowercaseDescription = (__bridge NSString *)UTTypeCopyDescription(fileUTI);
NSString *lowercaseDescription = (__bridge_transfer NSString *)UTTypeCopyDescription(fileUTI);
CFRelease(fileUTI);
......
......@@ -81,8 +81,7 @@
+ (void)writeMetadataTo:(NSURL *)destinationURL
sourceURL:(NSURL *)sourceURL {
NSString *autoLaunchPath = [[NSFileManager defaultManager] autolaunchScriptPath];
NSDictionary *metadata = @{};
metadata = @{ @"AutoLaunch": @([sourceURL.path hasPrefix:autoLaunchPath]) };
NSDictionary *metadata = @{ @"AutoLaunch": @([sourceURL.path hasPrefix:autoLaunchPath]) };
[[NSJSONSerialization it_jsonStringForObject:metadata] writeToURL:[destinationURL URLByAppendingPathComponent:@"metadata.json"]
atomically:NO
encoding:NSUTF8StringEncoding
......@@ -150,7 +149,7 @@
}
SIGArchiveBuilder *builder = [[SIGArchiveBuilder alloc] initWithPayloadFileURL:payloadURL identity:identity];
ok = [builder writeToURL:url error:&error];
[builder writeToURL:url error:&error];
[[NSFileManager defaultManager] removeItemAtURL:payloadURL error:nil];
completion(error);
}
......
......@@ -111,13 +111,17 @@
iTermParsedExpression *expression = [[iTermFunctionCallParser callParser] parse:invocation
scope:permissiveScope];
if (expression.string || expression.number) {
*error = [NSError errorWithDomain:@"com.iterm2.call"
code:3
userInfo:@{ NSLocalizedDescriptionKey: @"Expected function call, not a literal" }];
if (error) {
*error = [NSError errorWithDomain:@"com.iterm2.call"
code:3
userInfo:@{ NSLocalizedDescriptionKey: @"Expected function call, not a literal" }];
}
return nil;
}
if (expression.error) {
*error = expression.error;
if (error) {
*error = expression.error;
}
return nil;
}
return expression.functionCall.signature;
......@@ -353,7 +357,6 @@
return;
}
if (synchronous) {
#warning TODO
// This is useful because it causes the scope to be called for all depended-upon
// variables even if the function can't be executed. This makes it possible for
// the session name controller to build up its set of dependencies.
......
This diff is collapsed.
......@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
serverConnection:(iTermFileDescriptorServerConnection * _Nullable)serverConnection
urlString:(nullable NSString *)urlString
allowURLSubs:(BOOL)allowURLSubs
environment:(NSDictionary *)environment
environment:(nullable NSDictionary *)environment
oldCWD:(nullable NSString *)oldCWD
forceUseOldCWD:(BOOL)forceUseOldCWD // Change custom directory setting to make it use the passed-in oLDCWD
command:(nullable NSString *)command // Overrides profile's command if nonnil
......
......@@ -44,11 +44,11 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Private
// Returns nil if the user pressed cancel, otherwise returns a dictionary that's a supeset of |substitutions|.
- (NSDictionary *)substitutionsForCommand:(NSString *)command
sessionName:(NSString *)name
baseSubstitutions:(NSDictionary *)substitutions
canPrompt:(BOOL)canPrompt
window:(NSWindow *)window {
- (nullable NSDictionary *)substitutionsForCommand:(NSString *)command
sessionName:(NSString *)name
baseSubstitutions:(NSDictionary *)substitutions
canPrompt:(BOOL)canPrompt
window:(NSWindow *)window {
NSSet *cmdVars = [command doubleDollarVariables];
NSSet *nameVars = [name doubleDollarVariables];
NSMutableSet *allVars = [cmdVars mutableCopy];
......@@ -101,7 +101,7 @@ NS_ASSUME_NONNULL_BEGIN
serverConnection:(iTermFileDescriptorServerConnection * _Nullable)serverConnection
urlString:(nullable NSString *)urlString
allowURLSubs:(BOOL)allowURLSubs
environment:(NSDictionary *)environment
environment:(nullable NSDictionary *)environment
oldCWD:(nullable NSString *)oldCWD
forceUseOldCWD:(BOOL)forceUseOldCWD
command:(nullable NSString *)command
......@@ -239,7 +239,7 @@ NS_ASSUME_NONNULL_BEGIN
}
}
- (NSString *)promptForParameter:(NSString *)name promptingDisabled:(BOOL)promptingDisabled inWindow:(nonnull NSWindow *)window {
- (nullable NSString *)promptForParameter:(NSString *)name promptingDisabled:(BOOL)promptingDisabled inWindow:(nonnull NSWindow *)window {
if (promptingDisabled) {
return @"";
}
......
......@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface iTermSessionPicker : NSObject
- (PTYSession *)pickSession;
- (nullable PTYSession *)pickSession;
@end
......
......@@ -22,7 +22,7 @@ extern const double iTermStatusBarBaseComponentDefaultPriority;
@interface iTermStatusBarBaseComponent : NSObject<iTermStatusBarComponent, iTermWebViewDelegate>
@property (nonatomic, readonly) iTermVariableScope *scope;
@property (nonatomic, readonly, nullable) iTermVariableScope *scope;
@property (nonatomic, readonly) NSDictionary<iTermStatusBarComponentConfigurationKey, id> *configuration;
@property (nonatomic, readonly) NSColor *statusBarBackgroundColor;
@property (nonatomic, readonly) NSColor *defaultTextColor;
......
......@@ -274,7 +274,7 @@ const double iTermStatusBarBaseComponentDefaultPriority = 5;
return MAX(0.01, value.doubleValue);
}
- (NSViewController<iTermFindViewController> *)statusBarComponentSearchViewController {
- (nullable NSViewController<iTermFindViewController> *)statusBarComponentSearchViewController {
return nil;
}
......
......@@ -32,7 +32,7 @@ NSString *const iTermStatusBarComponentKnobMinimumWidthKey = @"_minimumWidth";
return self;
}
- (NSView *)inputView {
- (nullable NSView *)inputView {
[self doesNotRecognizeSelector:_cmd];
return nil;
}
......
......@@ -126,10 +126,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)layoutSubviews {
CGFloat width = self.frame.size.width;
CGFloat x = 0;
if (self.component.statusBarComponentIcon) {
width -= iTermStatusBarViewControllerIconWidth;
x += iTermStatusBarViewControllerIconWidth;
}
[self.component statusBarComponentSizeView:_view toFitWidth:width];
......
......@@ -387,7 +387,7 @@ static NSString *const iTermStatusBarRPCRegistrationRequestKey = @"registration
return [[[[iTermApplication sharedApplication] delegate] scriptsMenuController] couldLaunchScriptWithAbsolutePath:fullPath];
}
- (NSString *)fullPathOfScript {
- (nullable NSString *)fullPathOfScript {
if (!_savedRegistrationRequest.latestStatusBarRequest.statusBarComponentAttributes.uniqueIdentifier) {
return nil;
}
......
......@@ -80,7 +80,7 @@ NSString *iTermStatusBarSearchComponentIsTemporaryKey = @"search: temporary";
}
}
- (NSViewController<iTermFindViewController> *)statusBarComponentSearchViewController {
- (nullable NSViewController<iTermFindViewController> *)statusBarComponentSearchViewController {