From d10aacbe935af98e777dd0e244e095ae213a1466 Mon Sep 17 00:00:00 2001 From: ksherlock Date: Wed, 16 Dec 2009 01:34:33 +0000 Subject: [PATCH] git-svn-id: https://profuse.googlecode.com/svn/branches/v2@184 aa027e90-d47c-11dd-86d7-074df07e0730 --- Endian/IOBuffer.t.cpp | 18 +++++++++++++----- DateTime.cpp => ProDOS/DateTime.cpp | 0 DateTime.h => ProDOS/DateTime.h | 0 3 files changed, 13 insertions(+), 5 deletions(-) rename DateTime.cpp => ProDOS/DateTime.cpp (100%) rename DateTime.h => ProDOS/DateTime.h (100%) diff --git a/Endian/IOBuffer.t.cpp b/Endian/IOBuffer.t.cpp index dfd4e6a..54de16a 100644 --- a/Endian/IOBuffer.t.cpp +++ b/Endian/IOBuffer.t.cpp @@ -38,19 +38,27 @@ void writeZero(unsigned count) { - uint8_t *cp = _offset + (uint8_t *)_buffer; - for (unsigned i = 0; i < count; ++i) - { - cp[i] = 0; - } + std::memset(_offset + (uint8_t *)_buffer, 0, count); + _offset += count; } unsigned offset() const { return _offset; } void setOffset(unsigned offset) { _offset = offset; } + void setOffset(unsigned offset, bool zero) + { + if (zero && offset > _offset) + { + writeZero(offset - _offset); + } + else setOffset(offset); + } + unsigned size() const { return _size; } + void *buffer() const { return _buffer; } + private: void *_buffer; unsigned _size; diff --git a/DateTime.cpp b/ProDOS/DateTime.cpp similarity index 100% rename from DateTime.cpp rename to ProDOS/DateTime.cpp diff --git a/DateTime.h b/ProDOS/DateTime.h similarity index 100% rename from DateTime.h rename to ProDOS/DateTime.h