From c9e1e11ce78f9bcce39edb162cae88b7a3b572cb Mon Sep 17 00:00:00 2001 From: Peter <> Date: Fri, 2 Aug 2019 20:07:59 +0300 Subject: [PATCH] Fix GenerateLocalization for Swift 4.2 --- tools/GenerateLocalization.swift | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/GenerateLocalization.swift b/tools/GenerateLocalization.swift index 489484976a..1fd0c49eff 100644 --- a/tools/GenerateLocalization.swift +++ b/tools/GenerateLocalization.swift @@ -186,12 +186,10 @@ final class WriteBuffer { } func append(_ value: Int32) { - let ptr = self.data.count - self.data.count += 4 - self.data.withUnsafeMutableBytes { (bytes: UnsafeMutablePointer) -> Void in - var value = value - memcpy(bytes.advanced(by: ptr), &value, 4) - } + var value = value + withUnsafePointer(to: &value, { (pointer: UnsafePointer) -> Void in + self.data.append(UnsafeRawPointer(pointer).assumingMemoryBound(to: UInt8.self), count: 4) + }) } func append(_ string: String) {