diff --git a/_byte_buffer_8cpp_source.html b/_byte_buffer_8cpp_source.html index d8b79de4..e1cec8cf 100644 --- a/_byte_buffer_8cpp_source.html +++ b/_byte_buffer_8cpp_source.html @@ -95,105 +95,102 @@ $(function(){ initResizable(false); }); Go to the documentation of this file.
1#include "ByteBuffer.h"
2#include <iostream>
3
-
- -
5 : content(nullptr), contentSize(0), padding(v_padding),
- -
7{
-
8 if (v_size == 0) throw BufferException("Zero size requested");
-
9
-
10 this->content = allocContent(v_size, v_padding);
-
11 this->contentSize = v_size;
-
12 this->originalSize = v_size;
-
13}
+
4
+
+
5ByteBuffer::ByteBuffer(BYTE *v_content, bufsize_t v_size, bufsize_t v_padding)
+
6 : content(nullptr), contentSize(0), padding(v_padding),
+ +
8{
+
9 if (v_size == 0) throw BufferException("Zero size requested");
+
10
+
11 this->content = allocContent(v_size, v_padding);
+
12 if (this->content) {
+
13 this->contentSize = v_size;
+
14 this->originalSize = v_size;
+
15 if (v_content) {
+
16 ::memcpy(this->content, v_content, v_size);
+
17 }
+
18 }
+
19}
-
14
-
-
15ByteBuffer::ByteBuffer(BYTE *v_content, bufsize_t v_size, bufsize_t v_padding)
-
16 : content(nullptr), contentSize(0), padding(v_padding),
-
17 originalSize(0), m_refs(0)
-
18{
-
19 if (v_size == 0) throw BufferException("Zero size requested");
20
-
21 this->content = allocContent(v_size, v_padding);
-
22 if (this->content) {
-
23 this->contentSize = v_size;
-
24 this->originalSize = v_size;
-
25 ::memcpy(this->content, v_content, v_size);
-
26 }
-
27}
+
+ +
22 : ByteBuffer(nullptr, v_size, v_padding)
+
23{
+
24}
-
28
-
- -
30 : content(NULL), contentSize(0), padding(0),
-
31 originalSize(0), m_refs(0)
-
32{
-
33 if (!v_parent) throw BufferException("Cannot make subBuffer for NULL buffer!");
-
34 if (!v_size) throw BufferException("Cannot make 0 size buffer!");
-
35
-
36 bufsize_t parentSize = v_parent->getContentSize();
+
25
+
+ +
27 : content(nullptr), contentSize(0), padding(0),
+
28 originalSize(0), m_refs(0)
+
29{
+
30 if (!v_parent) throw BufferException("Cannot make subBuffer for NULL buffer!");
+
31 if (!v_size) throw BufferException("Cannot make 0 size buffer!");
+
32
+
33 bufsize_t parentSize = v_parent->getContentSize();
+
34
+
35 bufsize_t copySize = v_size < parentSize ? v_size : parentSize;
+
36 bufsize_t allocSize = v_size > parentSize ? v_size : parentSize;
37
-
38 bufsize_t copySize = v_size < parentSize ? v_size : parentSize;
-
39 bufsize_t allocSize = v_size > parentSize ? v_size : parentSize;
+
38 BYTE *bContent = v_parent->getContentAt(v_offset, copySize);
+
39 if (!bContent) throw BufferException("Cannot make Buffer for NULL content!");
40
-
41 BYTE *bContent = v_parent->getContentAt(v_offset, copySize);
-
42 if (!bContent) throw BufferException("Cannot make Buffer for NULL content!");
-
43
-
44 this->content = allocContent(allocSize, v_padding);
-
45 if (this->content) {
-
46 this->contentSize = allocSize;
-
47 this->originalSize = this->contentSize;
-
48 ::memcpy(this->content, bContent, copySize);
-
49 }
-
50}
+
41 this->content = allocContent(allocSize, v_padding);
+
42 if (this->content) {
+
43 this->contentSize = allocSize;
+
44 this->originalSize = this->contentSize;
+
45 ::memcpy(this->content, bContent, copySize);
+
46 }
+
47}
-
51
-
- -
53{
-
54 if (!v_size) throw BufferException("Zero size requested");
+
48
+
+ +
50{
+
51 if (!v_size) throw BufferException("Zero size requested");
+
52
+
53 const bufsize_t allocSize = v_size + v_padding;
+
54 const bufsize_t sizeDiff = (allocSize > this->contentSize) ? (allocSize - this->contentSize) : 0;
55
-
56 const bufsize_t allocSize = v_size + v_padding;
-
57 const bufsize_t sizeDiff = (allocSize > this->contentSize) ? (allocSize - this->contentSize) : 0;
-
58
-
59 BYTE* content = reinterpret_cast<BYTE*>(::realloc((void*)this->content, allocSize));
-
60 if (!content) {
-
61 throw BufferException("Cannot allocate buffer of size: 0x" + QString::number(allocSize, 16));
+
56 BYTE* content = reinterpret_cast<BYTE*>(::realloc((void*)this->content, allocSize));
+
57 if (!content) {
+
58 throw BufferException("Cannot allocate buffer of size: 0x" + QString::number(allocSize, 16));
+
59 }
+
60 if (sizeDiff) {
+
61 ::memset(content + this->contentSize, 0, sizeDiff);
62 }
-
63 if (sizeDiff) {
-
64 ::memset(content + this->contentSize, 0, sizeDiff);
-
65 }
-
66 return content;
-
67}
+
63 return content;
+
64}
-
68
-
- -
70{
-
71 if (newSize == this->contentSize) {
-
72 return true;
-
73 }
-
74 BYTE *newContent = nullptr;
-
75 bool isOk = true;
-
76 try {
-
77 newContent = allocContent(newSize, this->padding);
-
78 if (newContent) {
-
79 this->content = newContent;
-
80 this->contentSize = newSize;
-
81 }
-
82 } catch (const BufferException&) {
-
83 isOk = false;
-
84 }
-
85 return isOk;
-
86}
+
65
+
+ +
67{
+
68 if (newSize == this->contentSize) {
+
69 return true;
+
70 }
+
71 BYTE *newContent = nullptr;
+
72 bool isOk = true;
+
73 try {
+
74 newContent = allocContent(newSize, this->padding);
+
75 if (newContent) {
+
76 this->content = newContent;
+
77 this->contentSize = newSize;
+
78 }
+
79 } catch (const BufferException&) {
+
80 isOk = false;
+
81 }
+
82 return isOk;
+
83}
-
87
-
- -
89{
-
90 ::free(this->content);
-
91}
+
84
+
+ +
86{
+
87 ::free(this->content);
+
88}
uint32_t bufsize_t
uint64_t offset_t
@@ -204,13 +201,13 @@ $(function(){ initResizable(false); });
bufsize_t originalSize
Definition ByteBuffer.h:44
BYTE * content
Definition ByteBuffer.h:40
-
virtual ~ByteBuffer()
+
virtual ~ByteBuffer()
bufsize_t contentSize
Definition ByteBuffer.h:41
-
ByteBuffer(bufsize_t v_size, bufsize_t padding=DEFAULT_PADDING)
Definition ByteBuffer.cpp:4
+
ByteBuffer(bufsize_t v_size, bufsize_t padding=DEFAULT_PADDING)
size_t m_refs
Definition ByteBuffer.h:46
-
BYTE * allocContent(bufsize_t v_size, bufsize_t padding)
+
BYTE * allocContent(bufsize_t v_size, bufsize_t padding)
bufsize_t padding
Definition ByteBuffer.h:42
-
virtual bool resize(bufsize_t newSize)
+
virtual bool resize(bufsize_t newSize)
diff --git a/class_byte_buffer.html b/class_byte_buffer.html index 15907ef1..31498523 100644 --- a/class_byte_buffer.html +++ b/class_byte_buffer.html @@ -224,15 +224,14 @@ Protected Attributes
-

Definition at line 4 of file ByteBuffer.cpp.

+

Definition at line 21 of file ByteBuffer.cpp.

Here is the call graph for this function:
- - - + +
@@ -262,7 +261,7 @@ Here is the call graph for this function:
-

Definition at line 15 of file ByteBuffer.cpp.

+

Definition at line 5 of file ByteBuffer.cpp.

Here is the call graph for this function:
@@ -305,7 +304,7 @@ Here is the call graph for this function:
-

Definition at line 29 of file ByteBuffer.cpp.

+

Definition at line 26 of file ByteBuffer.cpp.

Here is the call graph for this function:
@@ -351,7 +350,7 @@ Here is the call graph for this function:
-

Definition at line 88 of file ByteBuffer.cpp.

+

Definition at line 85 of file ByteBuffer.cpp.

@@ -410,7 +409,7 @@ Here is the call graph for this function:
-

Definition at line 52 of file ByteBuffer.cpp.

+

Definition at line 49 of file ByteBuffer.cpp.

@@ -530,11 +529,10 @@ Here is the call graph for this function:
- - - - - + + + +
@@ -565,7 +563,7 @@ Here is the call graph for this function:

Reimplemented from AbstractByteBuffer.

-

Definition at line 69 of file ByteBuffer.cpp.

+

Definition at line 66 of file ByteBuffer.cpp.

Here is the call graph for this function:
diff --git a/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.map b/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.map index 6cee6528..90b55d29 100644 --- a/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.map +++ b/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.map @@ -1,5 +1,4 @@ - - - + + diff --git a/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.md5 b/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.md5 index 79e15fb1..c05b1ee3 100644 --- a/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.md5 +++ b/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.md5 @@ -1 +1 @@ -9db654dfada7ee92e052c4b2d59f1da8 \ No newline at end of file +bda3ff9d576d96f864cf396eb9079b6e \ No newline at end of file diff --git a/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.png b/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.png index 49d57813..ab0c6ad5 100644 Binary files a/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.png and b/class_byte_buffer_a7aa532de539fe0d1218349bb9dd043df_cgraph.png differ diff --git a/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.map b/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.map index a0a5e8c8..197e45fe 100644 --- a/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.map +++ b/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.map @@ -1,7 +1,6 @@ - - - - - + + + + diff --git a/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.md5 b/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.md5 index 24ce5cd4..09858e05 100644 --- a/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.md5 +++ b/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.md5 @@ -1 +1 @@ -390c050cbce888b5dc35c09d1ed65400 \ No newline at end of file +dbd5d4ac69dbff667169bc43b56f3d35 \ No newline at end of file diff --git a/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.png b/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.png index eb5212aa..b2e698a7 100644 Binary files a/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.png and b/class_byte_buffer_ad1d925353fc8e6b7c3b9fdcf351cd4d3_cgraph.png differ