diff options
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/buffer')
-rw-r--r--[-rwxr-xr-x] | utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp | 116 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h | 104 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.cpp | 82 | ||||
-rw-r--r--[-rwxr-xr-x] | utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.h | 102 |
4 files changed, 202 insertions, 202 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp index ae2584edb1..579b152659 100755..100644 --- a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp +++ b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | * InputBuffer.cpp - Part of the PeLib library. | 2 | * InputBuffer.cpp - Part of the PeLib library. |
3 | * | 3 | * |
4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) | 4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This software is licensed under the zlib/libpng License. | 7 | * This software is licensed under the zlib/libpng License. |
8 | * For more details see http://www.opensource.org/licenses/zlib-license.php | 8 | * For more details see http://www.opensource.org/licenses/zlib-license.php |
9 | * or the license information file (license.htm) in the root directory | 9 | * or the license information file (license.htm) in the root directory |
10 | * of PeLib. | 10 | * of PeLib. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "InputBuffer.h" | 13 | #include "InputBuffer.h" |
14 | 14 | ||
15 | namespace PeLib | 15 | namespace PeLib |
16 | { | 16 | { |
17 | unsigned long InputBuffer::get() | 17 | unsigned long InputBuffer::get() |
18 | { | 18 | { |
19 | return ulIndex; | 19 | return ulIndex; |
20 | } | 20 | } |
21 | 21 | ||
22 | InputBuffer::InputBuffer(std::vector<unsigned char>& vBuffer) : m_vBuffer(vBuffer), ulIndex(0) | 22 | InputBuffer::InputBuffer(std::vector<unsigned char>& vBuffer) : m_vBuffer(vBuffer), ulIndex(0) |
23 | { | 23 | { |
24 | } | 24 | } |
25 | 25 | ||
26 | const unsigned char* InputBuffer::data() const | 26 | const unsigned char* InputBuffer::data() const |
27 | { | 27 | { |
28 | return &m_vBuffer[0]; | 28 | return &m_vBuffer[0]; |
29 | } | 29 | } |
30 | 30 | ||
31 | unsigned long InputBuffer::size() | 31 | unsigned long InputBuffer::size() |
32 | { | 32 | { |
33 | return static_cast<unsigned long>(m_vBuffer.size()); | 33 | return static_cast<unsigned long>(m_vBuffer.size()); |
34 | } | 34 | } |
35 | 35 | ||
36 | void InputBuffer::read(char* lpBuffer, unsigned long ulSize) | 36 | void InputBuffer::read(char* lpBuffer, unsigned long ulSize) |
37 | { | 37 | { |
38 | std::copy(&m_vBuffer[ulIndex], &m_vBuffer[ulIndex + ulSize], lpBuffer); | 38 | std::copy(&m_vBuffer[ulIndex], &m_vBuffer[ulIndex + ulSize], lpBuffer); |
39 | ulIndex += ulSize; | 39 | ulIndex += ulSize; |
40 | } | 40 | } |
41 | 41 | ||
42 | void InputBuffer::reset() | 42 | void InputBuffer::reset() |
43 | { | 43 | { |
44 | m_vBuffer.clear(); | 44 | m_vBuffer.clear(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void InputBuffer::set(unsigned long ulIndex) | 47 | void InputBuffer::set(unsigned long ulIndex) |
48 | { | 48 | { |
49 | this->ulIndex = ulIndex; | 49 | this->ulIndex = ulIndex; |
50 | } | 50 | } |
51 | 51 | ||
52 | void InputBuffer::setBuffer(std::vector<unsigned char>& vBuffer) | 52 | void InputBuffer::setBuffer(std::vector<unsigned char>& vBuffer) |
53 | { | 53 | { |
54 | m_vBuffer = vBuffer; | 54 | m_vBuffer = vBuffer; |
55 | ulIndex = 0; | 55 | ulIndex = 0; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h index fc5a14e357..18a7b1b7bc 100755..100644 --- a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h +++ b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h | |||
@@ -1,52 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | * InputBuffer.h - Part of the PeLib library. | 2 | * InputBuffer.h - Part of the PeLib library. |
3 | * | 3 | * |
4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) | 4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This software is licensed under the zlib/libpng License. | 7 | * This software is licensed under the zlib/libpng License. |
8 | * For more details see http://www.opensource.org/licenses/zlib-license.php | 8 | * For more details see http://www.opensource.org/licenses/zlib-license.php |
9 | * or the license information file (license.htm) in the root directory | 9 | * or the license information file (license.htm) in the root directory |
10 | * of PeLib. | 10 | * of PeLib. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef INPUTBUFFER_H | 13 | #ifndef INPUTBUFFER_H |
14 | #define INPUTBUFFER_H | 14 | #define INPUTBUFFER_H |
15 | 15 | ||
16 | #include <vector> | 16 | #include <vector> |
17 | #include <iterator> | 17 | #include <iterator> |
18 | #include <cassert> | 18 | #include <cassert> |
19 | 19 | ||
20 | namespace PeLib | 20 | namespace PeLib |
21 | { | 21 | { |
22 | class InputBuffer | 22 | class InputBuffer |
23 | { | 23 | { |
24 | private: | 24 | private: |
25 | std::vector<unsigned char>& m_vBuffer; | 25 | std::vector<unsigned char>& m_vBuffer; |
26 | unsigned long ulIndex; | 26 | unsigned long ulIndex; |
27 | 27 | ||
28 | public: | 28 | public: |
29 | InputBuffer(std::vector<unsigned char>& vBuffer); | 29 | InputBuffer(std::vector<unsigned char>& vBuffer); |
30 | 30 | ||
31 | const unsigned char* data() const; | 31 | const unsigned char* data() const; |
32 | unsigned long size(); | 32 | unsigned long size(); |
33 | 33 | ||
34 | template<typename T> | 34 | template<typename T> |
35 | InputBuffer& operator>>(T& value) | 35 | InputBuffer& operator>>(T& value) |
36 | { | 36 | { |
37 | assert(ulIndex + sizeof(value) <= m_vBuffer.size()); | 37 | assert(ulIndex + sizeof(value) <= m_vBuffer.size()); |
38 | value = *(T*)(&m_vBuffer[ulIndex]);//reinterpret_cast<T*>(&m_vBuffer[ulIndex]); | 38 | value = *(T*)(&m_vBuffer[ulIndex]);//reinterpret_cast<T*>(&m_vBuffer[ulIndex]); |
39 | ulIndex += sizeof(T); | 39 | ulIndex += sizeof(T); |
40 | return *this; | 40 | return *this; |
41 | } | 41 | } |
42 | 42 | ||
43 | void read(char* lpBuffer, unsigned long ulSize); | 43 | void read(char* lpBuffer, unsigned long ulSize); |
44 | void reset(); | 44 | void reset(); |
45 | void set(unsigned long ulIndex); | 45 | void set(unsigned long ulIndex); |
46 | unsigned long get(); | 46 | unsigned long get(); |
47 | void setBuffer(std::vector<unsigned char>& vBuffer); | 47 | void setBuffer(std::vector<unsigned char>& vBuffer); |
48 | // void updateData(unsigned long ulIndex, | 48 | // void updateData(unsigned long ulIndex, |
49 | }; | 49 | }; |
50 | } | 50 | } |
51 | 51 | ||
52 | #endif | 52 | #endif |
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.cpp b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.cpp index b47fbb6ff8..4ad8471d83 100755..100644 --- a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.cpp +++ b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.cpp | |||
@@ -1,41 +1,41 @@ | |||
1 | /* | 1 | /* |
2 | * OutputBuffer.cpp - Part of the PeLib library. | 2 | * OutputBuffer.cpp - Part of the PeLib library. |
3 | * | 3 | * |
4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) | 4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This software is licensed under the zlib/libpng License. | 7 | * This software is licensed under the zlib/libpng License. |
8 | * For more details see http://www.opensource.org/licenses/zlib-license.php | 8 | * For more details see http://www.opensource.org/licenses/zlib-license.php |
9 | * or the license information file (license.htm) in the root directory | 9 | * or the license information file (license.htm) in the root directory |
10 | * of PeLib. | 10 | * of PeLib. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include "OutputBuffer.h" | 13 | #include "OutputBuffer.h" |
14 | 14 | ||
15 | namespace PeLib | 15 | namespace PeLib |
16 | { | 16 | { |
17 | OutputBuffer::OutputBuffer(std::vector<unsigned char>& vBuffer) : m_vBuffer(vBuffer) | 17 | OutputBuffer::OutputBuffer(std::vector<unsigned char>& vBuffer) : m_vBuffer(vBuffer) |
18 | { | 18 | { |
19 | m_vBuffer.clear(); | 19 | m_vBuffer.clear(); |
20 | } | 20 | } |
21 | 21 | ||
22 | const unsigned char* OutputBuffer::data() const | 22 | const unsigned char* OutputBuffer::data() const |
23 | { | 23 | { |
24 | return &m_vBuffer[0]; | 24 | return &m_vBuffer[0]; |
25 | } | 25 | } |
26 | 26 | ||
27 | unsigned long OutputBuffer::size() | 27 | unsigned long OutputBuffer::size() |
28 | { | 28 | { |
29 | return static_cast<unsigned long>(m_vBuffer.size()); | 29 | return static_cast<unsigned long>(m_vBuffer.size()); |
30 | } | 30 | } |
31 | 31 | ||
32 | void OutputBuffer::add(const char* lpBuffer, unsigned long ulSize) | 32 | void OutputBuffer::add(const char* lpBuffer, unsigned long ulSize) |
33 | { | 33 | { |
34 | std::copy(lpBuffer, lpBuffer + ulSize, std::back_inserter(m_vBuffer)); | 34 | std::copy(lpBuffer, lpBuffer + ulSize, std::back_inserter(m_vBuffer)); |
35 | } | 35 | } |
36 | 36 | ||
37 | void OutputBuffer::reset() | 37 | void OutputBuffer::reset() |
38 | { | 38 | { |
39 | m_vBuffer.clear(); | 39 | m_vBuffer.clear(); |
40 | } | 40 | } |
41 | } | 41 | } |
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.h b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.h index f1ab99039b..06049ddd9d 100755..100644 --- a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.h +++ b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/OutputBuffer.h | |||
@@ -1,51 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | * OutputBuffer.h - Part of the PeLib library. | 2 | * OutputBuffer.h - Part of the PeLib library. |
3 | * | 3 | * |
4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) | 4 | * Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com) |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This software is licensed under the zlib/libpng License. | 7 | * This software is licensed under the zlib/libpng License. |
8 | * For more details see http://www.opensource.org/licenses/zlib-license.php | 8 | * For more details see http://www.opensource.org/licenses/zlib-license.php |
9 | * or the license information file (license.htm) in the root directory | 9 | * or the license information file (license.htm) in the root directory |
10 | * of PeLib. | 10 | * of PeLib. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef OUTPUTBUFFER_H | 13 | #ifndef OUTPUTBUFFER_H |
14 | #define OUTPUTBUFFER_H | 14 | #define OUTPUTBUFFER_H |
15 | 15 | ||
16 | #include <vector> | 16 | #include <vector> |
17 | #include <iterator> | 17 | #include <iterator> |
18 | 18 | ||
19 | namespace PeLib | 19 | namespace PeLib |
20 | { | 20 | { |
21 | class OutputBuffer | 21 | class OutputBuffer |
22 | { | 22 | { |
23 | private: | 23 | private: |
24 | std::vector<unsigned char>& m_vBuffer; | 24 | std::vector<unsigned char>& m_vBuffer; |
25 | 25 | ||
26 | public: | 26 | public: |
27 | OutputBuffer(std::vector<unsigned char>& vBuffer); | 27 | OutputBuffer(std::vector<unsigned char>& vBuffer); |
28 | const unsigned char* data() const; | 28 | const unsigned char* data() const; |
29 | unsigned long size(); | 29 | unsigned long size(); |
30 | 30 | ||
31 | template<typename T> | 31 | template<typename T> |
32 | OutputBuffer& operator<<(const T& value) | 32 | OutputBuffer& operator<<(const T& value) |
33 | { | 33 | { |
34 | const unsigned char* p = reinterpret_cast<const unsigned char*>(&value); | 34 | const unsigned char* p = reinterpret_cast<const unsigned char*>(&value); |
35 | std::copy(p, p + sizeof(value), std::back_inserter(m_vBuffer)); | 35 | std::copy(p, p + sizeof(value), std::back_inserter(m_vBuffer)); |
36 | return *this; | 36 | return *this; |
37 | } | 37 | } |
38 | void add(const char* lpBuffer, unsigned long ulSize); | 38 | void add(const char* lpBuffer, unsigned long ulSize); |
39 | void reset(); | 39 | void reset(); |
40 | void resize(unsigned int uiSize); | 40 | void resize(unsigned int uiSize); |
41 | void set(unsigned int uiPosition); | 41 | void set(unsigned int uiPosition); |
42 | 42 | ||
43 | template<typename T> | 43 | template<typename T> |
44 | void update(unsigned long ulIndex, const T& value) | 44 | void update(unsigned long ulIndex, const T& value) |
45 | { | 45 | { |
46 | *(T*)(&m_vBuffer[ulIndex]) = value; | 46 | *(T*)(&m_vBuffer[ulIndex]) = value; |
47 | } | 47 | } |
48 | }; | 48 | }; |
49 | } | 49 | } |
50 | 50 | ||
51 | #endif | 51 | #endif |