Skip to content

Commit

Permalink
Resolve most compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouke committed Nov 19, 2017
1 parent 9e42769 commit a93dfc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions Sources/HAP/Base/CharacteristicValueType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ extension Float: CharacteristicValueType {
extension Data: CharacteristicValueType, JSONValueTypeConvertible {
public init?(value: Any) {
fatalError("How does deserialization of Data work?")
guard let data = value as? Data else {
return nil
}
self = data
}
static public let format = CharacteristicFormat.data
public var jsonValueType: JSONValueType {
Expand Down
6 changes: 3 additions & 3 deletions Sources/HAP/Utils/Data+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ extension Data {
extension Data {
init?(hex: String) {
var result = [UInt8]()
var from = hex.characters.startIndex
while from < hex.characters.endIndex {
guard let to = hex.characters.index(from, offsetBy: 2, limitedBy: hex.characters.endIndex) else {
var from = hex.startIndex
while from < hex.endIndex {
guard let to = hex.index(from, offsetBy: 2, limitedBy: hex.endIndex) else {
return nil
}
guard let num = UInt8(hex[from..<to], radix: 16) else {
Expand Down

0 comments on commit a93dfc9

Please sign in to comment.