Skip to content

Commit 7773f6a

Browse files
committed
Apply changes from PR #74
1 parent a7ab7e3 commit 7773f6a

8 files changed

Lines changed: 12 additions & 60 deletions

File tree

Core/COCrossPersistentRootDeadRelationshipCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
5959
*
6060
* For referring object graph contexts, when unloaded or finalized, the
6161
* deallocation will trigger their removal of their inner objects from the hash
62-
* tables in the cache on 10.8 or iOS 6 or higher, but not on 10.7.
62+
* tables in the cache on 10.8 or iOS 6 or higher, which we require.
6363
*/
6464
- (void)removePath: (COPath *)aPath;
6565

Core/COCrossPersistentRootDeadRelationshipCache.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ - (instancetype)init
1616
{
1717
SUPERINIT;
1818
_pathToReferringObjects = [NSMutableDictionary new];
19-
#if GNUSTEP
20-
_referringObjectToPaths = [NSMapTable mapTableWithWeakToStrongObjects];
21-
#else
2219
_referringObjectToPaths = [NSMapTable weakToStrongObjectsMapTable];
23-
#endif
2420
return self;
2521
}
2622

@@ -35,11 +31,7 @@ - (void)addReferringObject: (COObject *)aReferrer
3531
// FIXME: If we don't ditch 10.7 support, we need a reverse mapping
3632
// from each referringObject to a path set, that can be used to remove
3733
// the referring objects when their object graph context is discarded.
38-
#ifdef GNUSTEP
39-
referringObjects = [NSHashTable hashTableWithWeakObjects];
40-
#else
4134
referringObjects = [NSHashTable weakObjectsHashTable];
42-
#endif
4335

4436
_pathToReferringObjects[aPath] = referringObjects;
4537
}

Core/COPrimitiveCollection.m

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,7 @@ - (BOOL)isMutable
8383

8484
- (NSPointerArray *)makeBacking
8585
{
86-
#ifdef GNUSTEP
87-
return [NSPointerArray pointerArrayWithStrongObjects];
88-
#else
8986
return [NSPointerArray strongObjectsPointerArray];
90-
#endif
9187
}
9288

9389
- (instancetype)init
@@ -250,7 +246,7 @@ - (void)insertObject: (id)anObject atIndex: (NSUInteger)index
250246
COThrowExceptionIfNotMutable(_permanentlyMutable, _temporaryMutable);
251247
COThrowExceptionIfOutOfBounds(self, index, YES);
252248

253-
// NSPointerArray on 10.7 doesn't allow inserting at the end using index == count, so
249+
// NSPointerArray on 10.9 (at least) doesn't allow inserting at the end using index == count, so
254250
// call addPointer in that case as a workaround.
255251
if (index == _externalIndexToBackingIndex.count)
256252
{
@@ -366,20 +362,12 @@ @implementation COUnsafeRetainedMutableArray
366362

367363
- (NSPointerArray *)makeBacking
368364
{
369-
#ifdef GNUSTEP
370-
return [NSPointerArray pointerArrayWithWeakObjects];
371-
#else
372365
return [NSPointerArray weakObjectsPointerArray];
373-
#endif
374366
}
375367

376368
- (NSHashTable *)makeBackingHashTable
377369
{
378-
#ifdef GNUSTEP
379-
return [NSHashTable hashTableWithWeakObjects];
380-
#else
381370
return [NSHashTable weakObjectsHashTable];
382-
#endif
383371
}
384372

385373
- (instancetype)initWithObjects: (const id[])objects count: (NSUInteger)count
@@ -672,11 +660,7 @@ @implementation COUnsafeRetainedMutableSet
672660

673661
- (NSHashTable *)makeBacking
674662
{
675-
#ifdef GNUSTEP
676-
return [NSHashTable hashTableWithWeakObjects];
677-
#else
678663
return [NSHashTable weakObjectsHashTable];
679-
#endif
680664
}
681665

682666
@end

Debugging/COSQLiteStore+Graphviz.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,9 @@ void COViewDOTGraphFile(NSString *dotFilePath)
178178
{
179179
continue;
180180
}
181-
182-
// NOTE: Using NSTask rather than system() breaks 'po [objectGraphContext showGraph]' in LLDB on 10.7
183-
system([[NSString stringWithFormat: @"%@ -Tpdf '%@' -o '%@'",
184-
executablePath,
185-
dotFilePath,
186-
pdfPath] UTF8String]);
181+
NSTask *task = [NSTask launchedTaskWithLaunchPath: executablePath
182+
arguments: @[@"-Tpdf", dotFilePath, @"-o", pdfPath]];
183+
[task waitUntilExit];
187184
[[NSWorkspace sharedWorkspace] openFile: pdfPath];
188185
break;
189186
}

StorageDataModel/COItem+JSON.m

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,6 @@ static id plistValueForValue(id aValue, COType aType)
167167

168168
// JSON-compatible plist -> COItem attribute value
169169

170-
/*
171-
* Returning the parsed value as a NSNumber rather a NSDecimalNumber to ensure
172-
* the rounding is the same than the serialized NSNumber object.
173-
*
174-
* Without this workaround, 123.456789012 roundtrip doesn't succeed on 10.7 (see
175-
* -testJSONDoubleEquality in TestItem.m)).
176-
*
177-
* For 123.456789012, NSJSONSerialization returns a NSDecimalNumber, but the
178-
* rounding doesn't produce the same internal representation than a NSNumber
179-
* initialized with the same double value.
180-
*/
181-
static inline NSNumber *basicNumberFromDecimalNumber(NSNumber *aValue)
182-
{
183-
return @(aValue.description.doubleValue);
184-
}
185-
186170
static id valueForPrimitivePlistValue(id aValue, COType aType)
187171
{
188172
if (aValue == [NSNull null])
@@ -195,7 +179,7 @@ static id valueForPrimitivePlistValue(id aValue, COType aType)
195179
case kCOTypeInt64:
196180
return aValue;
197181
case kCOTypeDouble:
198-
return basicNumberFromDecimalNumber(aValue);
182+
return aValue;
199183
case kCOTypeString:
200184
return aValue;
201185
case kCOTypeAttachment:

Tests/StorageDataModel/TestItem.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,13 @@ - (void)testJSONDoubleEquality
8282
NSNumber *newValueFromDesc = @(roundTripValue.description.doubleValue);
8383

8484
#ifndef GNUSTEP
85-
// NOTE: Doesn't matter on GNUstep since newValue is not a NSDecimalNumber,
86-
// and we don't have to convert it into a NSDoubleNumber (unlike on 10.7).
85+
// NOTE: Doesn't matter on GNUstep since newValue is not a NSDecimalNumber.
8786
UKTrue([[NSDecimalNumber defaultBehavior] scale] == NSDecimalNoScale);
8887
#endif
8988

9089
NSLog(@"Double representation in JSON: %@",
9190
[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]);
9291

93-
/* Rounding is visible in the ouput for numbers that contain more than two
94-
decimals on 10.7 (e.g. 123.45 output is the same for all numbers). */
9592
NSLog(@"value doubleValue: %.20f, description: %@, class: %@",
9693
value.doubleValue, value, [value class]);
9794
NSLog(@"decimalValue doubleValue: %.20f, description: %@, class: %@",

Tests/TestCommon.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ - (instancetype)init
9191
- (void)dealloc
9292
{
9393
#ifdef DELETE_STORE_AFTER_EACH_TEST_METHOD
94-
// FIXME: For Mac OS X 10.7, this is unsupported, SQLite disk errors
95-
// (DB Error: 10 "disk I/O error") appear in TestStoreSQLite.m.
9694
[[self class] deleteStores];
9795
#endif
9896
}

Undo/COUndoTrackStore+Private.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
@class FMDatabase;
1212
@class ETUUID;
1313

14-
NSString *const COUndoTrackStoreTrackDidChangeNotification;
14+
extern NSString *const COUndoTrackStoreTrackDidChangeNotification;
1515

1616
// User info keys for COUndoTrackStoreTrackDidChangeNotification
17-
NSString *const COUndoTrackStoreTrackName;
17+
extern NSString *const COUndoTrackStoreTrackName;
1818
/**
1919
* UUID string
2020
*/
21-
NSString *const COUndoTrackStoreTrackHeadCommandUUID;
21+
extern NSString *const COUndoTrackStoreTrackHeadCommandUUID;
2222
/**
2323
* NSNull or UUID string
2424
*/
25-
NSString *const COUndoTrackStoreTrackCurrentCommandUUID;
25+
extern NSString *const COUndoTrackStoreTrackCurrentCommandUUID;
2626
/**
2727
* NSNumber boolean
2828
*/
29-
NSString *const COUndoTrackStoreTrackCompacted;
29+
extern NSString *const COUndoTrackStoreTrackCompacted;
3030

3131
@interface COUndoTrackSerializedCommand : NSObject
3232

0 commit comments

Comments
 (0)