From 598cc2743c4334e90961e8df7a25a5929838b7fa Mon Sep 17 00:00:00 2001 From: William Dillon Date: Tue, 20 Sep 2016 18:50:33 +0000 Subject: [PATCH] Type coersion for 32-bit platforms The result type of strlen changes with word size, but mysql_stmt_prepare's third argument is fixed as an unsigned long. This explicitly coerces the type to match. On 64-bit it's optimized away. --- Sources/MySQL/Connection.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/MySQL/Connection.swift b/Sources/MySQL/Connection.swift index 71fc39c7..971b245e 100644 --- a/Sources/MySQL/Connection.swift +++ b/Sources/MySQL/Connection.swift @@ -60,7 +60,7 @@ public final class Connection { // Prepares the created statement // This parses `?` in the query and // prepares them to attach parameterized bindings. - guard mysql_stmt_prepare(statement, query, strlen(query)) == 0 else { + guard mysql_stmt_prepare(statement, query, UInt(strlen(query))) == 0 else { throw Error.prepare(error) }