From ad49eb862ca0aefa1de43a1f8c9737575ffc9d69 Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Fri, 20 Apr 2018 09:26:04 +0900 Subject: [PATCH] Avoid a needless copy when copying strings from LiteCore to .NET --- src/LiteCore/src/LiteCore.Shared/Interop/C4Base.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/LiteCore/src/LiteCore.Shared/Interop/C4Base.cs b/src/LiteCore/src/LiteCore.Shared/Interop/C4Base.cs index fa191a235..6173e38f9 100644 --- a/src/LiteCore/src/LiteCore.Shared/Interop/C4Base.cs +++ b/src/LiteCore/src/LiteCore.Shared/Interop/C4Base.cs @@ -119,8 +119,7 @@ public string CreateString() return null; } - var bytes = ToArrayFast(); - return Encoding.UTF8.GetString(bytes, 0, bytes.Length); + return Encoding.UTF8.GetString((byte*) buf, (int) size); } public byte[] ToArrayFast()