summaryrefslogtreecommitdiff
path: root/txtrecv.c
diff options
context:
space:
mode:
authoretobi <git@e-tobi.net>2009-10-26 03:22:58 +0100
committeretobi <git@e-tobi.net>2009-10-26 03:24:21 +0100
commitc9e68daf1a46f96b8f0a80b1056e62c3f13bbd5b (patch)
treed7875149f6b8bf35f3facbc17fa19d7fbee4efaa /txtrecv.c
parentb7e63f01cd2b98d6f588a75ea7c85a080488dd85 (diff)
downloadvdr-plugin-osdteletext-c9e68daf1a46f96b8f0a80b1056e62c3f13bbd5b.tar.gz
vdr-plugin-osdteletext-c9e68daf1a46f96b8f0a80b1056e62c3f13bbd5b.tar.bz2
Got rid of static storage option field (References #177)
Diffstat (limited to 'txtrecv.c')
-rw-r--r--txtrecv.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/txtrecv.c b/txtrecv.c
index 59f5bd9..ac27c4c 100644
--- a/txtrecv.c
+++ b/txtrecv.c
@@ -100,8 +100,6 @@ int Storage::cleanSubDir(const char *dir) {
return bytesDeleted;
}
-int Storage::storageOption = -1;
-
Storage::Storage() {
byteCount=0;
failedFreeSpace=false;
@@ -110,25 +108,16 @@ Storage::Storage() {
Storage::~Storage() {
}
-Storage *Storage::CreateInstance(StorageSystem system) {
+Storage *Storage::CreateInstance(StorageSystem system, int storageLimit) {
switch (system) {
case StorageSystemLegacy:
- return new LegacyStorage();
+ return new LegacyStorage(storageLimit);
case StorageSystemPacked:
default:
- return new PackedStorage();
+ return new PackedStorage(storageLimit);
}
}
-void Storage::setMaxStorage(int maxMB) {
- storageOption=maxMB;
-}
-
-void Storage::init() {
- cleanUp();
- initMaxStorage(storageOption);
-}
-
void Storage::freeSpace() {
//there might be a situation where only the current directory is left and
//occupies the whole space. We cannot delete anything. Don't waste time scanning.
@@ -190,10 +179,10 @@ void Storage::prepareDirectory(tChannelID chan) {
#define TELETEXT_PAGESIZE 972
-LegacyStorage::LegacyStorage() {
- maxBytes=0;
+LegacyStorage::LegacyStorage(int maxMB) {
fsBlockSize=1;
pageBytes=TELETEXT_PAGESIZE;
+ initMaxStorage(maxMB);
}
LegacyStorage::~LegacyStorage() {
@@ -323,7 +312,8 @@ ssize_t LegacyStorage::write(const void *ptr, size_t size, StorageHandle stream)
-PackedStorage::PackedStorage() {
+PackedStorage::PackedStorage(int maxMB)
+ : LegacyStorage(maxMB) {
}
#define TOC_SIZE 8
//The file structure is simple: