From f469d4e4d4c289c50b79070525dccc3dceca6455 Mon Sep 17 00:00:00 2001 From: ksherlock Date: Thu, 10 Dec 2009 02:40:41 +0000 Subject: [PATCH] git-svn-id: https://profuse.googlecode.com/svn/branches/v2@137 aa027e90-d47c-11dd-86d7-074df07e0730 --- pascal/File.cpp | 20 ++++++++++++++++---- pascal/File.h | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pascal/File.cpp b/pascal/File.cpp index 72916d9..7e99fb2 100644 --- a/pascal/File.cpp +++ b/pascal/File.cpp @@ -191,13 +191,25 @@ int FileEntry::read(uint8_t *buffer, unsigned size, unsigned offset) } } -#if 0 -unsigned File::fileSize() { - return (_lastBlock - _firstBlock - 1) * 512 + _lastByte; +unsigned FileEntry::dataFileSize() +{ + return blocks() * 512 - 512 + _lastByte; } -int File::read(uint8_t *buffer, unsigned size, unsigned offset) +unsigned FileEntry::textFileSize() +{ + if (!_pageLength()) textInit(); + return _fileSize; +} + + + +#if 0 + + + +int FileEntry::dataRead(uint8_t *buffer, unsigned size, unsigned offset) { uint8_t tmp[512]; diff --git a/pascal/File.h b/pascal/File.h index c5297ee..d69bc5e 100644 --- a/pascal/File.h +++ b/pascal/File.h @@ -115,13 +115,13 @@ class FileEntry : public Entry { int dataRead(uint8_t *buffer, unsigned size, unsigned offset); // for text files. + void textInit(); unsigned textFileSize(); int textRead(uint8_t *buffer, unsigned size, unsigned offset); unsigned textReadPage(unsigned block, uint8_t *in); unsigned textDecodePage(unsigned block, uint8_t *out); - std::vector *_pageLength; unsigned _fileSize;