Diffstat (limited to 'noncore/apps/opie-console/script.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/script.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/apps/opie-console/script.cpp b/noncore/apps/opie-console/script.cpp index a09fab6..9cb1cd3 100644 --- a/noncore/apps/opie-console/script.cpp +++ b/noncore/apps/opie-console/script.cpp | |||
@@ -9,6 +9,3 @@ Script::Script(const QString fileName) { | |||
9 | QFile file(fileName); | 9 | QFile file(fileName); |
10 | QTextStream stream(&file); | 10 | m_script = file.readAll(); |
11 | while (!stream.atEnd()) { | ||
12 | appendString(stream.readLine()); | ||
13 | } | ||
14 | } | 11 | } |
@@ -18,3 +15,3 @@ void Script::saveTo(const QString fileName) const { | |||
18 | file.open(IO_WriteOnly); | 15 | file.open(IO_WriteOnly); |
19 | file.writeBlock(m_script.ascii(), m_script.length()); | 16 | file.writeBlock(m_script); |
20 | file.close(); | 17 | file.close(); |
@@ -23,7 +20,9 @@ void Script::saveTo(const QString fileName) const { | |||
23 | 20 | ||
24 | void Script::appendString(const QString string) { | 21 | void Script::append(const QByteArray &data) { |
25 | m_script += string; | 22 | int size = m_script.size(); |
23 | m_script.resize(size + data.size()); | ||
24 | memcpy(m_script.data() + size, data.data(), data.size()); | ||
26 | } | 25 | } |
27 | 26 | ||
28 | QString Script::script() const { | 27 | QByteArray Script::script() const { |
29 | return m_script; | 28 | return m_script; |