diff --git a/Foundation/NSArray.swift b/Foundation/NSArray.swift index 5a324afeb2..adac00a12c 100644 --- a/Foundation/NSArray.swift +++ b/Foundation/NSArray.swift @@ -705,7 +705,8 @@ public class NSMutableArray : NSArray { var objectIdx = 0 indexes.enumerateIndexesUsingBlock() { (insertionIndex, _) in - self.insertObject(objects[objectIdx++], atIndex: insertionIndex) + self.insertObject(objects[objectIdx], atIndex: insertionIndex) + objectIdx += 1 } } diff --git a/Foundation/NSCFDictionary.swift b/Foundation/NSCFDictionary.swift index 1e3580b0c9..1432b8903b 100644 --- a/Foundation/NSCFDictionary.swift +++ b/Foundation/NSCFDictionary.swift @@ -54,7 +54,9 @@ internal final class _NSCFDictionary : NSMutableDictionary { if index == count { return nil } else { - return keyArray[index++] + let item = keyArray[index] + index += 1 + return item } } @@ -139,7 +141,7 @@ internal func _CFSwiftDictionaryGetKeysAndValues(dictionary: AnyObject, keybuf: (dictionary as! NSDictionary).enumerateKeysAndObjectsUsingBlock { key, value, _ in keybuf[idx] = Unmanaged.passUnretained(key) valuebuf[idx] = Unmanaged.passUnretained(value) - idx++ + idx += 1 } } diff --git a/Foundation/NSCalendar.swift b/Foundation/NSCalendar.swift index f74c1a1310..4c8ab8af23 100644 --- a/Foundation/NSCalendar.swift +++ b/Foundation/NSCalendar.swift @@ -411,7 +411,7 @@ public class NSCalendar : NSObject, NSCopying, NSSecureCoding { private func _setComp(unitFlags: NSCalendarUnit, field: NSCalendarUnit, vector: [Int32], inout compIndex: Int, setter: (Int32) -> Void) { if unitFlags.contains(field) { setter(vector[compIndex]) - compIndex++ + compIndex += 1 } } diff --git a/Foundation/NSDictionary.swift b/Foundation/NSDictionary.swift index 462db3558b..e9d61ae449 100644 --- a/Foundation/NSDictionary.swift +++ b/Foundation/NSDictionary.swift @@ -22,7 +22,7 @@ extension Dictionary : _ObjectTypeBridgeable { let value = _NSObjectRepresentableBridge($0.1) keyBuffer.advancedBy(idx).initialize(key) valueBuffer.advancedBy(idx).initialize(value) - idx++ + idx += 1 } let dict = NSDictionary(objects: valueBuffer, forKeys: keyBuffer, count: count) diff --git a/Foundation/NSIndexSet.swift b/Foundation/NSIndexSet.swift index 5440dfdb4a..f9add53e1c 100644 --- a/Foundation/NSIndexSet.swift +++ b/Foundation/NSIndexSet.swift @@ -160,7 +160,7 @@ public class NSIndexSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding guard idx < NSNotFound else { return nil } - result++ + result += 1 } if let rangeIndex = _indexOfRangeAfterOrContainingIndex(result) { @@ -173,7 +173,7 @@ public class NSIndexSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding guard idx > 0 else { return nil } - result-- + result -= 1 } if let rangeIndex = _indexOfRangeBeforeOrContainingIndex(result) { @@ -229,12 +229,13 @@ public class NSIndexSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding } while idx <= maxIndex && counter < bufferSize && offset < currentRange.length { - indexBuffer.advancedBy(counter++).memory = idx - ++idx - ++offset + indexBuffer.advancedBy(counter).memory = idx + counter += 1 + idx += 1 + offset += 1 } if offset >= currentRange.length { - ++rangeIndex + rangeIndex += 1 offset = 0 } } @@ -266,7 +267,7 @@ public class NSIndexSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding return range.length } result = NSMaxRange(firstRange) - range.location - rangeIndex++ + rangeIndex += 1 } for curRange in _ranges.suffixFrom(rangeIndex) { @@ -518,7 +519,7 @@ public class NSMutableIndexSet : NSIndexSet { // overlaps if curEnd < nextEnd { self._replaceRangeAtIndex(rangeIndex, withRange: NSMakeRange(nextEnd - curRange.location, curRange.length)) - rangeIndex++ + rangeIndex += 1 } self._replaceRangeAtIndex(rangeIndex + 1, withRange: nil) } else { @@ -560,7 +561,7 @@ public class NSMutableIndexSet : NSIndexSet { // Proceed to merging break } - rangeIndex++ + rangeIndex += 1 } if let r = replacedRangeIndex { _mergeOverlappingRangesStartingAtIndex(r) @@ -602,7 +603,7 @@ public class NSMutableIndexSet : NSIndexSet { } else if range.location > curRange.location && range.location < curEnd && removeEnd >= curEnd { _replaceRangeAtIndex(rangeIndex, withRange: NSMakeRange(curRange.location, range.location - curRange.location)) } - rangeIndex++ + rangeIndex += 1 } } diff --git a/Foundation/NSPathUtilities.swift b/Foundation/NSPathUtilities.swift index e905593220..b2d170d95e 100644 --- a/Foundation/NSPathUtilities.swift +++ b/Foundation/NSPathUtilities.swift @@ -87,14 +87,14 @@ internal extension String { while curPos < endPos { while curPos < endPos && characterView[curPos] == "/" { - curPos++ + curPos = curPos.successor() } if curPos == endPos { break } var curEnd = curPos while curEnd < endPos && characterView[curEnd] != "/" { - curEnd++ + curEnd = curEnd.successor() } result.append(String(characterView[curPos ..< curEnd])) curPos = curEnd @@ -204,14 +204,14 @@ public extension NSString { while curPos < endPos { while curPos < endPos && characterView[curPos] == "/" { - curPos++ + curPos = curPos.successor() } if curPos == endPos { break } var curEnd = curPos while curEnd < endPos && characterView[curEnd] != "/" { - curEnd++ + curEnd = curEnd.successor() } result.append(String(characterView[curPos ..< curEnd])) curPos = curEnd diff --git a/Foundation/NSScanner.swift b/Foundation/NSScanner.swift index cfdfaeb658..c115772bf9 100644 --- a/Foundation/NSScanner.swift +++ b/Foundation/NSScanner.swift @@ -143,7 +143,8 @@ internal struct _NSStringBuffer { mutating func advance() { if bufferLoc < bufferLen { /*buffer is OK*/ - curChar = buffer[bufferLoc++] + curChar = buffer[bufferLoc] + bufferLoc += 1 } else if (_stringLoc + bufferLen < stringLen) { /* Buffer is empty but can be filled */ _stringLoc += bufferLen fill() @@ -155,7 +156,7 @@ internal struct _NSStringBuffer { mutating func rewind() { if bufferLoc > 1 { /* Buffer is OK */ - bufferLoc-- + bufferLoc -= 1 curChar = buffer[bufferLoc - 1] } else if _stringLoc > 0 { /* Buffer is empty but can be filled */ bufferLoc = min(32, _stringLoc) @@ -195,7 +196,8 @@ internal struct _NSStringBuffer { fill() } bufferLoc = newValue - _stringLoc - curChar = buffer[bufferLoc++] + curChar = buffer[bufferLoc] + bufferLoc += 1 } } } diff --git a/Foundation/NSString.swift b/Foundation/NSString.swift index 89d0bf9f6c..38ae5715e6 100644 --- a/Foundation/NSString.swift +++ b/Foundation/NSString.swift @@ -753,7 +753,7 @@ extension NSString { buf.rewind() if buf.currentCharacter == 0x0d { lineSeparatorLength = 2 - endOfContents-- + endOfContents -= 1 } } else { while true { @@ -938,15 +938,21 @@ extension NSString { let cfEncodings = CFStringGetListOfAvailableEncodings() var idx = 0 var numEncodings = 0 - while cfEncodings.advancedBy(idx++).memory != kCFStringEncodingInvalidId { - numEncodings++ + + while cfEncodings.advancedBy(idx).memory != kCFStringEncodingInvalidId { + idx += 1 + numEncodings += 1 } let theEncodingList = UnsafeMutablePointer.alloc(numEncodings + 1) theEncodingList.advancedBy(numEncodings).memory = 0 // Terminator - while --numEncodings >= 0 { + + numEncodings -= 1 + while numEncodings >= 0 { theEncodingList.advancedBy(numEncodings).memory = CFStringConvertEncodingToNSStringEncoding(cfEncodings.advancedBy(numEncodings).memory) + numEncodings -= 1 } + return UnsafePointer(theEncodingList) }() } @@ -1399,7 +1405,7 @@ extension String { var encodingArray = Array() while encodings.advancedBy(numEncodings).memory != CoreFoundation.kCFStringEncodingInvalidId { encodingArray.append(CFStringConvertEncodingToNSStringEncoding(encodings.advancedBy(numEncodings).memory)) - numEncodings++ + numEncodings += 1 } return encodingArray }