Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Betts <paul@paulbetts.org>2012-01-31 10:41:01 +0400
committernulltoken <emeric.fermas@gmail.com>2012-02-02 02:50:19 +0400
commite32dba45b0edc7283833d2daad19a5ccc6a6452c (patch)
treee9f70ad5576ca825a525d3ddc04d122089d2208b /LibGit2Sharp/Signature.cs
parent9196a4823cb75dea011a97b4f1b5a12b9d3c041b (diff)
Strings in structures are being marshalled as ASCII, Hack fix it
Diffstat (limited to 'LibGit2Sharp/Signature.cs')
-rw-r--r--LibGit2Sharp/Signature.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/LibGit2Sharp/Signature.cs b/LibGit2Sharp/Signature.cs
index 32075609..342c6ee4 100644
--- a/LibGit2Sharp/Signature.cs
+++ b/LibGit2Sharp/Signature.cs
@@ -13,13 +13,17 @@ namespace LibGit2Sharp
private readonly string name;
private readonly string email;
+ private static readonly Utf8Marshaler marshaler = new Utf8Marshaler();
+
internal Signature(IntPtr signaturePtr)
{
var handle = new GitSignature();
Marshal.PtrToStructure(signaturePtr, handle);
- name = handle.Name;
- email = handle.Email;
+ // 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);
when = Epoch.ToDateTimeOffset(handle.When.Time, handle.When.Offset);
}