diff options
author | Ben Straub <bs@github.com> | 2014-01-08 22:31:29 +0400 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2014-01-10 03:07:37 +0400 |
commit | 9165ae30d4cff10681b5b65f094d0d4320426b6e (patch) | |
tree | 0060736b5eb2a1d6a50a04f7b926a9beedfd3b59 /LibGit2Sharp/Core/Handles | |
parent | dce1367264ac8c5ba6df22080cac1e22100a8c75 (diff) |
Introduce marshaling extension to IntPtr
Diffstat (limited to 'LibGit2Sharp/Core/Handles')
5 files changed, 5 insertions, 5 deletions
diff --git a/LibGit2Sharp/Core/Handles/GitConfigEntryHandle.cs b/LibGit2Sharp/Core/Handles/GitConfigEntryHandle.cs index c5ac71de..5d9d4a2b 100644 --- a/LibGit2Sharp/Core/Handles/GitConfigEntryHandle.cs +++ b/LibGit2Sharp/Core/Handles/GitConfigEntryHandle.cs @@ -6,7 +6,7 @@ namespace LibGit2Sharp.Core.Handles { public GitConfigEntry MarshalAsGitConfigEntry() { - return (GitConfigEntry)Marshal.PtrToStructure(handle, typeof(GitConfigEntry)); + return handle.MarshalAs<GitConfigEntry>(); } } } diff --git a/LibGit2Sharp/Core/Handles/GitErrorSafeHandle.cs b/LibGit2Sharp/Core/Handles/GitErrorSafeHandle.cs index 673b2187..8ae8c3c8 100644 --- a/LibGit2Sharp/Core/Handles/GitErrorSafeHandle.cs +++ b/LibGit2Sharp/Core/Handles/GitErrorSafeHandle.cs @@ -15,7 +15,7 @@ namespace LibGit2Sharp.Core.Handles return null; } - return (GitError)Marshal.PtrToStructure(handle, typeof(GitError)); + return handle.MarshalAs<GitError>(); } } } diff --git a/LibGit2Sharp/Core/Handles/IndexEntrySafeHandle.cs b/LibGit2Sharp/Core/Handles/IndexEntrySafeHandle.cs index 5f530194..87e0f1dc 100644 --- a/LibGit2Sharp/Core/Handles/IndexEntrySafeHandle.cs +++ b/LibGit2Sharp/Core/Handles/IndexEntrySafeHandle.cs @@ -6,7 +6,7 @@ namespace LibGit2Sharp.Core.Handles { public GitIndexEntry MarshalAsGitIndexEntry() { - return (GitIndexEntry)Marshal.PtrToStructure(handle, typeof(GitIndexEntry)); + return handle.MarshalAs<GitIndexEntry>(); } } } diff --git a/LibGit2Sharp/Core/Handles/OidSafeHandle.cs b/LibGit2Sharp/Core/Handles/OidSafeHandle.cs index bc3ce6a7..9b806aab 100644 --- a/LibGit2Sharp/Core/Handles/OidSafeHandle.cs +++ b/LibGit2Sharp/Core/Handles/OidSafeHandle.cs @@ -6,7 +6,7 @@ namespace LibGit2Sharp.Core.Handles { private GitOid? MarshalAsGitOid() { - return IsInvalid ? null : (GitOid?)Marshal.PtrToStructure(handle, typeof(GitOid)); + return IsInvalid ? null : (GitOid?)handle.MarshalAs<GitOid>(); } public ObjectId MarshalAsObjectId() diff --git a/LibGit2Sharp/Core/Handles/StatusEntrySafeHandle.cs b/LibGit2Sharp/Core/Handles/StatusEntrySafeHandle.cs index ef843352..0a85125f 100644 --- a/LibGit2Sharp/Core/Handles/StatusEntrySafeHandle.cs +++ b/LibGit2Sharp/Core/Handles/StatusEntrySafeHandle.cs @@ -21,7 +21,7 @@ namespace LibGit2Sharp.Core.Handles public GitStatusEntry MarshalAsGitStatusEntry() { - return (GitStatusEntry)Marshal.PtrToStructure(handle, typeof(GitStatusEntry)); + return handle.MarshalAs<GitStatusEntry>(); } } } |