Skip to content

Commit b0b8b66

Browse files
committed
BookMacster 1.21 (was 1.20.7), prior to Code Review. After updating to Xcode 5.1 which wanted lots of stupid integer typecasts, finally fixed the #import Sparkle/SUUpdater.h phenomena (removed the path), added “Periodic” advanced trigger.
1 parent d2ceee6 commit b0b8b66

17 files changed

+47
-57
lines changed

SSYAlert.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ @implementation NSTextView (SSYAlertUsage)
127127
- (void)configureForSSYAlertUsage {
128128
[self setEditable:NO] ;
129129
[self setDrawsBackground:NO] ;
130-
[self setSelectable:NO] ;
130+
// Changed in BookMacster 1.21. Why not allow text to be copied?
131+
[self setSelectable:YES] ;
131132

132133
// The next two lines are very important. Took me many months to learn that,
133134
// by default, NSTextViews will resize themselves automatically to accomodate

SSYAlertSounder.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ - (id)init {
2222

2323
- (void)dealloc {
2424
for (NSNumber* soundId in [m_soundIds allValues]) {
25-
AudioServicesDisposeSystemSoundID([soundId longValue]) ;
25+
AudioServicesDisposeSystemSoundID((unsigned int)[soundId longValue]) ;
2626
}
2727

2828
[m_soundIds release] ;
@@ -77,7 +77,7 @@ - (void)playAlertSoundNamed:(NSString*)name {
7777
}
7878

7979
// First, see if we've got this sound cached
80-
SystemSoundID soundId = [[[self soundIds] objectForKey:name] longValue] ;
80+
SystemSoundID soundId = (SystemSoundID)[[[self soundIds] objectForKey:name] longValue] ;
8181
// Used -longValue because SystemSoundID is a UInt32
8282

8383
NSString* path ;

SSYDocFileObserver.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ - (id)initWithDocument:(NSDocument*)document
7272
The following was changed in BookMacster 1.20.2, to catch updates
7373
by both Dropbox and ChronoSync.
7474
*/
75-
NSInteger watchFlags = (SSYPathObserverChangeFlagsRename | SSYPathObserverChangeFlagsDelete) ;
75+
uint32_t watchFlags = (SSYPathObserverChangeFlagsRename | SSYPathObserverChangeFlagsDelete) ;
7676

7777
ok = [[self pathObserver] addPath:path
7878
watchFlags:watchFlags

SSYEventInfo.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
@implementation SSYEventInfo
55

66
+ (BOOL)alternateKeyDown {
7-
NSUInteger modifiers = CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState) ;
7+
CGEventFlags modifiers = (CGEventFlags)CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState) ;
88
return (modifiers & kCGEventFlagMaskAlternate) != 0 ;
99
}
1010

1111
+ (BOOL)shiftKeyDown {
12-
NSUInteger modifiers = CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState) ;
12+
CGEventFlags modifiers = (CGEventFlags)CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState) ;
1313
return (modifiers & kCGEventFlagMaskShift) != 0 ;
1414
}
1515

SSYKeychain.m

+17-17
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ + (NSArray*)genericAccountsForServiceName:(NSString*)serviceName {
133133
struct SecKeychainAttribute attribute ;
134134
attribute.tag = kSecServiceItemAttr ;
135135
// Being careful here because strlen(0) causes a crash
136-
attribute.length = serviceNameC ? strlen(serviceNameC) : 0 ;
136+
attribute.length = serviceNameC ? (UInt32)strlen(serviceNameC) : 0 ;
137137
attribute.data = (void*)serviceNameC ;
138138

139139
struct SecKeychainAttributeList attributeList ;
@@ -179,7 +179,7 @@ + (NSArray*)internetAccountsForHost:(NSString*)host {
179179
struct SecKeychainAttribute attribute ;
180180
attribute.tag = kSecServerItemAttr ;
181181
// Being careful here because strlen(0) causes a crash
182-
attribute.length = hostC ? strlen(hostC) : 0 ;
182+
attribute.length = hostC ? (UInt32)strlen(hostC) : 0 ;
183183
attribute.data = (void*)hostC ;
184184

185185
struct SecKeychainAttributeList attributeList ;
@@ -277,18 +277,18 @@ + (NSString*)internetPasswordUsername:(NSString*)username
277277
}
278278

279279
const char *hostC = [hostWithSub UTF8String] ;
280-
attribute.length = strlen(hostC) ;
280+
attribute.length = (UInt32)strlen(hostC) ;
281281
attribute.data = (void*)hostC ;
282282
// strlen(0) causes a crash but we've already checked that [host length] > 0
283283
NSInteger lengthHost = hostC ? strlen(hostC) : 0 ;
284284

285285
OSStatus findResult = SecKeychainFindInternetPassword (
286286
NULL, // default keychain
287-
lengthHost, // server name length
287+
(UInt32)lengthHost, // server name length
288288
hostC, // server name
289-
lengthDomain, // security domain length
289+
(UInt32)lengthDomain, // security domain length
290290
dom, // security domain
291-
lengthUser, // account name length
291+
(UInt32)lengthUser, // account name length
292292
user, // account name
293293
0, // path length
294294
NULL, // path
@@ -366,18 +366,18 @@ + (BOOL)addInternetPassword:(NSString*)password
366366
NSInteger lengthNewPassword = pass ? strlen(pass) : 0 ;
367367
OSStatus addResult = SecKeychainAddInternetPassword (
368368
NULL, // default keychain
369-
lengthHost, // server name length
369+
(UInt32)lengthHost, // server name length
370370
host, // server name
371-
lengthDomain, // security domain length
371+
(UInt32)lengthDomain, // security domain length
372372
dom, // security domain
373-
lengthUser, // account name length
373+
(UInt32)lengthUser, // account name length
374374
user, // account name
375375
0, // path length
376376
NULL, // path
377377
port, // port
378378
kSecProtocolTypeHTTP, // protocol
379379
kSecAuthenticationTypeHTTPBasic, // authentication type
380-
lengthNewPassword, // password length
380+
(UInt32)lengthNewPassword, // password length
381381
pass, // password
382382
NULL // item ref
383383
) ;
@@ -414,15 +414,15 @@ + (NSString*)genericPasswordServiceName:(NSString*)serviceName
414414
NSInteger accountNameLength = strlen(accountNameC) ;
415415

416416
const char* serviceNameC = [serviceName UTF8String] ;
417-
attribute.length = strlen(serviceNameC) ;
417+
attribute.length = (UInt32)strlen(serviceNameC) ;
418418
attribute.data = (void*)serviceNameC ;
419419
NSInteger serviceNameLength = serviceNameC ? strlen(serviceNameC) : 0 ;
420420

421421
OSStatus findResult = SecKeychainFindGenericPassword (
422422
NULL, // default keychain
423-
serviceNameLength, // server name length
423+
(UInt32)serviceNameLength, // server name length
424424
serviceNameC, // service name
425-
accountNameLength, // account name length
425+
(UInt32)accountNameLength, // account name length
426426
accountNameC, // account name
427427
&passwordLength, // password length
428428
&passwordC, // password
@@ -472,11 +472,11 @@ + (BOOL)addGenericPassword:(NSString*)password
472472
NSInteger passwordLength = passwordC ? strlen(passwordC) : 0 ;
473473
OSStatus addResult = SecKeychainAddGenericPassword (
474474
NULL, // default keychain
475-
serviceNameLength,
475+
(UInt32)serviceNameLength,
476476
serviceNameC,
477-
accountNameLength,
477+
(UInt32)accountNameLength,
478478
accountNameC,
479-
passwordLength,
479+
(UInt32)passwordLength,
480480
passwordC,
481481
NULL
482482
);
@@ -493,7 +493,7 @@ + (BOOL)changeKeychainItemRef:(SecKeychainItemRef)itemRef
493493

494494
if (password && itemRef) {
495495
const char *pass = [password UTF8String] ;
496-
OSErr status = SecKeychainItemModifyContent(itemRef, nil, strlen(pass), pass) ;
496+
OSErr status = SecKeychainItemModifyContent(itemRef, nil, (UInt32)strlen(pass), pass) ;
497497
success = (status == noErr) ;
498498
}
499499

SSYManagedObject.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ - (void)breakRetainCycles {
393393

394394
- (uint32_t)valuesHash {
395395
NSArray* attributeKeys = [[[self entity] attributesByName] allKeys] ;
396-
unsigned long valuesHash = 0 ;
396+
uint32_t valuesHash = 0 ;
397397
for (NSString* key in attributeKeys) {
398398
#ifdef __LP64__
399399
uint32_t aHash = [[self valueForKey:key] hash] & 0x00000000ffffffff ;

SSYOperationQueue.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ - (void)observeValueForKeyPath:(NSString*)keyPath
212212
NSScriptCommand* scriptCommand = [self scriptCommand] ;
213213
NSError* error = [self error] ;
214214
if (error) {
215-
[scriptCommand setScriptErrorNumber:[error code]] ;
215+
[scriptCommand setScriptErrorNumber:(int)[error code]] ;
216216
[scriptCommand setScriptErrorString:[error localizedDescription]] ;
217217
}
218218
[self setError:nil

SSYProgressView.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ - (void)unsafeShowCompletionVerb:(NSString*)verb
699699
result, constKeyCompletionResult,
700700
nil] ;
701701

702-
// Remove any prior completions of same verb (Added BookMacster 1.20.7)
702+
// Remove any prior completions of same verb (Added BookMacster 1.21)
703703
NSArray* completionsCopy = [[self completions] copy] ;
704704
NSInteger i = [completionsCopy count] - 1 ;
705705
for (NSDictionary* completion in [completionsCopy reverseObjectEnumerator]) {

SSYRecurringDate.m

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ + (NSString*)displayStringForWeekday:(NSInteger)weekday {
5252
case SSRecurringDateWildcard:
5353
key = @"everyDay" ;
5454
break ;
55-
default:
55+
case 0:
56+
default:
5657
day = @"Sun" ;
5758
break;
5859
}

SSYResourceForks.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ - (void) parser:(NSXMLParser*)parser
5858
- (NSArray*)weblocFilenamesAndUrlsInPaths:(NSArray*)paths {
5959
OSErr err ;
6060
FSRef fsRef ;
61-
NSInteger fileRef ;
61+
ResFileRefNum fileRef ;
6262
NSMutableArray* filenamesAndURLs = [NSMutableArray array] ;
6363

6464
for (NSString* path in paths) {

SSYSheetManager.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ - (void)windowDidEndSheet:(NSNotification*)note {
119119
-[NSSavePanel beginSheetModalForWindow:completionHandler:]. In a conflict
120120
between one of our those and one of ours, we will lose. Our sheet will
121121
never be presented, and the user will hear an NSBeep(). ARGHHHH!!!
122-
So, starting with BookMacster 1.20.7, we wait here for a 0 second delay,
122+
So, starting with BookMacster 1.21, we wait here for a 0 second delay,
123123
and THEN invoke tryToDequeueWindow: which will only do so if there is not
124124
THEN an attached sheet on our window. If there is, that method will
125125
no-op, and then this method will be reinvoked when that other sheet ends,

SSYShortcutActuator.m

+7-5
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ + (NSString*)stringForKeyCode:(NSInteger)keyCode
120120
UniChar unicodeString[maxStringLength] ;
121121

122122
OSStatus status = UCKeyTranslate(keyboardLayout,
123-
keyCode, kUCKeyActionDown, modifierFlags,
123+
keyCode,
124+
kUCKeyActionDown,
125+
(unsigned int)modifierFlags,
124126
LMGetKbdType(), 0,
125127
&deadKeyState,
126128
maxStringLength,
@@ -356,17 +358,17 @@ - (NSDictionary*)registerShortcutWithInfo:(NSDictionary*)info
356358
return nil ;
357359
}
358360

359-
int32_t keyCode = [[info objectForKey:constKeyKeyCode] longValue] ;
360-
uint32_t modifiers = [[info objectForKey:constKeyModifierFlags] unsignedLongValue] ;
361-
modifiers = SRCocoaToCarbonFlags(modifiers) ;
361+
int32_t keyCode = (int32_t)[[info objectForKey:constKeyKeyCode] longValue] ;
362+
uint32_t modifiers = (uint32_t)[[info objectForKey:constKeyModifierFlags] unsignedLongValue] ;
363+
modifiers = (uint32_t)SRCocoaToCarbonFlags(modifiers) ;
362364

363365
EventHotKeyID hotKeyID ;
364366
EventTypeSpec eventType ;
365367
eventType.eventClass = kEventClassKeyboard ;
366368
eventType.eventKind = kEventHotKeyPressed ;
367369
EventHandlerUPP handler = &SSYShortcutActuate ;
368370

369-
hotKeyID.id = ++m_shortcutSerialNumber ;
371+
hotKeyID.id = (UInt32)(++m_shortcutSerialNumber) ;
370372
EventTargetRef thisAppEventTarget = GetApplicationEventTarget() ;
371373
EventHotKeyRef hotKeyRef = NULL ;
372374
EventHandlerRef handlerRef = NULL ;

SSYSqliter.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ - (NSDictionary*)nextRowFromPreparedStatement:(sqlite3_stmt*)preparedStatement {
860860
row = [[NSMutableDictionary alloc] init] ;
861861
}
862862

863-
NSInteger iColumn ;
863+
int iColumn ;
864864
for (iColumn= 0; iColumn<nColumns; iColumn++) {
865865
NSInteger type = sqlite3_column_type(preparedStatement, iColumn) ;
866866
// The sqlite3_column_type() routine returns datatype code for the initial data type of the result column.
@@ -1340,7 +1340,7 @@ - (BOOL)setBlobData:(NSData*)blobData
13401340

13411341
if (result == SQLITE_OK) {
13421342
// bind attribute object
1343-
result = sqlite3_bind_blob(preparedStatement, 1, [blobData bytes], [blobData length], SQLITE_TRANSIENT) ;
1343+
result = sqlite3_bind_blob(preparedStatement, 1, [blobData bytes], (int)[blobData length], SQLITE_TRANSIENT) ;
13441344
if (result != SQLITE_OK) {
13451345
error = [self makeErrorWithAppCode:453043
13461346
sqliteCode:result
@@ -1482,7 +1482,7 @@ - (BOOL)setObject:(id)object
14821482
errorDescription:&errorStr];
14831483

14841484
// bind attribute object
1485-
result = sqlite3_bind_blob(preparedStatement, 1, [data bytes], [data length], SQLITE_TRANSIENT) ;
1485+
result = sqlite3_bind_blob(preparedStatement, 1, [data bytes], (int)[data length], SQLITE_TRANSIENT) ;
14861486
if (result != SQLITE_OK) {
14871487
error = [self makeErrorWithAppCode:453013
14881488
sqliteCode:result
@@ -1678,7 +1678,7 @@ - (NSArray*)debugReadAllDataInTable:(NSString*)table
16781678
NSInteger nBytes = 0;
16791679

16801680
NSMutableArray* rowColumns = [[NSMutableArray alloc] init] ;
1681-
NSInteger iColumn ;
1681+
int iColumn ;
16821682
for (iColumn=0; iColumn<numberOfColumns; iColumn++) {
16831683
pFirstByte = sqlite3_column_blob(preparedStatement, iColumn) ;
16841684
nBytes = sqlite3_column_bytes(preparedStatement, iColumn);
@@ -1796,15 +1796,15 @@ - (BOOL)addNewItemWithIdentifier:(NSInteger)identifier
17961796
{
17971797
if (result == SQLITE_OK) {
17981798
// Now, another loop to bind each parameter value to its question mark
1799-
NSInteger i ;
1799+
int i ;
18001800
for (i=0; i<nAttributes; i++) {
18011801
NSString *errorStr = nil ;
18021802
NSData* data = [NSPropertyListSerialization dataFromPropertyList:[valuesArray objectAtIndex:i]
18031803
format:NSPropertyListBinaryFormat_v1_0
18041804
errorDescription:&errorStr];
18051805

18061806
// i+1 in next line is because the question marks in sqlite are indexed starting with 1, not 0
1807-
result = sqlite3_bind_blob(preparedStatement, i+1, [data bytes], [data length], SQLITE_TRANSIENT) ;
1807+
result = sqlite3_bind_blob(preparedStatement, i+1, [data bytes], (int)[data length], SQLITE_TRANSIENT) ;
18081808
if (result != SQLITE_OK) {
18091809
error = [self makeErrorWithAppCode:453022
18101810
sqliteCode:result
@@ -1938,7 +1938,7 @@ - (void)demonstrateInsertPreparedTable:(NSString*)table {
19381938
sprintf(sample.c, "sample %ld %f", (long)(sample.a), sample.b );
19391939

19401940
// bind parameter values
1941-
sqlite3_bind_int(insert, 1, sample.a);
1941+
sqlite3_bind_int(insert, 1, (int)(sample.a));
19421942
sqlite3_bind_double(insert, 2, sample.b);
19431943
sqlite3_bind_text(insert, 3, sample.c, -1, SQLITE_STATIC);
19441944

SSYSuperFileManager.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ - (BOOL)canExecutePath:(NSString *)fullPath
293293
}
294294
else {
295295
// See if given groupID can execute it as group
296-
uint32_t owningGroupID = [[attributes objectForKey:NSFileGroupOwnerAccountID] unsignedIntegerValue] ;
296+
uint32_t owningGroupID = (uint32_t)[[attributes objectForKey:NSFileGroupOwnerAccountID] unsignedIntegerValue] ;
297297
if ( (owningGroupID==groupID) && ((posixPermissions & S_IXGRP) != 0) ) {
298298
canX = YES ;
299299
}

SSYToolbar.m

-13
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
NSString* const constBindingToolbarDisplayStyle = @"displayStyle" ;
44
static BOOL static_alreadyEntered = NO ;
55

6-
// Superclass (NSToolbar) properties
7-
static NSString* const constKeyDisplayMode = @"displayMode" ;
8-
static NSString* const constKeySizeMode = @"sizeMode" ;
96

107
@implementation SSYToolbar
118

@@ -30,16 +27,6 @@ - (SSYToolbarDisplayStyle)displayStyle {
3027
}
3128

3229

33-
#if 0
34-
//This is not needed?
35-
+ (NSSet*)keyPathsForValuesAffectingDisplayStyle {
36-
return [NSSet setWithObjects:
37-
constKeyDisplayMode,
38-
constKeySizeMode,
39-
nil] ;
40-
}
41-
#endif
42-
4330
/*
4431
The following override is a kludge is to fix a very strange bug:
4532
Open two documents.

SSYVolumeMountie.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ + (BOOL)unmountVolumePath:(NSString*)path
231231
@"%@() returned underlying error",
232232
failedFunction] ;
233233
*error_p = SSYMakeError(errCode, msg) ;
234-
NSError* error_ = [NSError errorWithMacErrorCode:errCode_] ;
234+
NSError* error_ = [NSError errorWithMacErrorCode:(OSStatus)errCode_] ;
235235
*error_p = [*error_p errorByAddingUnderlyingError:error_] ;
236236
}
237237

SSYWrappingCheckbox.m

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ - (void)sizeHeightToFitAllowShrinking:(BOOL)allowShrinking {
5454
}
5555

5656
// You could change these if you wanted a different size checkbox
57-
NSControlSize static const constCheckboxSize = NSSmallControlSize ;
5857
CGFloat static const constCheckboxWidth = 18.0 ;
5958
CGFloat static const constCheckboxHeight = 18.0 ;
6059
// It is possible that I should define only one of the following

0 commit comments

Comments
 (0)