Skip to content
Browse files

make EncodingManager correctly map encodings to tags, prevent changin…

…g encodings of 7-bit ASCII files; stop archiving contentsWere7Bit property as scrolledProportion in NoteObject; allow -[NoteObject noteFilePath] to generate the FSRef if necessary; when changing the file encoding for interpreting text files, write the file encoding extended attribute before updating from disk; use more accurate typedef'd sizes in WALController
  • Loading branch information...
1 parent e418154 commit a5b64300c919e239f4addf57f640f19c30ac46cb Zachary Schneirov committed Oct 1, 2009
View
1 AlienNoteImporter.m
@@ -343,6 +343,7 @@ - (NoteObject*)noteWithFile:(NSString*)filename {
if (PdfDocClass != Nil) {
id doc = [[PdfDocClass alloc] initWithURL:[NSURL fileURLWithPath:filename]];
if (doc) {
+ //this method reliably crashes in 64-bit Leopard, and sometimes elsewhere as well
id sel = [doc performSelector:@selector(selectionForEntireDocument)];
if (sel) {
attributedStringFromData = [[NSMutableAttributedString alloc] initWithAttributedString:[sel attributedString]];
View
10 AppController.m
@@ -104,10 +104,9 @@ void outletObjectAwoke(id sender) {
- (void)runDelayedUIActionsAfterLaunch {
[[prefsController bookmarksController] setDelegate:self];
[[prefsController bookmarksController] updateBookmarksUI];
- [self updateNoteMenus];
+ [self updateNoteMenus];
[prefsController registerAppActivationKeystrokeWithTarget:self selector:@selector(bringFocusToControlField:)];
[notationController checkIfNotationIsTrashed];
- [NSApp setServicesProvider:self];
//connect sparkle programmatically to avoid loading its framework at nib awake;
if (RunningTigerAppKitOrHigher && !NSClassFromString(@"SUUpdater")) {
@@ -119,6 +118,8 @@ - (void)runDelayedUIActionsAfterLaunch {
NSLog(@"Could not load %@!", frameworkPath);
}
}
+
+ [NSApp setServicesProvider:self];
}
extern int decodedCount();
@@ -266,7 +267,7 @@ - (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
return (numberSelected == 1);
} else if (selector == @selector(fixFileEncoding:)) {
- return (currentNote != nil && storageFormatOfNote(currentNote) == PlainTextFormat);
+ return (currentNote != nil && storageFormatOfNote(currentNote) == PlainTextFormat && ![currentNote contentsWere7Bit]);
}
return YES;
@@ -1262,8 +1263,7 @@ - (void)windowWillClose:(NSNotification *)aNotification {
[NSApp terminate:nil];
}
-- (void)applicationWillTerminate:(NSNotification *)aNotification {
-
+- (void)applicationWillTerminate:(NSNotification *)aNotification {
if (notationController) {
//only save the state if the notation instance has actually loaded; i.e., don't save last-selected-note if we quit from a PW dialog
BOOL wasAutomatic = NO;
View
14 EncodingsManager.m
@@ -72,9 +72,9 @@ + (EncodingsManager *)sharedManager {
- (BOOL)checkUnicode {
- if (currentEncoding == NSUnicodeStringEncoding || currentEncoding == NSUTF8StringEncoding) {
+ if (NSUnicodeStringEncoding == currentEncoding || NSUTF8StringEncoding == currentEncoding) {
- NSString * alertTitleString = NSLocalizedString(@"quotemark%@quotemark is a Unicode file and not directly interpretable by plain text encodings.",
+ NSString * alertTitleString = NSLocalizedString(@"quotemark%@quotemark is a Unicode file and not directly interpretable using plain text encodings.",
@"alert title when converting from unicode");
if (NSRunAlertPanel([NSString stringWithFormat:alertTitleString, filenameOfNote(note)],
NSLocalizedString(@"If you wish to convert it, you must open and re-save the file in an external editor.", "alert description when converting from unicode"),
@@ -168,7 +168,7 @@ - (NSMenu*)textConversionsMenu {
[menuItem setEnabled:(noteString != nil && [noteString canBeConvertedToEncoding:thisEncoding])];
[noteString release];
- [menuItem setTag:thisEncoding];
+ [menuItem setTag:(int)thisEncoding];
[menuItem setTarget:self];
[menu addItem:menuItem];
}
@@ -188,9 +188,11 @@ - (void)setFileEncodingFromMenu:(id)sender {
if (![self tryToUpdateTextForEncoding:newEncoding]) {
//set it back to the current encoding--this one doesn't work
- int encodingIndex = [encodingsPopUpButton indexOfItemWithTag:currentEncoding];
+ int encodingIndex = [encodingsPopUpButton indexOfItemWithTag:(int)currentEncoding];
if (encodingIndex > -1)
[encodingsPopUpButton selectItemAtIndex:encodingIndex];
+ else
+ NSLog(@"(setting it back) encoding %u not found", currentEncoding);
}
//if ([[[self contentString] string] canBeConvertedToEncoding:encoding]) {
@@ -216,9 +218,11 @@ - (BOOL)tryToUpdateTextForEncoding:(NSStringEncoding)encoding {
currentEncoding = encoding;
- int encodingIndex = [encodingsPopUpButton indexOfItemWithTag:currentEncoding];
+ int encodingIndex = [encodingsPopUpButton indexOfItemWithTag:(int)currentEncoding];
if (encodingIndex > -1)
[encodingsPopUpButton selectItemAtIndex:encodingIndex];
+ else
+ NSLog(@"encoding %u not found", currentEncoding);
return YES;
} else {
View
BIN English.lproj/Localizable.strings
Binary file not shown.
View
6 FrozenNotation.m
@@ -70,7 +70,7 @@ - (id)initWithNotes:(NSMutableArray*)notes deletedNotes:(NSMutableArray*)antiNot
}
if (![notesData length]) {
- [notesData release];
+ NSLog(@"%s: empty notesData; returning nil", _cmd);
return nil;
}
}
@@ -96,14 +96,14 @@ + (NSData*)frozenDataWithExistingNotes:(NSMutableArray*)notes
return nil;
NSData *encodedNotationData = [NSKeyedArchiver archivedDataWithRootObject:frozenNotation];
- [frozenNotation release];
+ [frozenNotation autorelease];
return encodedNotationData;
}
- (NSMutableArray*)unpackedNotesWithPrefs:(NotationPrefs*)somePrefs returningError:(OSStatus*)err {
- //decrypt notesData, decrypting if necessary, then unarchive
+ //decrypt notesData if necessary, then unarchive
*err = noErr;
View
6 NSString_NV.m
@@ -497,6 +497,9 @@ + (NSString*)pathWithFSRef:(FSRef*)fsRef {
return path;
}
+//TODO: use volumeCapabilities in FSExchangeObjectsCompat.c to skip some work on volumes for which we know we would receive ENOTSUP
+//for +setTextEncodingAttribute:atFSPath: and +textEncodingAttributeOfFSPath: (test against VOL_CAP_INT_EXTENDED_ATTR)
+
+ (BOOL)setTextEncodingAttribute:(NSStringEncoding)encoding atFSPath:(const char*)path {
if (!path) return NO;
@@ -524,7 +527,7 @@ + (NSStringEncoding)textEncodingAttributeOfFSPath:(const char*)path {
//It could be, but it probably won't. If it is, then we won't get the encoding. Too bad.
char xattrValueBytes[128] = { 0 };
if (getxattr(path, "com.apple.TextEncoding", xattrValueBytes, sizeof(xattrValueBytes), 0, 0) < 0) {
- NSLog(@"couldn't get text encoding attribute of %s: %d", path, errno);
+ if (ENOATTR != errno) NSLog(@"couldn't get text encoding attribute of %s: %d", path, errno);
goto errorReturn;
}
NSString *encodingStr = [NSString stringWithUTF8String:xattrValueBytes];
@@ -626,7 +629,6 @@ + (NSMutableString*)newShortLivedStringFromFile:(NSString*)filename {
}
+ (NSMutableString*)newShortLivedStringFromData:(NSMutableData*)data ofGuessedEncoding:(NSStringEncoding*)encoding withPath:(const char*)aPath orWithFSRef:(const FSRef*)fsRef{
- NSLog(@"%s: %@", _cmd, data);
//this will fail if data lacks a BOM, but try it first as it's the fastest check
NSMutableString* stringFromData = [data newStringUsingBOMReturningEncoding:encoding];
if (stringFromData) {
View
361 Notation.xcodeproj/scrod.mode1v3
@@ -193,42 +193,50 @@
<key>Name</key>
<string>Default</string>
<key>Notifications</key>
- <array/>
+ <array>
+ <dict>
+ <key>XCObserverAutoDisconnectKey</key>
+ <true/>
+ <key>XCObserverDefintionKey</key>
+ <dict/>
+ <key>XCObserverFactoryKey</key>
+ <string>XCPerspectivesSpecificationIdentifier</string>
+ <key>XCObserverGUIDKey</key>
+ <string>XCObserverProjectIdentifier</string>
+ <key>XCObserverNotificationKey</key>
+ <string>PBXStatusBuildStateMessageNotification</string>
+ <key>XCObserverTargetKey</key>
+ <string>XCMainBuildResultsModuleGUID</string>
+ <key>XCObserverTriggerKey</key>
+ <string>awakenModuleWithObserver:</string>
+ <key>XCObserverValidationKey</key>
+ <dict/>
+ </dict>
+ </array>
<key>OpenEditors</key>
<array>
<dict>
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA23410746E1D00F62D93</string>
+ <string>210C65A610756725005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>AlienNoteImporter.m</string>
+ <string>NoteObject.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA23510746E1D00F62D93</string>
+ <string>210C65A710756725005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>AlienNoteImporter.m</string>
+ <string>NoteObject.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>216BA3D61074872C00F62D93</string>
+ <string>210C65B4107567EA005FA176</string>
<key>history</key>
<array>
- <string>216BA34210747A8C00F62D93</string>
- <string>216BA35A10747CF100F62D93</string>
- </array>
- <key>prevStack</key>
- <array>
- <string>216BA23810746E1D00F62D93</string>
- <string>216BA23910746E1D00F62D93</string>
- <string>216BA2911074720800F62D93</string>
- <string>216BA2921074720800F62D93</string>
- <string>216BA2931074720800F62D93</string>
- <string>216BA34410747A8C00F62D93</string>
- <string>216BA34510747A8C00F62D93</string>
+ <string>210C659D10756713005FA176</string>
</array>
</dict>
<key>SplitCount</key>
@@ -240,40 +248,75 @@
<key>Geometry</key>
<dict>
<key>Frame</key>
- <string>{{0, 20}, {1077, 723}}</string>
+ <string>{{0, 20}, {1040, 1030}}</string>
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
- <string>161 114 1077 764 0 0 1440 878 </string>
+ <string>328 107 1040 1071 0 0 1920 1178 </string>
</dict>
</dict>
<dict>
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA3AA1074815C00F62D93</string>
+ <string>210C641A10753F6E005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>BufferUtils.c</string>
+ <string>NotationController.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA3AB1074815C00F62D93</string>
+ <string>210C641B10753F6E005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>BufferUtils.c</string>
+ <string>NotationController.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>216BA3D71074872C00F62D93</string>
+ <string>210C65B5107567EA005FA176</string>
<key>history</key>
<array>
- <string>216BA3AC1074815C00F62D93</string>
- <string>216BA3AD1074815C00F62D93</string>
+ <string>210C641C10753F6E005FA176</string>
</array>
- <key>prevStack</key>
+ </dict>
+ <key>SplitCount</key>
+ <string>1</string>
+ </dict>
+ <key>StatusBarVisibility</key>
+ <true/>
+ </dict>
+ <key>Geometry</key>
+ <dict>
+ <key>Frame</key>
+ <string>{{0, 20}, {1082, 1030}}</string>
+ <key>PBXModuleWindowStatusBarHidden2</key>
+ <false/>
+ <key>RubberWindowFrame</key>
+ <string>186 107 1082 1071 0 0 1920 1178 </string>
+ </dict>
+ </dict>
+ <dict>
+ <key>Content</key>
+ <dict>
+ <key>PBXProjectModuleGUID</key>
+ <string>210C650C10755D77005FA176</string>
+ <key>PBXProjectModuleLabel</key>
+ <string>EncodingsManager.m</string>
+ <key>PBXSplitModuleInNavigatorKey</key>
+ <dict>
+ <key>Split0</key>
+ <dict>
+ <key>PBXProjectModuleGUID</key>
+ <string>210C650D10755D77005FA176</string>
+ <key>PBXProjectModuleLabel</key>
+ <string>EncodingsManager.m</string>
+ <key>_historyCapacity</key>
+ <integer>0</integer>
+ <key>bookmark</key>
+ <string>210C65B6107567EA005FA176</string>
+ <key>history</key>
<array>
- <string>216BA3AE1074815C00F62D93</string>
+ <string>210C652010755F97005FA176</string>
</array>
</dict>
<key>SplitCount</key>
@@ -285,41 +328,75 @@
<key>Geometry</key>
<dict>
<key>Frame</key>
- <string>{{0, 20}, {1031, 717}}</string>
+ <string>{{0, 20}, {1193, 1030}}</string>
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
- <string>291 120 1031 758 0 0 1440 878 </string>
+ <string>347 107 1193 1071 0 0 1920 1178 </string>
</dict>
</dict>
<dict>
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA1EE107466C500F62D93</string>
+ <string>210C632610752DC8005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>NSString_NV.m</string>
+ <string>AppController.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA1EF107466C500F62D93</string>
+ <string>210C632710752DC8005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>NSString_NV.m</string>
+ <string>AppController.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>216BA3D81074872C00F62D93</string>
+ <string>210C65B7107567EA005FA176</string>
<key>history</key>
<array>
- <string>216BA1F0107466C500F62D93</string>
- <string>216BA3A81074815C00F62D93</string>
+ <string>210C6382107530A0005FA176</string>
</array>
- <key>prevStack</key>
+ </dict>
+ <key>SplitCount</key>
+ <string>1</string>
+ </dict>
+ <key>StatusBarVisibility</key>
+ <true/>
+ </dict>
+ <key>Geometry</key>
+ <dict>
+ <key>Frame</key>
+ <string>{{0, 20}, {1015, 1028}}</string>
+ <key>PBXModuleWindowStatusBarHidden2</key>
+ <false/>
+ <key>RubberWindowFrame</key>
+ <string>448 109 1015 1069 0 0 1920 1178 </string>
+ </dict>
+ </dict>
+ <dict>
+ <key>Content</key>
+ <dict>
+ <key>PBXProjectModuleGUID</key>
+ <string>210C646610754998005FA176</string>
+ <key>PBXProjectModuleLabel</key>
+ <string>FrozenNotation.m</string>
+ <key>PBXSplitModuleInNavigatorKey</key>
+ <dict>
+ <key>Split0</key>
+ <dict>
+ <key>PBXProjectModuleGUID</key>
+ <string>210C646710754998005FA176</string>
+ <key>PBXProjectModuleLabel</key>
+ <string>FrozenNotation.m</string>
+ <key>_historyCapacity</key>
+ <integer>0</integer>
+ <key>bookmark</key>
+ <string>210C65B8107567EA005FA176</string>
+ <key>history</key>
<array>
- <string>216BA1F1107466C500F62D93</string>
- <string>216BA1F2107466C500F62D93</string>
+ <string>210C646810754998005FA176</string>
</array>
</dict>
<key>SplitCount</key>
@@ -331,35 +408,35 @@
<key>Geometry</key>
<dict>
<key>Frame</key>
- <string>{{0, 20}, {884, 722}}</string>
+ <string>{{0, 20}, {1004, 1030}}</string>
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
- <string>140 115 884 763 0 0 1440 878 </string>
+ <string>355 107 1004 1071 0 0 1920 1178 </string>
</dict>
</dict>
<dict>
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA37610747EB500F62D93</string>
+ <string>210C646A10754998005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>NoteObject.m</string>
+ <string>NSData_transformations.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
- <string>216BA37710747EB500F62D93</string>
+ <string>210C646B10754998005FA176</string>
<key>PBXProjectModuleLabel</key>
- <string>NoteObject.m</string>
+ <string>NSData_transformations.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>216BA3D91074872C00F62D93</string>
+ <string>210C65B9107567EA005FA176</string>
<key>history</key>
<array>
- <string>216BA36410747EA700F62D93</string>
+ <string>210C642C107543FE005FA176</string>
</array>
</dict>
<key>SplitCount</key>
@@ -371,11 +448,11 @@
<key>Geometry</key>
<dict>
<key>Frame</key>
- <string>{{0, 20}, {988, 717}}</string>
+ <string>{{0, 20}, {970, 1032}}</string>
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
- <string>225 120 988 758 0 0 1440 878 </string>
+ <string>673 105 970 1073 0 0 1920 1178 </string>
</dict>
</dict>
<dict>
@@ -396,10 +473,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>216BA3DA1074872C00F62D93</string>
+ <string>210C65BA107567EA005FA176</string>
<key>history</key>
<array>
- <string>216BA2621074708B00F62D93</string>
+ <string>210C6386107530A0005FA176</string>
</array>
</dict>
<key>SplitCount</key>
@@ -415,7 +492,7 @@
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
- <string>463 133 936 745 0 0 1440 878 </string>
+ <string>904 433 936 745 0 0 1920 1178 </string>
</dict>
</dict>
</array>
@@ -474,7 +551,7 @@
<dict>
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
<array>
- <real>302</real>
+ <real>307</real>
</array>
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
<array>
@@ -510,13 +587,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>73</integer>
+ <integer>84</integer>
<integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 925}, {302, 700}}</string>
+ <string>{{0, 924}, {307, 997}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -528,19 +605,19 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {319, 718}}</string>
+ <string>{{0, 0}, {324, 1015}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
- <real>302</real>
+ <real>307</real>
</array>
<key>RubberWindowFrame</key>
- <string>22 119 324 759 0 0 1440 878 </string>
+ <string>31 122 329 1056 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
<key>Proportion</key>
- <string>319pt</string>
+ <string>324pt</string>
</dict>
<dict>
<key>Dock</key>
@@ -551,19 +628,19 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20306471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
- <string>NSString_NV.m</string>
+ <string>NSCollection_utils.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CE0B20406471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
- <string>NSString_NV.m</string>
+ <string>NSCollection_utils.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>216BA3D51074872C00F62D93</string>
+ <string>210C65B3107567EA005FA176</string>
<key>history</key>
<array>
<string>21C61FAB10542D40004D5948</string>
@@ -585,7 +662,6 @@
<string>2182B429106B35CC008641E4</string>
<string>2182B42B106B35CC008641E4</string>
<string>2182B42D106B35CC008641E4</string>
- <string>2182B479106B3EDA008641E4</string>
<string>21313D28106C7F1700C8D785</string>
<string>21313D87106C908300C8D785</string>
<string>21313DC0106C97F100C8D785</string>
@@ -595,60 +671,30 @@
<string>21313DD5106C9B2200C8D785</string>
<string>21313DD6106C9B2200C8D785</string>
<string>213146B51071A0BF00C8D785</string>
- <string>213147CE1071B8F500C8D785</string>
<string>213147CF1071B8F500C8D785</string>
<string>2131485B1071C2F800C8D785</string>
<string>216BA1331074529100F62D93</string>
<string>216BA1341074529100F62D93</string>
<string>216BA1351074529100F62D93</string>
<string>216BA1551074547200F62D93</string>
<string>216BA1CD1074648A00F62D93</string>
- <string>216BA20E107469F700F62D93</string>
<string>216BA23010746E1D00F62D93</string>
<string>216BA29F107472CE00F62D93</string>
- <string>216BA2DC107473CC00F62D93</string>
- <string>216BA36610747EB500F62D93</string>
- <string>216BA36710747EB500F62D93</string>
<string>216BA36810747EB500F62D93</string>
<string>216BA36910747EB500F62D93</string>
- <string>216BA36A10747EB500F62D93</string>
- <string>216BA39A1074815C00F62D93</string>
- <string>216BA39B1074815C00F62D93</string>
- <string>216BA39C1074815C00F62D93</string>
- <string>216BA39D1074815C00F62D93</string>
- <string>216BA39E1074815C00F62D93</string>
- <string>216BA39F1074815C00F62D93</string>
- <string>216BA3A01074815C00F62D93</string>
+ <string>216BA3A41074815C00F62D93</string>
</array>
<key>prevStack</key>
<array>
- <string>216BA09F10744B1400F62D93</string>
<string>216BA13A1074529100F62D93</string>
<string>216BA13B1074529100F62D93</string>
<string>216BA13C1074529100F62D93</string>
<string>216BA15A1074547200F62D93</string>
- <string>216BA15B1074547200F62D93</string>
- <string>216BA1931074615100F62D93</string>
<string>216BA1D11074648A00F62D93</string>
- <string>216BA203107469C800F62D93</string>
<string>216BA23210746E1D00F62D93</string>
<string>216BA2A0107472CE00F62D93</string>
- <string>216BA2DE107473CC00F62D93</string>
- <string>216BA36C10747EB500F62D93</string>
- <string>216BA36D10747EB500F62D93</string>
- <string>216BA36E10747EB500F62D93</string>
<string>216BA36F10747EB500F62D93</string>
- <string>216BA37010747EB500F62D93</string>
<string>216BA37110747EB500F62D93</string>
- <string>216BA37210747EB500F62D93</string>
- <string>216BA37310747EB500F62D93</string>
- <string>216BA37410747EB500F62D93</string>
- <string>216BA3A11074815C00F62D93</string>
- <string>216BA3A21074815C00F62D93</string>
- <string>216BA3A31074815C00F62D93</string>
- <string>216BA3A41074815C00F62D93</string>
- <string>216BA3A51074815C00F62D93</string>
- <string>216BA3A61074815C00F62D93</string>
</array>
</dict>
<key>SplitCount</key>
@@ -662,7 +708,7 @@
<key>Frame</key>
<string>{{0, 0}, {0, 0}}</string>
<key>RubberWindowFrame</key>
- <string>22 119 324 759 0 0 1440 878 </string>
+ <string>31 122 329 1056 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
@@ -680,14 +726,14 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 5}, {0, 713}}</string>
+ <string>{{0, 5}, {0, 1010}}</string>
<key>RubberWindowFrame</key>
- <string>22 119 324 759 0 0 1440 878 </string>
+ <string>31 122 329 1056 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
<key>Proportion</key>
- <string>713pt</string>
+ <string>1010pt</string>
</dict>
</array>
<key>Proportion</key>
@@ -706,9 +752,9 @@
</array>
<key>TableOfContents</key>
<array>
- <string>216BA2681074709A00F62D93</string>
+ <string>210C63F610753951005FA176</string>
<string>1CE0B1FE06471DED0097A5F4</string>
- <string>216BA2691074709A00F62D93</string>
+ <string>210C63F710753951005FA176</string>
<string>1CE0B20306471E060097A5F4</string>
<string>1CE0B20506471E060097A5F4</string>
</array>
@@ -827,7 +873,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>0.0</real>
+ <real>276129770.984034</real>
<key>ToolbarDisplayMode</key>
<integer>1</integer>
<key>ToolbarIsVisible</key>
@@ -842,21 +888,24 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>216BA2A5107472CE00F62D93</string>
- <string>216BA2A6107472CE00F62D93</string>
+ <string>210C65BB107567EA005FA176</string>
+ <string>210C640C10753D05005FA176</string>
+ <string>210C640D10753D05005FA176</string>
+ <string>1C530D57069F1CE1000CFCEE</string>
<string>213148121071BCF800C8D785</string>
+ <string>210C646A10754998005FA176</string>
+ <string>210C646610754998005FA176</string>
+ <string>210C632610752DC8005FA176</string>
+ <string>210C650C10755D77005FA176</string>
+ <string>210C641A10753F6E005FA176</string>
+ <string>210C65A610756725005FA176</string>
<string>1CD10A99069EF8BA00B06720</string>
- <string>1C530D57069F1CE1000CFCEE</string>
- <string>216BA37610747EB500F62D93</string>
- <string>216BA1EE107466C500F62D93</string>
- <string>216BA3AA1074815C00F62D93</string>
- <string>216BA23410746E1D00F62D93</string>
- <string>1C78EAAD065D492600B07095</string>
<string>21C6208410543D7D004D5948</string>
+ <string>1C78EAAD065D492600B07095</string>
<string>/Users/scrod/Projects/Notation/Notation.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>22 119 324 759 0 0 1440 878 </string>
+ <string>31 122 329 1056 0 0 1920 1178 </string>
<key>WindowToolsV3</key>
<array>
<dict>
@@ -872,54 +921,54 @@
<key>Dock</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CD0528F0623707200166675</string>
<key>PBXProjectModuleLabel</key>
- <string>AlienNoteImporter.m</string>
+ <string>NotationFileManager.m</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {734, 528}}</string>
+ <string>{{0, 0}, {734, 420}}</string>
<key>RubberWindowFrame</key>
- <string>597 113 734 765 0 0 1440 878 </string>
+ <string>1062 413 734 765 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>528pt</string>
+ <string>420pt</string>
</dict>
<dict>
+ <key>BecomeActive</key>
+ <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBuildLogShowsTranscriptDefaultKey</key>
- <string>{{0, 129}, {734, 62}}</string>
+ <string>{{0, 171}, {734, 128}}</string>
<key>PBXProjectModuleGUID</key>
<string>XCMainBuildResultsModuleGUID</string>
<key>PBXProjectModuleLabel</key>
<string>Build</string>
<key>XCBuildResultsTrigger_Collapse</key>
<integer>1021</integer>
<key>XCBuildResultsTrigger_Open</key>
- <integer>1011</integer>
+ <integer>1010</integer>
</dict>
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 533}, {734, 191}}</string>
+ <string>{{0, 425}, {734, 299}}</string>
<key>RubberWindowFrame</key>
- <string>597 113 734 765 0 0 1440 878 </string>
+ <string>1062 413 734 765 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
<key>Proportion</key>
- <string>191pt</string>
+ <string>299pt</string>
</dict>
</array>
<key>Proportion</key>
@@ -937,14 +986,14 @@
<key>TableOfContents</key>
<array>
<string>21C6208410543D7D004D5948</string>
- <string>216BA278107470D800F62D93</string>
+ <string>210C63DF107538CE005FA176</string>
<string>1CD0528F0623707200166675</string>
<string>XCMainBuildResultsModuleGUID</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.buildV3</string>
<key>WindowString</key>
- <string>597 113 734 765 0 0 1440 878 </string>
+ <string>1062 413 734 765 0 0 1920 1178 </string>
<key>WindowToolGUID</key>
<string>21C6208410543D7D004D5948</string>
<key>WindowToolIsVisible</key>
@@ -979,8 +1028,8 @@
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {384, 323}}</string>
- <string>{{384, 0}, {772, 323}}</string>
+ <string>{{0, 0}, {462, 333}}</string>
+ <string>{{462, 0}, {694, 333}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
@@ -995,8 +1044,8 @@
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {1156, 323}}</string>
- <string>{{0, 323}, {1156, 286}}</string>
+ <string>{{0, 0}, {1156, 333}}</string>
+ <string>{{0, 333}, {1156, 276}}</string>
</array>
</dict>
</dict>
@@ -1026,15 +1075,15 @@
<string>Value</string>
<real>85</real>
<string>Summary</string>
- <real>542</real>
+ <real>464</real>
</array>
<key>Frame</key>
- <string>{{384, 0}, {772, 323}}</string>
+ <string>{{462, 0}, {694, 333}}</string>
<key>RubberWindowFrame</key>
- <string>255 208 1156 650 0 0 1440 878 </string>
+ <string>715 528 1156 650 0 0 1920 1178 </string>
</dict>
<key>RubberWindowFrame</key>
- <string>255 208 1156 650 0 0 1440 878 </string>
+ <string>715 528 1156 650 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXDebugSessionModule</string>
@@ -1057,18 +1106,18 @@
<key>TableOfContents</key>
<array>
<string>1CD10A99069EF8BA00B06720</string>
- <string>216BA27D1074720000F62D93</string>
+ <string>210C63E0107538CE005FA176</string>
<string>1C162984064C10D400B95A72</string>
- <string>216BA27E1074720000F62D93</string>
- <string>216BA27F1074720000F62D93</string>
- <string>216BA2801074720000F62D93</string>
- <string>216BA2811074720000F62D93</string>
- <string>216BA2821074720000F62D93</string>
+ <string>210C63E1107538CE005FA176</string>
+ <string>210C63E2107538CE005FA176</string>
+ <string>210C63E3107538CE005FA176</string>
+ <string>210C63E4107538CE005FA176</string>
+ <string>210C63E5107538CE005FA176</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debugV3</string>
<key>WindowString</key>
- <string>255 208 1156 650 0 0 1440 878 </string>
+ <string>715 528 1156 650 0 0 1920 1178 </string>
<key>WindowToolGUID</key>
<string>1CD10A99069EF8BA00B06720</string>
<key>WindowToolIsVisible</key>
@@ -1097,25 +1146,25 @@
<key>PBXProjectModuleGUID</key>
<string>1CDD528C0622207200134675</string>
<key>PBXProjectModuleLabel</key>
- <string>AlienNoteImporter.m</string>
+ <string>EncodingsManager.m</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {1102, 447}}</string>
+ <string>{{0, 0}, {1008, 618}}</string>
<key>RubberWindowFrame</key>
- <string>251 62 1102 816 0 0 1440 878 </string>
+ <string>628 67 1008 1111 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>1102pt</string>
+ <string>1008pt</string>
</dict>
</array>
<key>Proportion</key>
- <string>447pt</string>
+ <string>618pt</string>
</dict>
<dict>
<key>ContentConfiguration</key>
@@ -1128,18 +1177,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 452}, {1102, 323}}</string>
+ <string>{{0, 623}, {1008, 447}}</string>
<key>RubberWindowFrame</key>
- <string>251 62 1102 816 0 0 1440 878 </string>
+ <string>628 67 1008 1111 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXProjectFindModule</string>
<key>Proportion</key>
- <string>323pt</string>
+ <string>447pt</string>
</dict>
</array>
<key>Proportion</key>
- <string>775pt</string>
+ <string>1070pt</string>
</dict>
</array>
<key>Name</key>
@@ -1153,17 +1202,17 @@
<key>TableOfContents</key>
<array>
<string>1C530D57069F1CE1000CFCEE</string>
- <string>216BA28A1074720000F62D93</string>
- <string>216BA28B1074720000F62D93</string>
+ <string>210C63F0107538CE005FA176</string>
+ <string>210C63F1107538CE005FA176</string>
<string>1CDD528C0622207200134675</string>
<string>1CD0528E0623707200166675</string>
</array>
<key>WindowString</key>
- <string>251 62 1102 816 0 0 1440 878 </string>
+ <string>628 67 1008 1111 0 0 1920 1178 </string>
<key>WindowToolGUID</key>
<string>1C530D57069F1CE1000CFCEE</string>
<key>WindowToolIsVisible</key>
- <true/>
+ <false/>
</dict>
<dict>
<key>FirstTimeWindowDisplayed</key>
@@ -1198,7 +1247,7 @@
<key>Frame</key>
<string>{{0, 0}, {1102, 569}}</string>
<key>RubberWindowFrame</key>
- <string>294 268 1102 610 0 0 1440 878 </string>
+ <string>201 568 1102 610 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXDebugCLIModule</string>
@@ -1221,13 +1270,13 @@
<key>TableOfContents</key>
<array>
<string>1C78EAAD065D492600B07095</string>
- <string>216BA2971074720800F62D93</string>
+ <string>210C63F2107538CE005FA176</string>
<string>1C78EAAC065D492600B07095</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.consoleV3</string>
<key>WindowString</key>
- <string>294 268 1102 610 0 0 1440 878 </string>
+ <string>201 568 1102 610 0 0 1920 1178 </string>
<key>WindowToolGUID</key>
<string>1C78EAAD065D492600B07095</string>
<key>WindowToolIsVisible</key>
View
4,269 Notation.xcodeproj/scrod.pbxuser
3,823 additions, 446 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
2 NotationController.h
@@ -41,7 +41,7 @@ typedef struct _NoteCatalogEntry {
NoteAttributeColumn* sortColumn;
NoteObject **allNotesBuffer;
- unsigned allNotesBufferSize;
+ unsigned int allNotesBufferSize;
NSUInteger selectedNoteIndex;
char *currentFilterStr, *manglingString;
View
3 NotationFileManager.m
@@ -126,6 +126,7 @@ - (BOOL)notesDirectoryIsTrashed {
- (BOOL)notesDirectoryContainsFile:(NSString*)filename returningFSRef:(FSRef*)childRef {
UniChar chars[256];
+ if (!filename) return NO;
return FSRefMakeInDirectoryWithString(&noteDirectoryRef, childRef, (CFStringRef)filename, chars) == noErr;
}
@@ -387,7 +388,7 @@ - (NSMutableData*)dataFromFileInNotesDirectory:(FSRef*)childRef forFilename:(NSS
}
- (OSStatus)createFileIfNotPresentInNotesDirectory:(FSRef*)childRef forFilename:(NSString*)filename fileWasCreated:(BOOL*)created {
-
+
return FSCreateFileIfNotPresentInDirectory(&noteDirectoryRef, childRef, (CFStringRef)filename, (Boolean*)created);
}
View
5 NoteObject.h
@@ -55,7 +55,6 @@ typedef struct _NoteFilterContext {
//more metadata
CFAbsoluteTime modifiedDate, createdDate;
NSRange selectedRange;
- float scrolledProportion;
//each note has its own undo manager--isn't that nice?
NSUndoManager *undoManager;
@@ -92,7 +91,6 @@ NSInteger compareNodeID(id *a, id *b);
UTCDateTime fileModifiedDateOfNote(NoteObject *note);
CFAbsoluteTime modifiedDateOfNote(NoteObject *note);
-
NSStringEncoding fileEncodingOfNote(NoteObject *note);
//note display
@@ -120,7 +118,7 @@ NSInteger compareNodeID(id *a, id *b);
- (void)updateLabelConnections;
- (void)setLabelString:(NSString*)newLabels;
-- (void)writeCurrentFileEncodingToFSRef:(FSRef*)fsRef;
+- (OSStatus)writeCurrentFileEncodingToFSRef:(FSRef*)fsRef;
- (void)_setFileEncoding:(NSStringEncoding)encoding;
- (BOOL)setFileEncodingAndUpdate:(NSStringEncoding)encoding;
- (BOOL)updateFromFile;
@@ -160,6 +158,7 @@ NSInteger compareNodeID(id *a, id *b);
- (void)setDateAdded:(CFAbsoluteTime)newTime;
- (void)setSelectedRange:(NSRange)newRange;
- (NSRange)lastSelectedRange;
+- (BOOL)contentsWere7Bit;
- (NSUndoManager*)undoManager;
- (void)_undoManagerDidChange:(NSNotification *)notification;
View
50 NoteObject.m
@@ -46,7 +46,6 @@ - (id)init {
serverModifiedTime = 0;
logSequenceNumber = 0;
selectedRange = NSMakeRange(NSNotFound, 0);
- scrolledProportion = 0.0f;
//these are created either when the object is initialized from disk or when it writes its files to disk
//bzero(&noteFileRef, sizeof(FSRef));
@@ -251,7 +250,7 @@ - (id)initWithCoder:(NSCoder*)decoder {
createdDate = [decoder decodeDoubleForKey:VAR_STR(createdDate)];
selectedRange.location = [decoder decodeInt32ForKey:@"selectionRangeLocation"];
selectedRange.length = [decoder decodeInt32ForKey:@"selectionRangeLength"];
- scrolledProportion = [decoder decodeFloatForKey:VAR_STR(scrolledProportion)];
+ contentsWere7Bit = [decoder decodeBoolForKey:VAR_STR(contentsWere7Bit)];
logSequenceNumber = [decoder decodeInt32ForKey:VAR_STR(logSequenceNumber)];
@@ -274,6 +273,7 @@ - (id)initWithCoder:(NSCoder*)decoder {
} else {
NSRange32 range32;
+ float scrolledProportion = 0.0;
#if __LP64__
unsigned long longTemp;
#endif
@@ -325,9 +325,8 @@ - (id)initWithCoder:(NSCoder*)decoder {
#endif
selectedRange.location = range32.location;
selectedRange.length = range32.length;
+ contentsWere7Bit = (*(unsigned int*)&scrolledProportion) != 0; //hacko wacko
}
-
- contentsWere7Bit = (*(unsigned int*)&scrolledProportion) != 0; //hacko wacko
//re-created at runtime to save space
[self initContentCacheCString];
@@ -343,16 +342,14 @@ - (id)initWithCoder:(NSCoder*)decoder {
}
- (void)encodeWithCoder:(NSCoder *)coder {
-
- *(unsigned int*)&scrolledProportion = (unsigned int)contentsWere7Bit;
-
+
if ([coder allowsKeyedCoding]) {
[coder encodeDouble:modifiedDate forKey:VAR_STR(modifiedDate)];
[coder encodeDouble:createdDate forKey:VAR_STR(createdDate)];
[coder encodeInt32:(unsigned int)selectedRange.location forKey:@"selectionRangeLocation"];
[coder encodeInt32:(unsigned int)selectedRange.length forKey:@"selectionRangeLength"];
- [coder encodeFloat:scrolledProportion forKey:VAR_STR(scrolledProportion)];
+ [coder encodeBool:contentsWere7Bit forKey:VAR_STR(contentsWere7Bit)];
[coder encodeInt32:logSequenceNumber forKey:VAR_STR(logSequenceNumber)];
@@ -375,6 +372,8 @@ - (void)encodeWithCoder:(NSCoder *)coder {
} else {
// 64bit encoding would break 32bit reading - keyed archives should be used
#if !__LP64__
+ float scrolledProportion = 0.0;
+ *(unsigned int*)&scrolledProportion = (unsigned int)contentsWere7Bit;
#if DECODE_INDIVIDUALLY
[coder encodeValueOfObjCType:@encode(CFAbsoluteTime) at:&modifiedDate];
[coder encodeValueOfObjCType:@encode(CFAbsoluteTime) at:&createdDate];
@@ -545,6 +544,11 @@ - (void)initContentCacheCString {
contentCacheNeedsUpdate = NO;
}
+
+- (BOOL)contentsWere7Bit {
+ return contentsWere7Bit;
+}
+
int decodedCount() {
return decoded7Bit;
}
@@ -775,10 +779,11 @@ - (void)setLabelString:(NSString*)newLabelString {
}
- (NSString*)noteFilePath {
- if (!noteFileRef || IsZeros(noteFileRef, sizeof(FSRef)))
- return nil;
-
- return [NSString pathWithFSRef:noteFileRef];
+ if (IsZeros(noteFileRefInit(self), sizeof(FSRef))) {
+ if (![delegate notesDirectoryContainsFile:filename returningFSRef:noteFileRefInit(self)])
+ return nil;
+ }
+ return [NSString pathWithFSRef:noteFileRefInit(self)];
}
- (void)invalidateFSRef {
@@ -912,7 +917,7 @@ - (BOOL)writeUsingCurrentFileFormat {
}
//if writing plaintext set the file encoding with setxattr
if (formatID == PlainTextFormat) {
- [self writeCurrentFileEncodingToFSRef:noteFileRefInit(self)];
+ (void)[self writeCurrentFileEncodingToFSRef:noteFileRefInit(self)];
}
if (!resetFilename) {
@@ -943,7 +948,7 @@ - (BOOL)writeUsingCurrentFileFormat {
return YES;
}
-- (void)writeCurrentFileEncodingToFSRef:(FSRef*)fsRef {
+- (OSStatus)writeCurrentFileEncodingToFSRef:(FSRef*)fsRef {
NSAssert(fsRef, @"cannot write file encoding to a NULL FSRef");
//this is not the note's own fsRef; it could be anywhere
NSMutableData *pathData = [NSMutableData dataWithLength:4 * 1024];
@@ -953,6 +958,7 @@ - (void)writeCurrentFileEncodingToFSRef:(FSRef*)fsRef {
} else {
NSLog(@"%s: error getting path from FSRef: %d (IsZeros: %d)", _cmd, err, IsZeros(fsRef, sizeof(fsRef)));
}
+ return err;
}
- (void)_setFileEncoding:(NSStringEncoding)encoding {
@@ -965,6 +971,19 @@ - (BOOL)setFileEncodingAndUpdate:(NSStringEncoding)encoding {
if (encoding != fileEncoding) {
[self _setFileEncoding:encoding];
+ //write the file encoding extended attribute before updating from disk. why?
+ //a) to ensure -updateFromData: finds the right encoding when re-reading the file
+ //b) because the file is otherwise not being rewritten, and the extended attribute--if it existed--may have been different
+
+ OSStatus err = noErr;
+ do {
+ if (noErr != err || IsZeros(noteFileRefInit(self), sizeof(FSRef))) {
+ NSLog(@"%s: updating the fsref", _cmd);
+ if (![delegate notesDirectoryContainsFile:filename returningFSRef:noteFileRefInit(self)]) break;
+ }
+ err = [self writeCurrentFileEncodingToFSRef:noteFileRefInit(self)];
+ } while (fnfErr == err);
+
if ((updated = [self updateFromFile])) {
[self makeNoteDirtyUpdateTime:NO updateFile:NO];
//[[delegate delegate] contentsUpdatedForNote:self];
@@ -1018,7 +1037,6 @@ - (BOOL)updateFromCatalogEntry:(NoteCatalogEntry*)catEntry {
FSCatalogInfo info;
if ([delegate fileInNotesDirectory:noteFileRefInit(self) isOwnedByUs:NULL hasCatalogInfo:&info] == noErr) {
if (UCConvertUTCDateTimeToCFAbsoluteTime(&info.createDate, &aCreateDate) == noErr) {
- NSLog(@"picked up creation date for first-time-added file: %g", aCreateDate);
[self setDateAdded:aCreateDate];
}
}
@@ -1213,7 +1231,7 @@ - (OSStatus)exportToDirectoryRef:(FSRef*)directoryRef withFilename:(NSString*)us
return err;
}
if (PlainTextFormat == storageFormat) {
- [self writeCurrentFileEncodingToFSRef:&fileRef];
+ (void)[self writeCurrentFileEncodingToFSRef:&fileRef];
}
return noErr;
View
8 WALController.h
@@ -16,12 +16,12 @@
//each note will have its own key--the "LogSessionKey" salt of master key + per-record salt
typedef union {
struct {
- unsigned int originalDataLength;
- unsigned int dataLength;
- unsigned int checksum;
+ u_int32_t originalDataLength;
+ u_int32_t dataLength;
+ u_int32_t checksum;
char saltBuffer[RECORD_SALT_LEN];
};
- char recordBuffer[(sizeof(unsigned int) * 3) + RECORD_SALT_LEN];
+ char recordBuffer[(sizeof(u_int32_t) * 3) + RECORD_SALT_LEN];
} WALRecordHeader;
@interface WALController : NSObject {
View
10 WALController.m
@@ -227,17 +227,17 @@ - (BOOL)_encryptAndWriteData:(NSMutableData*)data {
compressionStream.avail_out = compressedDataBufferSize;
compressionStream.data_type = Z_BINARY;
- int previousOut = compressionStream.total_out;
+ uLong previousOut = compressionStream.total_out;
/* Perform the compression here. */
int deflateResult = deflate(&compressionStream, Z_SYNC_FLUSH);
/*Find the total size of the resulting compressed data. */
- int zlibAfterBufLen = compressionStream.total_out - previousOut;
+ uLong zlibAfterBufLen = compressionStream.total_out - previousOut;
if (deflateResult != Z_OK) {
NSLog(@"zlib deflation error: %s\n", compressionStream.msg);
return NO;
}
- if ((unsigned)zlibAfterBufLen > compressedDataBufferSize) {
+ if (zlibAfterBufLen > compressedDataBufferSize) {
NSLog(@"zlibAfterBufLen is larger than the allocated compressed buffer!");
return NO;
}
@@ -284,14 +284,14 @@ - (BOOL)_encryptAndWriteData:(NSMutableData*)data {
bytesWritten = 0;
}
- if ((unsigned)bytesWritten < dataChunkSize) {
+ if ((size_t)bytesWritten < dataChunkSize) {
//buffer any remaining data that we were not able to write (in case the disk was full, for example)
[unwrittenData appendBytes:dataChunk + bytesWritten length:(dataChunkSize - bytesWritten)];
}
free(dataChunk);
- return ((unsigned)bytesWritten == dataChunkSize);
+ return ((size_t)bytesWritten == dataChunkSize);
}
- (BOOL)synchronize {

0 comments on commit a5b6430

Please sign in to comment.
Something went wrong with that request. Please try again.