Skip to content

Commit

Permalink
Removed extra blank lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Nov 22, 2020
1 parent b358ae9 commit b2a4be6
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions sources/Interop/Windows/winrt/wrl/client/ComPtr`1.Manual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public unsafe struct ComPtr<T> : IDisposable
public ComPtr(T* other)
{
ptr_ = other;

InternalAddRef();
}

Expand All @@ -34,7 +33,6 @@ public ComPtr(T* other)
public ComPtr(ComPtr<T> other)
{
ptr_ = other.ptr_;

InternalAddRef();
}

Expand Down Expand Up @@ -110,10 +108,8 @@ public void Attach(T* other)
if (ptr_ != null)
{
var @ref = ((IUnknown*)ptr_)->Release();

Debug.Assert((@ref != 0) || (ptr_ != other));
}

ptr_ = other;
}

Expand All @@ -123,9 +119,7 @@ public void Attach(T* other)
public T* Detach()
{
T* ptr = ptr_;

ptr_ = null;

return ptr;
}

Expand All @@ -135,9 +129,7 @@ public void Attach(T* other)
public readonly int CopyTo(T** ptr)
{
InternalAddRef();

*ptr = ptr_;

return S_OK;
}

Expand All @@ -147,9 +139,7 @@ public readonly int CopyTo(T** ptr)
public readonly int CopyTo(ComPtr<T>* p)
{
InternalAddRef();

*p->ReleaseAndGetAddressOf() = ptr_;

return S_OK;
}

Expand All @@ -159,12 +149,10 @@ public readonly int CopyTo(ComPtr<T>* p)
public readonly int CopyTo(ref ComPtr<T> other)
{
InternalAddRef();

fixed (ComPtr<T>* p = &other)
{
*p->ReleaseAndGetAddressOf() = ptr_;
}

return S_OK;
}

Expand Down Expand Up @@ -233,7 +221,6 @@ public readonly int CopyTo(Guid* riid, ref ComPtr<IUnknown> other)
public void Dispose()
{
T* pointer = ptr_;

if (pointer != null)
{
ptr_ = null;
Expand Down Expand Up @@ -277,7 +264,6 @@ public void Dispose()
public T** ReleaseAndGetAddressOf()
{
InternalRelease();

return GetAddressOf();
}

Expand All @@ -295,9 +281,7 @@ public uint Reset()
public void Swap(ComPtr<T>* r)
{
T* temp = ptr_;

ptr_ = r->ptr_;

r->ptr_ = temp;
}

Expand All @@ -307,17 +291,14 @@ public void Swap(ComPtr<T>* r)
public void Swap(ref ComPtr<T> other)
{
T* temp = ptr_;

ptr_ = other.ptr_;

other.ptr_ = temp;
}

// Increments the reference count for the current COM object, if any
private readonly void InternalAddRef()
{
T* pointer = ptr_;

if (pointer != null)
{
((IUnknown*)pointer)->AddRef();
Expand All @@ -328,16 +309,12 @@ private readonly void InternalAddRef()
private uint InternalRelease()
{
uint referenceCount = 0;

T* temp = ptr_;

if (temp != null)
{
ptr_ = null;

referenceCount = ((IUnknown*)temp)->Release();
}

return referenceCount;
}
}
Expand Down

0 comments on commit b2a4be6

Please sign in to comment.