Permalink
Browse files

Fixed a few bugs and refactored privileged helper so that file descri…

…ptors are returned to app.
  • Loading branch information...
1 parent 1c385e9 commit bae8ced0ad4e61a415e6fcb241be453404f29307 Chris Suter committed Dec 22, 2011
@@ -192,6 +192,7 @@
D0D8C2B012A3BE4300960FC4 /* ChooseStringEncodingDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0D8C2AF12A3BE4300960FC4 /* ChooseStringEncodingDialog.xib */; };
D0D8C2BC12A3C10100960FC4 /* ChooseStringEncodingWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D8C2BB12A3C10100960FC4 /* ChooseStringEncodingWindowController.m */; };
D0D8C45812A3EF3900960FC4 /* ProcessList.m in Sources */ = {isa = PBXBuildFile; fileRef = D0D8C45712A3EF3900960FC4 /* ProcessList.m */; };
+ FB1E99AA14A301CD002136A3 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D05984CB1032C6D900059E72 /* Security.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -318,9 +319,6 @@
D01E7C3B0CDC69E500943F9E /* HFTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HFTypes.h; path = sources/HFTypes.h; sourceTree = "<group>"; };
D01EF15213B2A0D300CC9283 /* TextDividerRepresenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextDividerRepresenter.h; path = app/sources/TextDividerRepresenter.h; sourceTree = "<group>"; };
D01EF15313B2A0D300CC9283 /* TextDividerRepresenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TextDividerRepresenter.m; path = app/sources/TextDividerRepresenter.m; sourceTree = "<group>"; };
- D0222576146F612E00646C27 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
- D0222578146F612E00646C27 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
- D022257A146F612E00646C27 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
D024AFB20E349A7B00F39EBB /* hex_icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = hex_icon.icns; path = app/resources/hex_icon.icns; sourceTree = "<group>"; };
D026C7AE0CDD50ED0082279E /* HFRepresenterTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HFRepresenterTextView.h; path = sources/HFRepresenterTextView.h; sourceTree = "<group>"; };
D026C7AF0CDD50ED0082279E /* HFRepresenterTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HFRepresenterTextView.m; path = sources/HFRepresenterTextView.m; sourceTree = "<group>"; };
@@ -358,7 +356,6 @@
D04A6C15100EB02400704963 /* HFModalProgress.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = HFModalProgress.xib; path = resources/HFModalProgress.xib; sourceTree = "<group>"; };
D04C78250DC47ECF00A76FF2 /* HFTextSelectionPulseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HFTextSelectionPulseView.h; path = sources/HFTextSelectionPulseView.h; sourceTree = "<group>"; };
D04C78260DC47ECF00A76FF2 /* HFTextSelectionPulseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HFTextSelectionPulseView.m; path = sources/HFTextSelectionPulseView.m; sourceTree = "<group>"; };
- D04D8FCA102396FC0013A2A1 /* HFPrivilegedHelperConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HFPrivilegedHelperConnection.h; path = sources/HFPrivilegedHelperConnection.h; sourceTree = "<group>"; };
D04D8FCB102396FC0013A2A1 /* HFPrivilegedHelperConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HFPrivilegedHelperConnection.m; path = sources/HFPrivilegedHelperConnection.m; sourceTree = "<group>"; };
D04D90521023AAEE0013A2A1 /* HFHelperProcessSharedCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HFHelperProcessSharedCode.h; path = sources/HFHelperProcessSharedCode.h; sourceTree = "<group>"; };
D05984CB1032C6D900059E72 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
@@ -450,7 +447,6 @@
D0B4229F0FF845F800DF27E5 /* HFTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HFTextView.h; path = sources/HFTextView.h; sourceTree = "<group>"; };
D0B422A00FF845F800DF27E5 /* HFTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HFTextView.m; path = sources/HFTextView.m; sourceTree = "<group>"; };
D0B47FEE1272427B0095120E /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/DiffComputationBanner.xib; sourceTree = "<group>"; };
- D0B7E2890D5AF0DF007874ED /* InterfaceBuilderKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InterfaceBuilderKit.framework; path = Library/Frameworks/InterfaceBuilderKit.framework; sourceTree = DEVELOPER_DIR; };
D0B7E3380D5C50EA007874ED /* HFByteArray_FindReplace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HFByteArray_FindReplace.m; path = sources/HFByteArray_FindReplace.m; sourceTree = "<group>"; };
D0BAA833120A7DE800D8FB51 /* HFIndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HFIndexSet.h; path = sources/HFIndexSet.h; sourceTree = "<group>"; };
D0BAA834120A7DE800D8FB51 /* HFIndexSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HFIndexSet.m; path = sources/HFIndexSet.m; sourceTree = "<group>"; };
@@ -482,6 +478,7 @@
D0D8C2BB12A3C10100960FC4 /* ChooseStringEncodingWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ChooseStringEncodingWindowController.m; path = app/sources/ChooseStringEncodingWindowController.m; sourceTree = "<group>"; };
D0D8C45612A3EF3900960FC4 /* ProcessList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProcessList.h; path = app/sources/ProcessList.h; sourceTree = "<group>"; };
D0D8C45712A3EF3900960FC4 /* ProcessList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProcessList.m; path = app/sources/ProcessList.m; sourceTree = "<group>"; };
+ FBEA8E7F14A2C10B00C27288 /* fileport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fileport.h; path = helper_subprocess/fileport.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -516,6 +513,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ FB1E99AA14A301CD002136A3 /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -529,25 +527,6 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
- isa = PBXGroup;
- children = (
- D0B7E2890D5AF0DF007874ED /* InterfaceBuilderKit.framework */,
- 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
- );
- name = "Linked Frameworks";
- sourceTree = "<group>";
- };
- 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
- isa = PBXGroup;
- children = (
- 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
- 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
- D022257A146F612E00646C27 /* CoreData.framework */,
- );
- name = "Other Frameworks";
- sourceTree = "<group>";
- };
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
@@ -572,8 +551,11 @@
D01D1D6C1489D1F6008212BB /* Documentation Scripts */,
D075E20F1481ACFF0010D9AE /* Configurations + Scripts */,
);
+ indentWidth = 4;
name = HexFiend_2;
sourceTree = "<group>";
+ tabWidth = 4;
+ usesTabs = 0;
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
@@ -602,10 +584,9 @@
children = (
D0D4BE84146F43A1001B0A71 /* ServiceManagement.framework */,
D05984CB1032C6D900059E72 /* Security.framework */,
- 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
- D0222576146F612E00646C27 /* SenTestingKit.framework */,
- D0222578146F612E00646C27 /* Cocoa.framework */,
- 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -773,14 +754,15 @@
D047E4431022DF6F00EF307B /* FortunateSonIPCTypes.h */,
D047E48B1022E09300EF307B /* main.cpp */,
D0621CAC102ED50D00DAEB4D /* FortunateSonServerImpl.cpp */,
+ FBEA8E7F14A2C10B00C27288 /* fileport.h */,
);
name = PrivilegedHelper;
sourceTree = "<group>";
+ tabWidth = 4;
};
D047E5001022E33300EF307B /* PrivilegedHelper */ = {
isa = PBXGroup;
children = (
- D04D8FCA102396FC0013A2A1 /* HFPrivilegedHelperConnection.h */,
D04D8FCB102396FC0013A2A1 /* HFPrivilegedHelperConnection.m */,
D04D90521023AAEE0013A2A1 /* HFHelperProcessSharedCode.h */,
);
@@ -60,11 +60,11 @@
<CommandLineArguments>
<CommandLineArgument
argument = "/Users/peter/Documents/first.data"
- isEnabled = "YES">
+ isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "/Users/peter/Documents/second.data"
- isEnabled = "YES">
+ isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-HFDebugMenu"
@@ -96,6 +96,11 @@
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
+ <AdditionalOption
+ key = "NSZombieEnabled"
+ value = "YES"
+ isEnabled = "YES">
+ </AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
@@ -14,6 +14,8 @@
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
+#include <xpc/connection.h>
+#include <syslog.h>
@implementation AppDelegate
@@ -37,7 +39,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)note {
[extendForwardsItem setKeyEquivalentModifierMask:[extendForwardsItem keyEquivalentModifierMask] | NSShiftKeyMask];
[extendBackwardsItem setKeyEquivalentModifierMask:[extendBackwardsItem keyEquivalentModifierMask] | NSShiftKeyMask];
[extendForwardsItem setKeyEquivalent:@"]"];
- [extendBackwardsItem setKeyEquivalent:@"["];
+ [extendBackwardsItem setKeyEquivalent:@"["];
}
static NSComparisonResult compareFontDisplayNames(NSFont *a, NSFont *b, void *unused) {
@@ -971,26 +971,20 @@ - (BOOL)writeSafelyToURL:(NSURL *)inAbsoluteURL ofType:(NSString *)inTypeName fo
[[controller byteArray] incrementChangeLockCounter];
[[saveView viewNamed:@"saveLabelField"] setStringValue:[NSString stringWithFormat:@"Saving \"%@\"", [self displayName]]];
-
- __block NSError *error = nil;
+
__block NSInteger saveResult = 0;
[saveView startOperation:^id(HFProgressTracker *tracker) {
- id result = [self threadedSaveToURL:inAbsoluteURL trackingProgress:tracker error:&error];
+ id result = [self threadedSaveToURL:inAbsoluteURL trackingProgress:tracker error:outError];
/* Retain the error so it can be autoreleased in the main thread */
- [error retain];
+ [*outError retain];
return result;
} completionHandler:^(id result) {
saveResult = [result integerValue];
- /* Autorelease now that we're in the main thread */
- if (outError) *outError = error;
- [error autorelease];
-
/* Post an event so our event loop wakes up */
[NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 context:NULL subtype:0 data1:0 data2:0] atStart:NO];
-
}];
-
+
while ([saveView operationIsRunning]) {
@autoreleasepool {
@try {
@@ -1002,7 +996,9 @@ - (BOOL)writeSafelyToURL:(NSURL *)inAbsoluteURL ofType:(NSString *)inTypeName fo
}
}
}
-
+
+ [*outError autorelease];
+
[showSaveViewAfterDelayTimer invalidate];
[showSaveViewAfterDelayTimer release];
showSaveViewAfterDelayTimer = nil;
@@ -21,17 +21,6 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
NSError *localError = nil;
NSString *path = [absoluteURL path];
HFFileReference *fileReference = [[[HFFileReference alloc] initWithPath:path error:&localError] autorelease];
- if (localError && [[localError domain] isEqualToString:NSCocoaErrorDomain] && [localError code] == NSFileReadNoPermissionError) {
- /* Try again with a privileged file reference */
-#ifndef HF_NO_PRIVILEGED_FILE_OPERATIONS
-
- localError = nil;
- BOOL canConnect = [HFPrivilegedFileReference preflightAuthenticationReturningError:&localError];
- if (canConnect) {
- fileReference = [[[HFPrivilegedFileReference alloc] initWithPath:path error:&localError] autorelease];
- }
-#endif
- }
if (fileReference == nil) {
if (outError) *outError = localError;
}
@@ -41,6 +30,11 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
[byteArray insertByteSlice:byteSlice inRange:HFRangeMake(0, 0)];
[controller setByteArray:byteArray];
result = YES;
+
+ // If the file is > 64 MB in size, default to starting in overwrite mode
+ if ([fileReference length] > 64 * 1024 * 1024)
+ [controller setInOverwriteMode:YES];
+
}
return result;
}
@@ -12,7 +12,7 @@
HFFileReference encapsulates a reference to an open file. Multiple instances of HFFileByteSlice may share an HFFileReference, so that the file only needs to be opened once.
- HFFileReference is an abstract class. You must instantiate either HFUnprivilegedFileReference or HFPrivilegedFileReference.
+ HFFileReference is an abstract class. You must instantiate HFConcreteFileReference.
All HFFileReferences use non-caching IO (F_NOCACHE is set).
*/
@@ -24,6 +24,7 @@
unsigned long long fileLength;
mode_t fileMode;
BOOL isWritable;
+ uint32_t blockSize;
}
@@ -62,20 +63,8 @@
@end
-/*! @class HFUnprivilegedFileReference
+/*! @class HFConcreteFileReference
@brief A reference to an open file that can be read (and possibly written) using normal C functions
*/
-@interface HFUnprivilegedFileReference : HFFileReference
+@interface HFConcreteFileReference : HFFileReference
@end
-
-#ifndef HF_NO_PRIVILEGED_FILE_OPERATIONS
-/*! @class HFPrivilegedFileReference
- @brief A reference to an open file that can be read (and possibly written) using our privileged helper process
- */
-@interface HFPrivilegedFileReference : HFFileReference
-
-/*! Attempts to authenticate, returning an error on failure. */
-+ (BOOL)preflightAuthenticationReturningError:(NSError **)error;
-
-@end
-#endif
Oops, something went wrong.

0 comments on commit bae8ced

Please sign in to comment.