<html><head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head><body bgcolor="#FFFFFF" text="#000000">Thanks for the pointers. 
Good reading, but I'm still confused. I think that the first issue is 
clear to me now, but I don't know what I have to do to make the closure 
be seen as satisfying the type of the function pointer. It worked in 
Swift 2.2 as<br>
<br>
            XML_SetEndElementHandler(parser) { (userData: 
UnsafeMutablePointer&lt;Void&gt;, name: UnsafePointer&lt;XML_Char&gt;) 
-&gt; Void in<br>
<br>
<span>

</span>All that's changed is making the UnsafeMutablePointer&lt;Void&gt;
 into UnsafeMutableRawPointer, unless it's the unwrapped nature of the 
parameter in the error message:<br>
<br>
Cannot convert value of type '(UnsafeMutableRawPointer, 
UnsafePointer&lt;XML_Char&gt;) -&gt; Void' to expected argument type 
'XML_EndElementHandler!'
<br>
<br>
I don't know what I need to do next. Any help is much appreciated.<br>
<blockquote style="border: 0px none;" 
cite="mid:63E963C6-70EB-4F57-9A2B-8FFFE856FAB4@apple.com" type="cite">
  <div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div 
style="width:100%;border-top:2px solid #EDF1F4;padding-top:10px;">   <div
 
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%;">
           <a moz-do-not-send="true" href="mailto:swift-users@swift.org" 
style="color:#485664 
!important;padding-right:6px;font-weight:500;text-decoration:none 
!important;">Quinn "The Eskimo!" via swift-users</a></div>   <div 
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:
 right;">     <font color="#909AA4"><span style="padding-left:6px">28 
September 2016 at 11:26</span></font></div>    </div></div>
  <div style="color:#909AA4;margin-left:24px;margin-right:24px;" 
__pbrmquotes="true" class="__pbConvBody"><div><!----><br>I recommend 
reading the whole “Migrating to Swift 2.3 or Swift 3 from Swift 2.2” 
doc, but for this specific issue you should start with the 
“UnsafeRawPointer Migration” doc that it links to.<br><br><a class="moz-txt-link-rfc2396E" href="https://swift.org/migration-guide/">&lt;https://swift.org/migration-guide/&gt;</a><br><br><a class="moz-txt-link-rfc2396E" href="https://swift.org/migration-guide/se-0107-migrate.html">&lt;https://swift.org/migration-guide/se-0107-migrate.html&gt;</a><br><br>Share
 and Enjoy<br>--<br>Quinn "The Eskimo!"                    
<a class="moz-txt-link-rfc2396E" href="http://www.apple.com/developer/">&lt;http://www.apple.com/developer/&gt;</a><br>Apple Developer Relations, 
Developer Technical Support, Core OS/Hardware<br><br><br>_______________________________________________<br>swift-users
 mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:swift-users@swift.org">swift-users@swift.org</a><br><a class="moz-txt-link-freetext" href="https://lists.swift.org/mailman/listinfo/swift-users">https://lists.swift.org/mailman/listinfo/swift-users</a><br></div></div>
  <div style="margin:30px 25px 10px 25px;" class="__pbConvHr"><div 
style="width:100%;border-top:2px solid #EDF1F4;padding-top:10px;">   <div
 
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:49%;">
           <a moz-do-not-send="true" href="mailto:john_brownie@sil.org" 
style="color:#485664 
!important;padding-right:6px;font-weight:500;text-decoration:none 
!important;">John Brownie</a></div>   <div 
style="display:inline-block;white-space:nowrap;vertical-align:middle;width:48%;text-align:
 right;">     <font color="#909AA4"><span style="padding-left:6px">28 
September 2016 at 9:29</span></font></div>    </div></div>
  <div style="color:#909AA4;margin-left:24px;margin-right:24px;" 
__pbrmquotes="true" class="__pbConvBody">I have a Swift wrapper for the 
expat XML parser, and I just went through 
the update to Swift 3, and I'm thrown a series of errors that mostly 
appear to be of two types. Here is a representative function of the 
first type:
<br>
<br>    func parse() throws {
<br>        var done = false
<br>        while !done {
<br>            let buffer: UnsafeMutablePointer&lt;Void&gt; = 
XML_GetBuffer(parser, Int32(bufsize))
<br>            if buffer == nil {
<br>                let errorCode = XML_GetErrorCode(parser)
<br>                throw ExpatError(reason: "Error \(errorCode), 
\(XML_ErrorString(errorCode))")
<br>            }
<br>            let bytesRead = 
readData(UnsafeMutablePointer&lt;UInt8&gt;(buffer), bufferLength: 
bufsize)
<br>            done = bytesRead &lt; bufsize
<br>            if XML_ParseBuffer(parser, Int32(bytesRead), Int32(done ?
 1 
: 0)) != XML_STATUS_OK {
<br>                let errorCode = XML_GetErrorCode(parser)
<br>                throw ExpatError(reason: "Error \(errorCode), 
\(XML_ErrorString(errorCode))")
<br>            }
<br>        }
<br>    }
<br>
<br>Xcode 8's migrator changed the declaration of buffer to 
UnsafeMutableRawPointer?, but the readData call gives an error:
<br>
<br>Cannot invoke initializer for type 
'UnsafeMutablePointer&lt;UInt8&gt;' with an 
argument list of type '(UnsafeMutableRawPointer?)'
<br>Pointer conversion restricted: use '.assumingMemoryBound(to:)' or 
'.bindMemory(to:capacity:)' to view memory as a type.
<br>Overloads for 'UnsafeMutablePointer&lt;UInt8&gt;' exist with these 
partially 
matching parameter lists: (RawPointer), (OpaquePointer), 
(OpaquePointer?), (UnsafeMutablePointer&lt;Pointee&gt;), 
(UnsafeMutablePointer&lt;Pointee&gt;?)
<br>
<br>Where can I read up on how to make the conversion? My initial effort
 is:
<br>
<br>            let bytesRead = readData(buffer!.bindMemory(to: 
UInt8.self, 
capacity: bufsize), bufferLength: bufsize)
<br>
<br>That's more or less thrashing around with no real understanding.
<br>
<br>The second type is turning a closure into the appropriate C function
 
pointer. For example:
<br>
<br>            XML_SetEndElementHandler(parser) { (userData: 
UnsafeMutableRawPointer, name: UnsafePointer&lt;XML_Char&gt;) -&gt; Void
 in
<br>                let theParser = unsafeBitCast(userData, to: 
ExpatSwift.self)
<br>                let theName = ExpatSwift.getString(name)
<br>                theParser.endElement(theName)
<br>            }
<br>
<br>This gets an error:
<br>
<br>Cannot convert value of type '(UnsafeMutableRawPointer, 
UnsafePointer&lt;XML_Char&gt;) -&gt; Void' to expected argument type 
'XML_EndElementHandler!'
<br>
<br>XML_EndElementHandler is defined as:
<br>
<br>typedef void (XMLCALL *XML_EndElementHandler) (void *userData,
<br>                                               const XML_Char 
*name);
<br>
<br>Here I have no real clue as to how to fix it.
<br>
<br>So, any pointers to either how to fix these problems or to a good 
source 
to read to understand them?
<br>
<br>John
<br></div>
</blockquote>
<br>
<div class="moz-signature">-- <br>John Brownie<br>
In Finland on furlough from SIL Papua New Guinea<br>
</div>
</body></html>