File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -24,11 +24,13 @@ namespace mock {
24
24
25
25
struct dummy_handle_t_ {
26
26
dummy_handle_t_ (size_t DataSize = 0 )
27
- : MStorage(DataSize), MData(MStorage.data()) {}
28
- dummy_handle_t_ (unsigned char *Data) : MData(Data) {}
27
+ : MStorage(DataSize), MData(MStorage.data()), MSize(DataSize) {}
28
+ dummy_handle_t_ (unsigned char *Data, size_t Size )
29
+ : MData(Data), MSize(Size ) {}
29
30
std::atomic<size_t > MRefCounter = 1 ;
30
31
std::vector<unsigned char > MStorage;
31
32
unsigned char *MData = nullptr ;
33
+ size_t MSize;
32
34
};
33
35
34
36
using dummy_handle_t = dummy_handle_t_ *;
@@ -43,8 +45,9 @@ template <class T> inline T createDummyHandle(size_t Size = 0) {
43
45
44
46
// Allocates a dummy handle of type T with support of reference counting
45
47
// and associates it with the provided Data.
46
- template <class T > inline T createDummyHandleWithData (unsigned char *Data) {
47
- auto DummyHandlePtr = new dummy_handle_t_ (Data);
48
+ template <class T >
49
+ inline T createDummyHandleWithData (unsigned char *Data, size_t Size ) {
50
+ auto DummyHandlePtr = new dummy_handle_t_ (Data, Size );
48
51
return reinterpret_cast <T>(DummyHandlePtr);
49
52
}
50
53
You can’t perform that action at this time.
0 commit comments