Error and Warning Free Pure Swift 4
This commit is contained in:
parent
7fc78049d2
commit
6be85c4a95
@ -577,7 +577,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0830;
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0930;
|
||||
ORGANIZATIONNAME = "Kilian Hofmann";
|
||||
TargetAttributes = {
|
||||
E220BF9B1EFB22D400DF5A97 = {
|
||||
@ -793,6 +793,7 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
@ -800,6 +801,7 @@
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
@ -851,6 +853,7 @@
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
@ -858,6 +861,7 @@
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -54,7 +54,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -74,7 +73,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -26,7 +26,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -46,7 +45,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -26,7 +26,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -46,7 +45,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0900"
|
||||
LastUpgradeVersion = "0930"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -26,7 +26,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -46,7 +45,6 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
||||
@ -37,7 +37,7 @@ class FileOperations: NSObject {
|
||||
|
||||
static func log(data: String, toLog path: String) {
|
||||
let dataToWrite = encodeTimeStamp(stamp: data, threshold: "")
|
||||
let file: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: 3, alignedTo: 1)
|
||||
let file: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: 3, alignment: 1)
|
||||
file.storeBytes(of: dataToWrite, as: UInt32.self)
|
||||
do {
|
||||
let fileData: NSMutableData = try NSMutableData(contentsOf: URL(fileURLWithPath: path))
|
||||
@ -48,27 +48,27 @@ class FileOperations: NSObject {
|
||||
fileData.append(file, length: 3)
|
||||
fileData.write(to: URL(fileURLWithPath: path), atomically: true)
|
||||
}
|
||||
file.deallocate(bytes: 3, alignedTo: 1)
|
||||
file.deallocate()
|
||||
}
|
||||
|
||||
static func log(data: String, toData out: inout Data) {
|
||||
let dataToWrite = encodeTimeStamp(stamp: data, threshold: "")
|
||||
let file: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: 3, alignedTo: 1)
|
||||
let file: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: 3, alignment: 1)
|
||||
file.storeBytes(of: dataToWrite, as: UInt32.self)
|
||||
let fileData: NSMutableData = NSMutableData()
|
||||
fileData.append(file, length: 3)
|
||||
out.append(fileData as Data)
|
||||
file.deallocate(bytes: 3, alignedTo: 1)
|
||||
file.deallocate()
|
||||
}
|
||||
|
||||
static func load(log Data: NSData) -> [String]? {
|
||||
var returnString: [String] = []
|
||||
var i: Int = 0
|
||||
while i < Data.length {
|
||||
let data: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: 3, alignedTo: 1)
|
||||
let data: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: 3, alignment: 1)
|
||||
Data.getBytes(data, range: NSRange(location: i, length: 3))
|
||||
returnString.append("\(decodeTimestamp(stamp: data.load(as: UInt32.self)).0)\n")
|
||||
data.deallocate(bytes: 3, alignedTo: 1)
|
||||
data.deallocate()
|
||||
i += 3
|
||||
}
|
||||
if returnString.count > 0 {
|
||||
@ -181,29 +181,29 @@ class FileOperations: NSObject {
|
||||
let decodedSize: UInt8 = data.bytes.load(fromByteOffset: variableAdjust, as: UInt8.self)
|
||||
variableAdjust += 1
|
||||
|
||||
let retTimePtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: 3, alignedTo: 1)
|
||||
let retTimePtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: 3, alignment: 1)
|
||||
data.getBytes(retTimePtr, range: NSRange(location: variableAdjust, length: 3))
|
||||
variableAdjust += 3
|
||||
let encodedTime: UInt32 = retTimePtr.load(as: UInt32.self)
|
||||
retTimePtr.deallocate(bytes: 3, alignedTo: 1)
|
||||
retTimePtr.deallocate()
|
||||
|
||||
let decodedTimeStamp = decodeTimestamp(stamp: encodedTime).0
|
||||
let decodedThreshold = decodeTimestamp(stamp: encodedTime).1
|
||||
|
||||
let retPwrPtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: 4, alignedTo: 1)
|
||||
let retPwrPtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: 4, alignment: 1)
|
||||
data.getBytes(retPwrPtr, range: NSRange(location: variableAdjust, length: 4))
|
||||
var decodedPower: Any = retPwrPtr.load(as: Int32.self)
|
||||
retPwrPtr.deallocate(bytes: 4, alignedTo: 1)
|
||||
retPwrPtr.deallocate()
|
||||
if decodedPower as! Int32 == Int32.min {
|
||||
decodedPower = "-"
|
||||
}
|
||||
variableAdjust += 4
|
||||
|
||||
let retStringPtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: Int(decodedSize), alignedTo: 1)
|
||||
let retStringPtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: Int(decodedSize), alignment: 1)
|
||||
data.getBytes(retStringPtr, range: NSRange(location: variableAdjust, length: Int(decodedSize)))
|
||||
var retString: String = String(cString: retStringPtr.assumingMemoryBound(to: UInt8.self))
|
||||
retStringPtr.deallocate(bytes: Int(decodedSize), alignedTo: 1)
|
||||
retString = retString.substring(to: retString.index(retString.startIndex, offsetBy: Int(decodedSize)))
|
||||
retStringPtr.deallocate()
|
||||
retString = String(retString[..<retString.index(retString.startIndex, offsetBy: Int(decodedSize))])
|
||||
variableAdjust += Int(decodedSize)
|
||||
|
||||
guard decodedPower is Int32 else {
|
||||
@ -227,17 +227,17 @@ class FileOperations: NSObject {
|
||||
// 4 for Power
|
||||
// 1 for SNR
|
||||
|
||||
let retTimePtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: 3, alignedTo: 1)
|
||||
let retTimePtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: 3, alignment: 1)
|
||||
data.getBytes(retTimePtr, range: NSRange(location: variableAdjust, length: 3))
|
||||
variableAdjust += 3
|
||||
let encodedTime: UInt32 = retTimePtr.load(as: UInt32.self)
|
||||
|
||||
let decodedTimeStamp = decodeTimestamp(stamp: encodedTime).0
|
||||
|
||||
let retPwrPtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(bytes: 4, alignedTo: 1)
|
||||
let retPwrPtr: UnsafeMutableRawPointer = UnsafeMutableRawPointer.allocate(byteCount: 4, alignment: 1)
|
||||
data.getBytes(retPwrPtr, range: NSRange(location: variableAdjust, length: 4))
|
||||
var decodedPower: Any = retPwrPtr.load(as: Int32.self)
|
||||
retPwrPtr.deallocate(bytes: 4, alignedTo: 1)
|
||||
retPwrPtr.deallocate()
|
||||
if decodedPower as! Int32 == Int32.min {
|
||||
decodedPower = "-"
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ class FrequencyGraph: NSView {
|
||||
// Get offset
|
||||
offset = 0
|
||||
let time: String = data[point].components(separatedBy: ";")[0]
|
||||
let hour: Int = Int(time.substring(to: time.index(time.startIndex, offsetBy: 2)))!
|
||||
let hour: Int = Int(time[..<time.index(time.startIndex, offsetBy: 2)])!
|
||||
let tensSeconds: Int = Int((time as NSString).substring(with: NSMakeRange(6, 1)))!
|
||||
offset = ((hour*60 + Int((time as NSString).substring(with: NSMakeRange(3, 2)))!) * 6 + tensSeconds) * 2
|
||||
// Set offset
|
||||
@ -144,10 +144,10 @@ class FrequencyGraph: NSView {
|
||||
// Set connection loss zones
|
||||
for loss in lastLossIndex..<dataLoss.count {
|
||||
let time1: String = data[point].components(separatedBy: ";")[0]
|
||||
let hour1: Int = Int(time1.substring(to: time1.index(time1.startIndex, offsetBy: 2)))!
|
||||
let hour1: Int = Int(time1[..<time1.index(time1.startIndex, offsetBy: 2)])!
|
||||
let minute1: Int = Int((time1 as NSString).substring(with: NSMakeRange(3, 2)))!
|
||||
let time2: String = dataLoss[loss]
|
||||
let hour2: Int = Int(time2.substring(to: time2.index(time2.startIndex, offsetBy: 2)))!
|
||||
let hour2: Int = Int(time2[..<time2.index(time2.startIndex, offsetBy: 2)])!
|
||||
let minute2: Int = Int((time2 as NSString).substring(with: NSMakeRange(3, 2)))!
|
||||
|
||||
if hour1 < hour2 { break }
|
||||
|
||||
@ -30,7 +30,7 @@ class GraphLoadOperation: Operation {
|
||||
graph.data = FileOperations.loadUpstream(log: item.regularFileContents! as NSData)!
|
||||
}
|
||||
let keyString: String = item.filename!.components(separatedBy: " ")[1]
|
||||
graph.frequency = Double(keyString.substring(to: keyString.index(keyString.endIndex, offsetBy: -4)))! / 1000000
|
||||
graph.frequency = Double(keyString[..<keyString.index(keyString.endIndex, offsetBy: -4)])! / 1000000
|
||||
graph.initView(operation: self)
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>491</string>
|
||||
<string>493</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
version 2.1
|
||||
build 491
|
||||
build 493
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user