diff options
Diffstat (limited to '')
-rw-r--r-- | CPP/Common/MyBuffer2.h | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/CPP/Common/MyBuffer2.h b/CPP/Common/MyBuffer2.h index 372d478..23394f8 100644 --- a/CPP/Common/MyBuffer2.h +++ b/CPP/Common/MyBuffer2.h | |||
@@ -1,7 +1,7 @@ | |||
1 | // Common/MyBuffer2.h | 1 | // Common/MyBuffer2.h |
2 | 2 | ||
3 | #ifndef __COMMON_MY_BUFFER2_H | 3 | #ifndef ZIP7_INC_COMMON_MY_BUFFER2_H |
4 | #define __COMMON_MY_BUFFER2_H | 4 | #define ZIP7_INC_COMMON_MY_BUFFER2_H |
5 | 5 | ||
6 | #include "../../C/Alloc.h" | 6 | #include "../../C/Alloc.h" |
7 | 7 | ||
@@ -12,7 +12,7 @@ class CMidBuffer | |||
12 | Byte *_data; | 12 | Byte *_data; |
13 | size_t _size; | 13 | size_t _size; |
14 | 14 | ||
15 | CLASS_NO_COPY(CMidBuffer) | 15 | Z7_CLASS_NO_COPY(CMidBuffer) |
16 | 16 | ||
17 | public: | 17 | public: |
18 | CMidBuffer(): _data(NULL), _size(0) {} | 18 | CMidBuffer(): _data(NULL), _size(0) {} |
@@ -56,12 +56,37 @@ public: | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | 58 | ||
59 | class CAlignedBuffer1 | ||
60 | { | ||
61 | Byte *_data; | ||
62 | |||
63 | Z7_CLASS_NO_COPY(CAlignedBuffer1) | ||
64 | |||
65 | public: | ||
66 | ~CAlignedBuffer1() | ||
67 | { | ||
68 | ISzAlloc_Free(&g_AlignedAlloc, _data); | ||
69 | } | ||
70 | |||
71 | CAlignedBuffer1(size_t size) | ||
72 | { | ||
73 | _data = NULL; | ||
74 | _data = (Byte *)ISzAlloc_Alloc(&g_AlignedAlloc, size); | ||
75 | if (!_data) | ||
76 | throw 1; | ||
77 | } | ||
78 | |||
79 | operator Byte *() { return _data; } | ||
80 | operator const Byte *() const { return _data; } | ||
81 | }; | ||
82 | |||
83 | |||
59 | class CAlignedBuffer | 84 | class CAlignedBuffer |
60 | { | 85 | { |
61 | Byte *_data; | 86 | Byte *_data; |
62 | size_t _size; | 87 | size_t _size; |
63 | 88 | ||
64 | CLASS_NO_COPY(CAlignedBuffer) | 89 | Z7_CLASS_NO_COPY(CAlignedBuffer) |
65 | 90 | ||
66 | public: | 91 | public: |
67 | CAlignedBuffer(): _data(NULL), _size(0) {} | 92 | CAlignedBuffer(): _data(NULL), _size(0) {} |