(MappedViewExtension.GetPointer): use supplied offset argument.

This commit is contained in:
morkt 2014-08-01 20:11:32 +04:00
parent b7505b1f86
commit 7a6c5d8054

View File

@ -99,7 +99,7 @@ namespace GameRes
unsafe public static byte* GetPointer (this MemoryMappedViewAccessor view, long offset) unsafe public static byte* GetPointer (this MemoryMappedViewAccessor view, long offset)
{ {
var num = view.PointerOffset % info.dwAllocationGranularity; var num = offset % info.dwAllocationGranularity;
byte* ptr = null; byte* ptr = null;
view.SafeMemoryMappedViewHandle.AcquirePointer (ref ptr); view.SafeMemoryMappedViewHandle.AcquirePointer (ref ptr);
ptr += num; ptr += num;
@ -243,8 +243,9 @@ namespace GameRes
size = (uint)ArcView.PageSize; size = (uint)ArcView.PageSize;
if (size > m_arc.MaxOffset-offset) if (size > m_arc.MaxOffset-offset)
size = (uint)(m_arc.MaxOffset-offset); size = (uint)(m_arc.MaxOffset-offset);
m_view.Dispose(); var old_view = m_view;
m_view = m_arc.CreateViewAccessor (offset, size); m_view = m_arc.CreateViewAccessor (offset, size);
old_view.Dispose();
m_offset = offset; m_offset = offset;
m_size = size; m_size = size;
} }