diff options
author | yorah <yoram.harmelin@gmail.com> | 2012-08-29 20:05:47 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-08-29 22:14:31 +0400 |
commit | eb304fb0c92df60339836b962a96a3d43f48d7f7 (patch) | |
tree | b49ad08201406d354304010c5f17d241d1b99c3c /LibGit2Sharp/Blob.cs | |
parent | 8fa70ffce8bca7ff66fe4b84293d14b66bbed29f (diff) |
Make retrieval of error message thread-safe
Fix #203
Diffstat (limited to 'LibGit2Sharp/Blob.cs')
-rw-r--r-- | LibGit2Sharp/Blob.cs | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/LibGit2Sharp/Blob.cs b/LibGit2Sharp/Blob.cs index d818e415..83cd8dc7 100644 --- a/LibGit2Sharp/Blob.cs +++ b/LibGit2Sharp/Blob.cs @@ -1,6 +1,4 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; +using System.IO; using LibGit2Sharp.Core; using LibGit2Sharp.Core.Handles; @@ -37,12 +35,7 @@ namespace LibGit2Sharp { get { - using (var obj = new ObjectSafeWrapper(Id, repo)) - { - var arr = new byte[Size]; - Marshal.Copy(NativeMethods.git_blob_rawcontent(obj.ObjectPtr), arr, 0, Size); - return arr; - } + return Proxy.git_blob_rawcontent(repo.Handle, Id, Size); } } @@ -53,14 +46,7 @@ namespace LibGit2Sharp { get { - using (var obj = new ObjectSafeWrapper(Id, repo)) - { - IntPtr ptr = NativeMethods.git_blob_rawcontent(obj.ObjectPtr); - unsafe - { - return new UnmanagedMemoryStream((byte*)ptr.ToPointer(), Size); - } - } + return Proxy.git_blob_rawcontent_stream(repo.Handle, Id, Size); } } @@ -68,7 +54,7 @@ namespace LibGit2Sharp { var blob = new Blob(repo, id) { - Size = NativeMethods.git_blob_rawsize(obj) + Size = Proxy.git_blob_rawsize(obj) }; return blob; } |