Skip to content

Commit

Permalink
#49 minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Tae Won Ha committed Jun 28, 2014
1 parent b1bcfcb commit 3c1e5d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions VimR/VRFileItemOperation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ - (void)traverse {

CANCEL_OR_WAIT()
NSMutableArray *fileItemsToAdd = [[NSMutableArray alloc] initWithCapacity:childrenOfCurrentItem.count];
BOOL enumerationComplete =
BOOL operationCancelled =
[self chunkEnumerateArray:childrenOfCurrentItem usingBlockOnChunks:^(size_t beginIndex, size_t endIndex) {
for (size_t i = beginIndex; i <= endIndex; i++) {
VRFileItem *item = childrenOfCurrentItem[i];
Expand All @@ -151,7 +151,7 @@ - (void)traverse {
}
}];

if (!enumerationComplete) {
if (!operationCancelled) {
return;
}

Expand Down Expand Up @@ -189,7 +189,7 @@ - (void)cacheDirectDescendants:(__weak VRFileItem *)item {
}
}

- (BOOL)addAllToUrlsForTargetUrl:(NSArray *)items {
- (BOOL)addAllToUrlsForTargetUrl:(__weak NSArray *)items {
__block BOOL added = NO;

BOOL enumerationComplete = [self chunkEnumerateArray:items usingBlockOnChunks:^(size_t beginIndex, size_t endIndex) {
Expand Down Expand Up @@ -221,7 +221,7 @@ - (BOOL)addAllToUrlsForTargetUrl:(NSArray *)items {
* shouldStopBeforeChunk() is called before each chunk execution and if it returns YES, we stop and return NO, ie
* the enumeration was not complete, but was cancelled.
*/
- (BOOL)chunkEnumerateArray:(NSArray *)array
- (BOOL)chunkEnumerateArray:(__weak NSArray *)array
usingBlockOnChunks:(void (^)(size_t beginIndex, size_t endIndex))blockOnChunks {

std::vector<std::pair<size_t, size_t>> chunkedIndexes = chunked_indexes(array.count, qArrayChunkSize);
Expand Down

0 comments on commit 3c1e5d8

Please sign in to comment.