diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/tools/GUIEditor/CMemoryReadWriteFile.cpp | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/tools/GUIEditor/CMemoryReadWriteFile.cpp | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/libraries/irrlicht-1.8/tools/GUIEditor/CMemoryReadWriteFile.cpp b/libraries/irrlicht-1.8/tools/GUIEditor/CMemoryReadWriteFile.cpp index 0a69587..af46b15 100644 --- a/libraries/irrlicht-1.8/tools/GUIEditor/CMemoryReadWriteFile.cpp +++ b/libraries/irrlicht-1.8/tools/GUIEditor/CMemoryReadWriteFile.cpp | |||
@@ -1,95 +1,95 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #include "CMemoryReadWriteFile.h" | 5 | #include "CMemoryReadWriteFile.h" |
6 | 6 | ||
7 | using namespace irr; | 7 | using namespace irr; |
8 | using namespace io; | 8 | using namespace io; |
9 | 9 | ||
10 | CMemoryReadWriteFile::CMemoryReadWriteFile(const c8* filename) | 10 | CMemoryReadWriteFile::CMemoryReadWriteFile(const c8* filename) |
11 | : Data(), FileName(filename), Pos(0) | 11 | : Data(), FileName(filename), Pos(0) |
12 | { | 12 | { |
13 | } | 13 | } |
14 | 14 | ||
15 | 15 | ||
16 | s32 CMemoryReadWriteFile::write(const void* buffer, u32 sizeToWrite) | 16 | s32 CMemoryReadWriteFile::write(const void* buffer, u32 sizeToWrite) |
17 | { | 17 | { |
18 | // no point in writing 0 bytes | 18 | // no point in writing 0 bytes |
19 | if (sizeToWrite < 1) | 19 | if (sizeToWrite < 1) |
20 | return 0; | 20 | return 0; |
21 | 21 | ||
22 | // expand size | 22 | // expand size |
23 | if (Pos + sizeToWrite > Data.size()) | 23 | if (Pos + sizeToWrite > Data.size()) |
24 | Data.set_used(Pos+sizeToWrite); | 24 | Data.set_used(Pos+sizeToWrite); |
25 | 25 | ||
26 | // copy data | 26 | // copy data |
27 | memcpy( (void*) &Data[Pos], buffer, (size_t) sizeToWrite); | 27 | memcpy( (void*) &Data[Pos], buffer, (size_t) sizeToWrite); |
28 | 28 | ||
29 | Pos += sizeToWrite; | 29 | Pos += sizeToWrite; |
30 | 30 | ||
31 | return sizeToWrite; | 31 | return sizeToWrite; |
32 | 32 | ||
33 | } | 33 | } |
34 | 34 | ||
35 | bool CMemoryReadWriteFile::seek(long finalPos, bool relativeMovement) | 35 | bool CMemoryReadWriteFile::seek(long finalPos, bool relativeMovement) |
36 | { | 36 | { |
37 | if (relativeMovement) | 37 | if (relativeMovement) |
38 | { | 38 | { |
39 | if (finalPos + Pos < 0) | 39 | if (finalPos + Pos < 0) |
40 | return 0; | 40 | return 0; |
41 | else | 41 | else |
42 | Pos += finalPos; | 42 | Pos += finalPos; |
43 | } | 43 | } |
44 | else | 44 | else |
45 | { | 45 | { |
46 | Pos = finalPos; | 46 | Pos = finalPos; |
47 | } | 47 | } |
48 | 48 | ||
49 | if (Pos > (s32)Data.size()) | 49 | if (Pos > (s32)Data.size()) |
50 | Data.set_used(Pos+1); | 50 | Data.set_used(Pos+1); |
51 | 51 | ||
52 | return true; | 52 | return true; |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | const io::path& CMemoryReadWriteFile::getFileName() const | 56 | const io::path& CMemoryReadWriteFile::getFileName() const |
57 | { | 57 | { |
58 | return FileName; | 58 | return FileName; |
59 | } | 59 | } |
60 | 60 | ||
61 | long CMemoryReadWriteFile::getPos() const | 61 | long CMemoryReadWriteFile::getPos() const |
62 | { | 62 | { |
63 | return Pos; | 63 | return Pos; |
64 | } | 64 | } |
65 | 65 | ||
66 | core::array<c8>& CMemoryReadWriteFile::getData() | 66 | core::array<c8>& CMemoryReadWriteFile::getData() |
67 | { | 67 | { |
68 | return Data; | 68 | return Data; |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | long CMemoryReadWriteFile::getSize() const | 72 | long CMemoryReadWriteFile::getSize() const |
73 | { | 73 | { |
74 | return Data.size(); | 74 | return Data.size(); |
75 | } | 75 | } |
76 | 76 | ||
77 | 77 | ||
78 | s32 CMemoryReadWriteFile::read(void* buffer, u32 sizeToRead) | 78 | s32 CMemoryReadWriteFile::read(void* buffer, u32 sizeToRead) |
79 | { | 79 | { |
80 | // cant read past the end | 80 | // cant read past the end |
81 | if (Pos + sizeToRead >= Data.size()) | 81 | if (Pos + sizeToRead >= Data.size()) |
82 | sizeToRead = Data.size() - Pos; | 82 | sizeToRead = Data.size() - Pos; |
83 | 83 | ||
84 | // cant read 0 bytes | 84 | // cant read 0 bytes |
85 | if (!sizeToRead) | 85 | if (!sizeToRead) |
86 | return 0; | 86 | return 0; |
87 | 87 | ||
88 | // copy data | 88 | // copy data |
89 | memcpy( buffer, (void*) &Data[Pos], (size_t) sizeToRead); | 89 | memcpy( buffer, (void*) &Data[Pos], (size_t) sizeToRead); |
90 | 90 | ||
91 | Pos += sizeToRead; | 91 | Pos += sizeToRead; |
92 | 92 | ||
93 | return sizeToRead; | 93 | return sizeToRead; |
94 | } | 94 | } |
95 | 95 | ||