Commit Graph

27 Commits (369b5206531846cef7e5140b1e9d1817da6026f3)

Author SHA1 Message Date
dahall 1564c3d702 Made SafeAllocatedMemoryHandle.GetBytes() public 2020-07-22 18:23:37 -06:00
dahall 091352956e Fixed (#152) bug in base class SafeMemoryHandleExt that caused ToString(int...) to fail if memory size was not specifically set (like in parameter assignment). 2020-07-20 10:44:01 -06:00
dahall e701d99c1b BREAKING CHANGE: Due to performance, changed IMemoryMethods and ISimpleMemoryMethods to contain method signatures instead of properties of method delegates. Then changed all derived memory classes to new interface definition. I believe most of this only affects internal classes so hopefully not a huge effect on your code. 2020-07-20 09:48:32 -06:00
dahall f67c02dc14 Added SafeAllocatedMemoryHandle.AsReadOnlySpan extension method and changed Span methods to use IntPtr extensions. 2020-05-16 08:56:21 -06:00
dahall ab42b87b0c Moved SafeAllocatedMemoryHandle.Dump back under DEBUG only build. Added AsSpan and AsBytes methods to SafeAllocatedMemoryHandle for frameworks supporting Span<T>. Added SafeMemoryHandleExt.AsRef<T> method for getting a Span of a structure from the memory. 2020-05-14 17:53:35 -06:00
dahall a59b4bfba7 Added ISimpleMemoryMethods (subset of IMemoryMethods with just alloc and free) and MemoryMethodsFromSimple<TSimple> which implements most of IMemoryMethods using just the methods from ISimpleMemoryMethods. 2020-04-07 14:34:28 -06:00
David Hall ce3dc1a0fe Removed blittable constraint on ToArray and ToEnumerable 2019-11-21 16:33:39 -07:00
David Hall a94e60820b Reworked memory manipulation functions in InteropExtensions and IntPtrConverter to use new marshaling directives and to drive consistency of use across libs (i.e. call same method to do same work). 2019-11-19 12:52:44 -07:00
David Hall 9ade2c8bd1 Added copy constructor to SafeMemoryHandle and consolidated initialization 2019-10-31 11:47:04 -06:00
David Hall bb3435550f Added SafeAllocatedMemoryHandle.TakeOwnership method to take control of the allocated memory. 2019-10-29 10:44:02 -06:00
David Hall 05bd6d2098 Changed Write method to take structure as 'in' param. 2019-10-17 09:13:45 -06:00
David Hall 740bd61ac5 Added ToString method that includes an offset parameter. 2019-09-27 13:32:19 -06:00
David Hall 1491e32f80 Made ISafeMemoryHandle derive from IDisposable 2019-09-19 12:22:21 -06:00
David Hall 9d4758ed5d Added Write methods to SafeMemoryHandleExt. Added size checking from InteropExtension methods. Added offset param to ToStructure. 2019-08-21 10:18:07 -06:00
David Hall c3521b7742 MAJOR BREAKING CHANGEs:
1) Obsoleted Vanara.Extensions.InteropExtensions.StructureToPtr for a name change to MarshalToPtr for consistency.
2) Added parameter to all methods reading memory that allows developer to indicate size of allocated memory they read from.
3) Enabled the ability to read/write enum values from memory in all extension methods.
4) Added Write methods for writing to memory
2019-08-17 21:13:57 -06:00
David Hall 683280a945 Updated constructors of all SafeAllocatedMemory derivatives to use SizeT instead of int for the size parameter. 2019-07-27 12:48:33 -06:00
David Hall 42630dd833 BREAKING CHANGE: Changed type of SafeAllocatedMemoryHandle.Size property from int to SizeT so that it more easily converts to different types used in memory size functions. 2019-07-25 19:46:45 -06:00
David Hall 0fef11ebb1 Made SafeMemoryHandle conversion to IntPtr implicit instead of explicit. In practice, I have found this to be a constant conversion need. 2019-07-25 10:48:43 -06:00
David Hall 9c97ccfd14 Fixed bug in GetBytes method 2019-04-24 08:24:18 -06:00
David Hall 34d48333d6 Corrected documentation errors 2019-04-10 11:28:19 -06:00
David Hall 65e1440ec0 Ensured that space in newly allocated memory is zeroed by default. Fixed handling of Size manipulation to zero out bytes added. (bug: it zeroed out everything) 2019-04-08 11:54:24 -06:00
David Hall dc83d5d0b4 Moved Dump, GetBytes and IntPtr operator to SafeAllocatedMemory base class. Added byte* and SafeBuffer operators to SafeAllocatedMemory. 2019-03-25 17:38:42 -07:00
David Hall a6bd30dd03 Added FillMemory methods and exposed Zero method as public on SafeAllocatedMemoryHandle 2019-01-25 11:09:07 -05:00
David Hall 627c6d2314 2.0 Checkin - Buildable 2018-10-26 12:24:07 -06:00
David Hall 2524cd22de Corrected Zero method implementation and use 2018-01-11 14:12:07 -07:00
David Hall c808717fbf Added base abstract class SafeAllocatedMemoryHandle for SafeMemoryHandle and GetBytes method to SafeMemoryHandle 2018-01-06 16:36:28 -07:00
David Hall b44f91b5a1 Initial code push: Core, PInvoke.Shared and PInvoke.TaskSchd 2017-11-27 10:18:01 -07:00