Skip to content

Commit 7e186ff

Browse files
Fixed accented characters replacement
and a few more compiler/static analyzer flags.
1 parent 4239d1e commit 7e186ff

14 files changed

+66
-80
lines changed

BlorPasswordRetriever.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ - (void)dealloc {
169169
@implementation BlorNoteEnumerator
170170

171171
- (id)initWithBlor:(NSString*)blorPath passwordHashData:(NSData*)passwordHashData {
172-
if ([super init]) {
172+
if (self=[super init]) {
173173
path = [blorPath retain];
174174

175175
if (!(keyData = [passwordHashData retain]))
@@ -189,9 +189,10 @@ - (id)initWithBlor:(NSString*)blorPath passwordHashData:(NSData*)passwordHashDat
189189

190190
currentByteOffset = 24;
191191
//read past the # of notes marker--we're just going to read as many notes as possible
192+
return self;
192193
}
194+
return nil;
193195

194-
return self;
195196
}
196197

197198
- (void)dealloc {

BookmarksController.m

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,17 @@
2929
@implementation NoteBookmark
3030

3131
- (id)initWithDictionary:(NSDictionary*)aDict {
32-
if (self=[super init]) {
3332
if (aDict) {
3433
NSString *uuidString = [aDict objectForKey:BMNoteUUIDStringKey];
3534
if (uuidString) {
36-
[self initWithNoteUUIDBytes:[uuidString uuidBytes] searchString:[aDict objectForKey:BMSearchStringKey]];
35+
return (self=[self initWithNoteUUIDBytes:[uuidString uuidBytes] searchString:[aDict objectForKey:BMSearchStringKey]]);
3736
} else {
3837
NSLog(@"NoteBookmark init: supplied nil uuidString");
3938
}
4039
} else {
4140
NSLog(@"NoteBookmark init: supplied nil dictionary; couldn't init");
42-
return nil;
41+
4342
}
44-
return self;
45-
}
4643
return nil;
4744
}
4845

@@ -57,23 +54,19 @@ - (id)initWithNoteUUIDBytes:(CFUUIDBytes)bytes searchString:(NSString*)aString {
5754
}
5855

5956
- (id)initWithNoteObject:(NoteObject*)aNote searchString:(NSString*)aString {
60-
if(self=[super init]){
61-
if (aNote) {
57+
58+
if (aNote) {
59+
60+
CFUUIDBytes *bytes = [aNote uniqueNoteIDBytes];
61+
if (!bytes) {
62+
NSLog(@"NoteBookmark init: no cfuuidbytes pointer from note %@", titleOfNote(aNote));
63+
}else if(self=[self initWithNoteUUIDBytes:*bytes searchString:aString]){
6264
noteObject = [aNote retain];
63-
searchString = [aString copy];
64-
65-
CFUUIDBytes *bytes = [aNote uniqueNoteIDBytes];
66-
if (!bytes) {
67-
NSLog(@"NoteBookmark init: no cfuuidbytes pointer from note %@", titleOfNote(aNote));
68-
return nil;
69-
}
70-
uuidBytes = *bytes;
71-
} else {
72-
NSLog(@"NoteBookmark init: supplied nil note");
73-
return nil;
65+
return self;
7466
}
75-
return self;
7667
}
68+
NSLog(@"NoteBookmark init: supplied nil note");
69+
[self release];
7770
return nil;
7871
}
7972

@@ -538,11 +531,11 @@ - (void)addBookmark:(id)sender {
538531
NSString *newString = [[appController fieldSearchString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
539532

540533
NoteBookmark *bookmark = [[NoteBookmark alloc] initWithNoteObject:[appController selectedNoteObject] searchString:newString];
541-
if (bookmark) {
542-
534+
if (bookmark!=nil) {
543535
NSUInteger existingIndex = [bookmarks indexOfObject:bookmark];
544536
if (existingIndex != NSNotFound) {
545537
//show them what they've already got
538+
546539
NoteBookmark *existingBookmark = [bookmarks objectAtIndex:existingIndex];
547540
if ([window isVisible]) [self selectBookmarkInTableView:existingBookmark];
548541
} else {
@@ -551,8 +544,8 @@ - (void)addBookmark:(id)sender {
551544
[self updateBookmarksUI];
552545
if ([window isVisible]) [self selectBookmarkInTableView:bookmark];
553546
}
554-
}
555-
[bookmark release];
547+
}
548+
[bookmark release];
556549
} else {
557550
//there are only so many numbers and modifiers
558551
NSRunAlertPanel(NSLocalizedString(@"Too many bookmarks.",nil), NSLocalizedString(@"You cannot create more than 26 bookmarks. Try removing some first.",nil), NSLocalizedString(@"OK",nil), nil, NULL);

DiskUUIDEntry.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
@implementation DiskUUIDEntry
2323

2424
- (id)initWithUUIDRef:(CFUUIDRef)aUUIDRef {
25-
if ([super init]) {
25+
if (self=[super init]) {
2626
NSAssert(aUUIDRef != nil, @"need a real UUID");
2727
uuidRef = CFRetain(aUUIDRef);
2828
lastAccessed = [[NSDate date] retain];
29+
return self;
2930
}
30-
return self;
31+
return nil;
3132
}
3233

3334
- (void)dealloc {
@@ -48,7 +49,7 @@ - (void)encodeWithCoder:(NSCoder *)coder {
4849
- (id)initWithCoder:(NSCoder*)decoder {
4950
NSAssert([decoder allowsKeyedCoding], @"keyed-decoding only!");
5051

51-
if ([super init]) {
52+
if (self=[super init]) {
5253

5354
lastAccessed = [[decoder decodeObjectForKey:VAR_STR(lastAccessed)] retain];
5455

@@ -59,8 +60,11 @@ - (id)initWithCoder:(NSCoder*)decoder {
5960
}
6061

6162
if (!uuidRef) return nil;
63+
64+
65+
return self;
6266
}
63-
return self;
67+
return nil;
6468
}
6569

6670
- (void)see {

EmptyView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
{
1919
IBOutlet NSTextField *labelText;
2020
NSInteger lastNotesNumber;
21-
NSColor *bgCol;
21+
// NSColor *bgCol;
2222
}
2323

2424
- (void)setLabelStatus:(NSInteger)notesNumber;
25-
- (void)setBackgroundColor:(NSColor *)inColor;
25+
//- (void)setBackgroundColor:(NSColor *)inColor;
2626

2727
@end

ExternalEditorListController.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ - (id)initWithBundleID:(NSString*)aBundleIdentifier resolvedURL:(NSURL*)aURL {
4242
if (!bundleIdentifier) {
4343
if (!(bundleIdentifier = [[[NSBundle bundleWithPath:[aURL path]] bundleIdentifier] copy])) {
4444
NSLog(@"initWithBundleID:resolvedURL: URL does not seem to point to a valid bundle");
45+
[self dealloc];
4546
return nil;
4647
}
4748
}
4849
return self;
4950
}
51+
[self dealloc];
5052
return nil;
5153
}
5254

FrozenNotation.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ - (id)initWithNotes:(NSMutableArray*)notes deletedNotes:(NSMutableSet*)antiNotes
7575

7676
if (![prefs encryptDataInNewSession:notesData]) {
7777
NSLog(@"Couldn't encrypt data!");
78+
[self dealloc];
7879
return nil;
7980
}
8081
}
8182

8283
if (![notesData length]) {
8384
NSLog(@"%@: empty notesData; returning nil", NSStringFromSelector(_cmd));
85+
[self dealloc];
8486
return nil;
8587
}
8688
return self;

GlobalPrefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ BOOL ColorsEqualWith8BitChannels(NSColor *c1, NSColor *c2);
147147
- (void)setSoftTabs:(BOOL)value sender:(id)sender;
148148
- (BOOL)softTabs;
149149

150-
- (int)numberOfSpacesInTab;
150+
- (NSInteger)numberOfSpacesInTab;
151151

152152
- (float)tableFontSize;
153153
- (void)setTableFontSize:(float)fontSize sender:(id)sender;

GlobalPrefs.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ - (id)init {
128128
[NSNumber numberWithBool:YES], AutoIndentsNewLinesKey,
129129
[NSNumber numberWithBool:YES], AutoFormatsListBulletsKey,
130130
[NSNumber numberWithBool:NO], UseSoftTabsKey,
131-
[NSNumber numberWithInt:4], NumberOfSpacesInTabKey,
131+
[NSNumber numberWithInteger:4], NumberOfSpacesInTabKey,
132132
[NSNumber numberWithBool:YES], PastePreservesStyleKey,
133133
[NSNumber numberWithBool:YES], TabKeyIndentsKey,
134134
[NSNumber numberWithBool:YES], ConfirmNoteDeletionKey,
@@ -547,8 +547,8 @@ - (BOOL)softTabs {
547547
return [defaults boolForKey:UseSoftTabsKey];
548548
}
549549

550-
- (int)numberOfSpacesInTab {
551-
return (int)[defaults integerForKey:NumberOfSpacesInTabKey];
550+
- (NSInteger)numberOfSpacesInTab {
551+
return [defaults integerForKey:NumberOfSpacesInTabKey];
552552
}
553553

554554
BOOL ColorsEqualWith8BitChannels(NSColor *c1, NSColor *c2) {
@@ -683,7 +683,7 @@ - (NSParagraphStyle*)noteBodyParagraphStyle {
683683
NSFont *bodyFont = [self noteBodyFont];
684684

685685
if (!noteBodyParagraphStyle && bodyFont) {
686-
int numberOfSpaces = [self numberOfSpacesInTab];
686+
NSInteger numberOfSpaces = [self numberOfSpacesInTab];
687687
NSMutableString *sizeString = [[NSMutableString alloc] initWithCapacity:numberOfSpaces];
688688
while (numberOfSpaces--) {
689689
[sizeString appendString:@" "];

Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
</dict>
163163
</array>
164164
<key>CFBundleVersion</key>
165-
<string>114</string>
165+
<string>115</string>
166166
<key>LSApplicationCategoryType</key>
167167
<string>public.app-category.productivity</string>
168168
<key>LSArchitecturePriority</key>

LabelsListController.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ - (NSArray*)labelTitlesPrefixedByString:(NSString*)prefixString indexOfSelectedI
104104
return titles;
105105
}
106106

107-
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
108-
static CGRect NSRectToCGRect(NSRect nsrect) {
109-
union _ {NSRect ns; CGRect cg;};
110-
return ((union _ *)&nsrect)->cg;
111-
}
112-
#endif
113107

114108
- (void)invalidateCachedLabelImages {
115109
//used when the list font size changes

0 commit comments

Comments
 (0)