diff options
author | Keith Dahlby <dahlbyk@gmail.com> | 2012-06-08 18:16:47 +0400 |
---|---|---|
committer | Keith Dahlby <dahlbyk@gmail.com> | 2012-06-08 18:18:42 +0400 |
commit | 78eb071ae323c61b86d6fdc9fdbe9ac3b8eab6b8 (patch) | |
tree | f1300c0e02a7933f0c3f0d548847ddd561cf8825 /LibGit2Sharp/Signature.cs | |
parent | f23436b236902e86fbbaa807300fb725e89db4de (diff) |
Add Utf8Marshaler.FromManaged() and FromNative()
Diffstat (limited to 'LibGit2Sharp/Signature.cs')
-rw-r--r-- | LibGit2Sharp/Signature.cs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/LibGit2Sharp/Signature.cs b/LibGit2Sharp/Signature.cs index a4a9c0ef..629b445c 100644 --- a/LibGit2Sharp/Signature.cs +++ b/LibGit2Sharp/Signature.cs @@ -14,17 +14,13 @@ namespace LibGit2Sharp private readonly string name; private readonly string email; - private static readonly Utf8Marshaler marshaler = (Utf8Marshaler)Utf8Marshaler.GetInstance(string.Empty); - internal Signature(IntPtr signaturePtr) { var handle = new GitSignature(); Marshal.PtrToStructure(signaturePtr, handle); - // XXX: This is unbelievably hacky, but I can't get the - // Utf8Marshaller to work properly. - name = (string)marshaler.MarshalNativeToManaged(handle.Name); - email = (string)marshaler.MarshalNativeToManaged(handle.Email); + name = Utf8Marshaler.FromNative(handle.Name); + email = Utf8Marshaler.FromNative(handle.Email); when = Epoch.ToDateTimeOffset(handle.When.Time, handle.When.Offset); } |