Skip to content

Commit

Permalink
v1.4.3(70)
Browse files Browse the repository at this point in the history
bug fix
  • Loading branch information
lithium0003 committed Jul 21, 2020
1 parent f74c556 commit e149e3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions RemoteCloud/RemoteCloud/Storages/CryptCarotDAV.swift
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public class CryptCarotDAV: ChildStorage {
guard status == kCCSuccess else {
return ""
}
var encrypted = withUnsafePointer(to: &outBytes, { Data( buffer: UnsafeBufferPointer(start: $0, count: outLength)) })
var encrypted = Data(bytes: outBytes, count: outLength)
if encrypted.count >= BlockSizeByte * 2 {
let pos = encrypted.count - BlockSizeByte * 2
let cryptbuf1 = encrypted.subdata(in: pos..<pos+BlockSizeByte)
Expand Down Expand Up @@ -411,7 +411,7 @@ public class CryptCarotDAV: ChildStorage {
guard status == kCCSuccess else {
return nil
}
var cryptbuf1 = withUnsafePointer(to: &outBytes, { Data( buffer: UnsafeBufferPointer(start: $0, count: outLength)) })
var cryptbuf1 = Data(bytes: outBytes, count: outLength)
cryptbuf1.replaceSubrange(0..<lastblock.count, with: lastblock)
crypt = crypt.subdata(in: 0..<pos)
crypt.append(cryptbuf1)
Expand Down Expand Up @@ -441,7 +441,7 @@ public class CryptCarotDAV: ChildStorage {
guard status == kCCSuccess else {
return nil
}
let plain = withUnsafePointer(to: &outBytes, { Data( buffer: UnsafeBufferPointer(start: $0, count: outLength)) })
let plain = Data(bytes: outBytes, count: outLength)
return String(data: plain, encoding: .utf8)?.replacingOccurrences(of: "\0", with: "")
}

Expand Down Expand Up @@ -629,7 +629,7 @@ public class RemoteCryptCarotDAVStream: SlotStream {
guard status == kCCSuccess else {
return nil
}
return withUnsafePointer(to: &outBytes, { Data( buffer: UnsafeBufferPointer(start: $0, count: outLength)) })
return Data(bytes: outBytes, count: outLength)
}

override func subFillBuffer(pos1: Int64, onFinish: @escaping ()->Void) {
Expand Down
18 changes: 9 additions & 9 deletions RemoteCloud/RemoteCloud/SubItem/CueSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,28 +210,28 @@ class RemoteWaveFile {
var ret = Data()
ret += "RIFF".data(using: .ascii)!
var ChunkSize = UInt32(wavbytes + 36)
ret += withUnsafePointer(to: &ChunkSize, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &ChunkSize, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })
ret += "WAVE".data(using: .ascii)!

ret += "fmt ".data(using: .ascii)!
var SubChunk1Size = UInt32(16)
ret += withUnsafePointer(to: &SubChunk1Size, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &SubChunk1Size, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })
var AudioFormat = UInt16(1)
ret += withUnsafePointer(to: &AudioFormat, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &AudioFormat, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })
var NumChannels = UInt16(wavFormat.NumChannels)
ret += withUnsafePointer(to: &NumChannels, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &NumChannels, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })
var SampleRate = UInt32(wavFormat.SampleRate)
ret += withUnsafePointer(to: &SampleRate, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &SampleRate, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })
var ByteRate = UInt32(wavFormat.ByteRate)
ret += withUnsafePointer(to: &ByteRate, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &ByteRate, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })
var BlockAlign = UInt16(wavFormat.BlockAlign)
ret += withUnsafePointer(to: &BlockAlign, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &BlockAlign, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })
var BitsPerSample = UInt16(wavFormat.BitsPerSample)
ret += withUnsafePointer(to: &BitsPerSample, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &BitsPerSample, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })

ret += "data".data(using: .ascii)!
var SubChunk2Size = UInt32(wavbytes)
ret += withUnsafePointer(to: &SubChunk2Size, { Data( buffer: UnsafeBufferPointer(start: $0, count: 1)) })
withUnsafePointer(to: &SubChunk2Size, { ret.append(UnsafeBufferPointer(start: $0, count: 1)) })

return ret
}
Expand Down

0 comments on commit e149e3f

Please sign in to comment.