Skip to content

Commit

Permalink
updated project settings, added non-attribution option, fixed atomic/…
Browse files Browse the repository at this point in the history
…synthesized warnings for three properties
  • Loading branch information
Philip Dow committed Dec 6, 2011
1 parent 8932320 commit 272d9ad
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 108 deletions.
6 changes: 3 additions & 3 deletions SPSearchStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// Basically, you can use the code in your free, commercial, private and public projects
// as long as you include the above notice and attribute the code to Philip Dow / Sprouted
// If you use this code in an app send me a note. I'd love to know how the code is used.
/*
For non-attribution licensing options refer to http://phildow.net/licensing/
*/

#import <Cocoa/Cocoa.h>
#import <CoreServices/CoreServices.h>
Expand Down
75 changes: 52 additions & 23 deletions SPSearchStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// Basically, you can use the code in your free, commercial, private and public projects
// as long as you include the above notice and attribute the code to Philip Dow / Sprouted
// If you use this code in an app send me a note. I'd love to know how the code is used.
/*
For non-attribution licensing options refer to http://phildow.net/licensing/
*/

#import "SPSearchStore.h"

Expand Down Expand Up @@ -118,7 +118,6 @@ - (BOOL) _compactIndex;
@implementation SPSearchStore

@synthesize searchIndex;
@synthesize storeData;
@synthesize storeURL;

@synthesize writeLock;
Expand All @@ -128,8 +127,6 @@ @implementation SPSearchStore
@synthesize analysisOptions;
@synthesize stopWords;

@synthesize usesSpotlightImporters;
@synthesize usesConcurrentIndexing;
@synthesize ignoresNumericTerms;

@synthesize fetchCount;
Expand Down Expand Up @@ -254,29 +251,61 @@ - (void) dealloc {
#pragma mark -

- (void) setUsesSpotlightImporters:(BOOL)useSpotlight {
usesSpotlightImporters = useSpotlight;
@synchronized(self) {
usesSpotlightImporters = useSpotlight;

if ( useSpotlight ) SKLoadDefaultExtractorPlugIns();
}
}

if ( useSpotlight ) SKLoadDefaultExtractorPlugIns();
- (BOOL) usesSpotlightImporters {
BOOL uses;
@synchronized(self) {
uses = usesSpotlightImporters;
}
return uses;
}

- (void) setUsesConcurrentIndexing:(BOOL)useConcurrent {
usesConcurrentIndexing = useConcurrent;

if ( useConcurrent && indexQue == nil ) {
indexQue = [[NSOperationQueue alloc] init];
[indexQue setMaxConcurrentOperationCount:1];
// we lock around calls to the index, so there is no point
// in supporting more than one operation simultaneously
}
else if ( !useConcurrent && indexQue != nil ) {
[indexQue cancelAllOperations];
[indexQue release], indexQue = nil;
}
@synchronized(self) {
usesConcurrentIndexing = useConcurrent;

if ( useConcurrent && indexQue == nil ) {
indexQue = [[NSOperationQueue alloc] init];
[indexQue setMaxConcurrentOperationCount:1];
// we lock around calls to the index, so there is no point
// in supporting more than one operation simultaneously
}
else if ( !useConcurrent && indexQue != nil ) {
[indexQue cancelAllOperations];
[indexQue release], indexQue = nil;
}
}
}

- (BOOL) usesConcurrentIndexing {
BOOL uses;
@synchronized(self) {
uses = usesConcurrentIndexing;
}
return uses;
}

- (void) setStoreData:(NSMutableData *)inData {
@synchronized(self) {
[inData retain];
[storeData release];
storeData = inData;
}
}

- (NSMutableData *) storeData {
[self _flushIndexIfNecessary];
return storeData;
NSMutableData *data = nil;
@synchronized(self) {
[self _flushIndexIfNecessary];
data = [[storeData retain] autorelease];
}
return data;
}

#pragma mark -
Expand Down Expand Up @@ -940,7 +969,7 @@ - (NSArray*) allTerms {

CFStringRef aTerm = SKIndexCopyTermStringForTermID( searchIndex, aTermID );
if ( aTerm == NULL ) {
NSLog(@"%s - unable to get term for term index %i", __PRETTY_FUNCTION__, aTermID);
NSLog(@"%s - unable to get term for term index %ld", __PRETTY_FUNCTION__, aTermID);
continue;
}

Expand Down
53 changes: 27 additions & 26 deletions SPSearchStore.xcodeproj/philipdow.mode1v3
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>5</integer>
<integer>4</integer>
<integer>2</integer>
<integer>0</integer>
</array>
Expand Down Expand Up @@ -317,28 +317,28 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20306471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>SPSearchStore.h</string>
<string>SPSearchStoreAppDelegate.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CE0B20406471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>SPSearchStore.h</string>
<string>SPSearchStoreAppDelegate.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>729EA421146AF8DB005C9273</string>
<string>72CD85EC148D501500A6CCF2</string>
<key>history</key>
<array>
<string>72F4C6B5139FED21008B8E9D</string>
<string>72F4C739139FF650008B8E9D</string>
<string>72F4C74E139FFA3B008B8E9D</string>
<string>72F4C7DF13A02B88008B8E9D</string>
<string>72F4C7E113A02B88008B8E9D</string>
<string>72920A7F13A1BBD6001C4D52</string>
<string>72CAE2921469EACA004CBFE3</string>
<string>72CD85E8148D3AB200A6CCF2</string>
<string>72CD85E9148D3AB200A6CCF2</string>
<string>72CD85EA148D3AB200A6CCF2</string>
</array>
</dict>
<key>SplitCount</key>
Expand All @@ -350,14 +350,14 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {905, 431}}</string>
<string>{{0, 0}, {905, 417}}</string>
<key>RubberWindowFrame</key>
<string>66 82 1178 676 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>431pt</string>
<string>417pt</string>
</dict>
<dict>
<key>ContentConfiguration</key>
Expand All @@ -370,14 +370,14 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 436}, {905, 199}}</string>
<string>{{0, 422}, {905, 213}}</string>
<key>RubberWindowFrame</key>
<string>66 82 1178 676 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
<key>Proportion</key>
<string>199pt</string>
<string>213pt</string>
</dict>
</array>
<key>Proportion</key>
Expand All @@ -396,9 +396,9 @@
</array>
<key>TableOfContents</key>
<array>
<string>729EA422146AF8DB005C9273</string>
<string>72CD85DF148D2C2F00A6CCF2</string>
<string>1CE0B1FE06471DED0097A5F4</string>
<string>729EA423146AF8DB005C9273</string>
<string>72CD85E0148D2C2F00A6CCF2</string>
<string>1CE0B20306471E060097A5F4</string>
<string>1CE0B20506471E060097A5F4</string>
</array>
Expand Down Expand Up @@ -536,6 +536,7 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>1CD10A99069EF8BA00B06720</string>
<string>72F4BBCC139D2AB0008B8E9D</string>
<string>/Users/philipdow/Projects/~Shared Code/SPSearchStore/SPSearchStore.xcodeproj</string>
</array>
Expand Down Expand Up @@ -617,7 +618,7 @@
<key>TableOfContents</key>
<array>
<string>72F4BBCC139D2AB0008B8E9D</string>
<string>729EA424146AF8DB005C9273</string>
<string>72CD85E1148D2C2F00A6CCF2</string>
<string>1CD0528F0623707200166675</string>
<string>XCMainBuildResultsModuleGUID</string>
</array>
Expand Down Expand Up @@ -661,8 +662,8 @@
<string>yes</string>
<key>sizes</key>
<array>
<string>{{0, 0}, {475, 269}}</string>
<string>{{475, 0}, {568, 269}}</string>
<string>{{0, 0}, {476, 288}}</string>
<string>{{476, 0}, {567, 288}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
Expand All @@ -677,8 +678,8 @@
<string>yes</string>
<key>sizes</key>
<array>
<string>{{0, 0}, {1043, 269}}</string>
<string>{{0, 269}, {1043, 286}}</string>
<string>{{0, 0}, {1043, 288}}</string>
<string>{{0, 288}, {1043, 267}}</string>
</array>
</dict>
</dict>
Expand Down Expand Up @@ -708,10 +709,10 @@
<string>Value</string>
<real>132</real>
<string>Summary</string>
<real>206</real>
<real>205</real>
</array>
<key>Frame</key>
<string>{{475, 0}, {568, 269}}</string>
<string>{{476, 0}, {567, 288}}</string>
<key>RubberWindowFrame</key>
<string>159 143 1043 596 0 0 1280 778 </string>
</dict>
Expand Down Expand Up @@ -739,13 +740,13 @@
<key>TableOfContents</key>
<array>
<string>1CD10A99069EF8BA00B06720</string>
<string>72F4BC99139D447D008B8E9D</string>
<string>72CD85E2148D2C2F00A6CCF2</string>
<string>1C162984064C10D400B95A72</string>
<string>72F4BC9A139D447D008B8E9D</string>
<string>72F4BC9B139D447D008B8E9D</string>
<string>72F4BC9C139D447D008B8E9D</string>
<string>72F4BC9D139D447D008B8E9D</string>
<string>72F4BC9E139D447D008B8E9D</string>
<string>72CD85E3148D2C2F00A6CCF2</string>
<string>72CD85E4148D2C2F00A6CCF2</string>
<string>72CD85E5148D2C2F00A6CCF2</string>
<string>72CD85E6148D2C2F00A6CCF2</string>
<string>72CD85E7148D2C2F00A6CCF2</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debugV3</string>
Expand Down
Loading

0 comments on commit 272d9ad

Please sign in to comment.