swift2.3からswift3.1へのコンバート
Xcode 8.3.3で以下のソースを変換してbuildしたところエラーが発生しました。
open func drChar(fieldNo : Int32, row : Int32, column : Int32, strBuf : [UInt8]?, useDirectChg : Int32) -> Int32 {
var retValue : Int32 = 0
if strBuf == nil {
retValue = drChar(fieldNo, row, column, nil, useDirectChg)
} else {
retValue = drChar(fieldNo, row, column, UnsafeMutablePointer<Int8>(strBuf!), useDirectChg)
}
return retValue
}
エラーの場所はUnsafeMutablePointer
で、エラーメッセージは
'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.
です。
どのように修正すればよいのでしょうか?
【追加】すみません。ヘッダー部分は以下です。
public func DrChar(_ iFldNo: Int32, _ iRow: Int32, _ iCol: Int32, _ strBuf: UnsafeMutablePointer<Int8>!, _ iDChg: Int32) -> Int32