imgtools/romtools/rofsbuild/src/cache/cachemanager.cpp
author kelvzhu
Mon, 18 Oct 2010 16:16:46 +0800
changeset 655 3f65fd25dfd4
parent 600 6d08f4a05d93
permissions -rw-r--r--
sync up SVN codes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
/*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
* All rights reserved.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
* This component and the accompanying materials are made available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
* which accompanies this distribution, and is available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
* Initial Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
* Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
* Description: 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
*
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
*/
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
#include <stdlib.h>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
#include <string>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
#include <queue>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
#include <new>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
#include "e32image.h"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
#include <filesystem.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
#include <thread/thread.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
#include <thread/mutex.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
#include <thread/condition_variable.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
#include "cache/cacheexception.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
#include "cache/cacheentry.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
#include "cache/cache.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
#include "cache/cachegenerator.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
#include "cache/cachevalidator.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
#include "cache/cacheablelist.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
#include "cache/cachemanager.hpp"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
using namespace std;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
CacheManager* CacheManager::Only = (CacheManager*)0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
boost::mutex  CacheManager::creationlock;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
CacheManager* CacheManager::GetInstance(void) throw (CacheException)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
	if(! CacheManager::Only)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
		boost::mutex::scoped_lock lock(CacheManager::creationlock);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
		if(! CacheManager::Only)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
		{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
			CacheManager::Only = new (nothrow) CacheManager();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
			if(!CacheManager::Only)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
				throw CacheException(CacheException::RESOURCE_ALLOCATION_FAILURE);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
			CacheManager::Only->InitializeCache();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
		}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
	return CacheManager::Only;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
E32ImageFile* CacheManager::GetE32ImageFile(char* OriginalFilename, int CurrentCompressionID)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
	this->NormalizeFilename(OriginalFilename);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
	CacheEntry* validatedfile =CacheValidator::GetInstance()->Validate(OriginalFilename, CurrentCompressionID);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
	if(! validatedfile)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
		return (E32ImageFile*)0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    69
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    70
	printf("%s is validated in cache.\r\n", OriginalFilename);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    71
	E32ImageFile* cachedimagefile = new (nothrow) E32ImageFile();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    72
	if(! cachedimagefile)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    73
		return (E32ImageFile*)0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    74
	boost::filesystem::path cachedfile(validatedfile->GetCachedFilename());
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    75
	ifstream filecontentreader(cachedfile.file_string().c_str(), ios_base::in | ios_base::binary);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    76
	if(! filecontentreader.is_open())
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    77
		return (E32ImageFile*)0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    78
	filecontentreader.seekg(0, ios_base::end);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    79
	int contentlength = filecontentreader.tellg();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    80
	cachedimagefile->iData = (char*)malloc(sizeof(char)*contentlength);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    81
	filecontentreader.seekg(0, ios_base::beg);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    82
	filecontentreader.read(cachedimagefile->iData, contentlength);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    83
	cachedimagefile->iHdr->iUncompressedSize = contentlength - cachedimagefile->iHdr->TotalSize();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    84
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    85
	return cachedimagefile;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    86
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    87
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    88
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    89
CacheEntry* CacheManager::GetE32ImageFileRepresentation(char* OriginalFilename, int CurrentCompressionID)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    90
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    91
	this->NormalizeFilename(OriginalFilename);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    92
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    93
	return CacheValidator::GetInstance()->Validate(OriginalFilename, CurrentCompressionID);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    94
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    95
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    96
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    97
void CacheManager::Invalidate(char* Filename, CacheEntry* EntryRef) throw (CacheException)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    98
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    99
	//update cache meta file.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   100
	this->NormalizeFilename(Filename);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   101
	Cache::GetInstance()->AddEntry(Filename, EntryRef);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   102
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   103
	//update cache content.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   104
	CacheableList::GetInstance()->AddCacheable(EntryRef);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   105
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   106
	printf("Caching %s\r\n", Filename);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   107
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   108
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   109
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   110
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   111
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   112
void CacheManager::CleanCache(void) throw (CacheException)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   113
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   114
	//check if the cache is present in the current system.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   115
	boost::filesystem::path cacherootdir(this->cacheroot);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   116
	if(! exists(cacherootdir))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   117
		throw CacheException(CacheException::CACHE_NOT_FOUND);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   118
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   119
	//remove files iteratively from cache root directory.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   120
	if(remove_all(cacherootdir) <= 0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   121
		throw CacheException(CacheException::CACHE_IS_EMPTY);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   122
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   123
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   124
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   125
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   126
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   127
const char* CacheManager::GetCacheRoot(void)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   128
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   129
	return this->cacheroot;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   130
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   131
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   132
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   133
CacheManager::~CacheManager(void)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   134
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   135
	CacheEntry* newentryref = new (nothrow) CacheEntry();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   136
	CacheableList::GetInstance()->AddCacheable(newentryref);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   137
	Cache::GetInstance()->CloseCache();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   138
	CacheGenerator::GetInstance()->join();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   139
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   140
	delete CacheValidator::GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   141
	delete Cache::GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   142
	delete CacheGenerator::GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   143
	delete CacheableList::GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   144
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   145
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   146
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   147
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   148
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   149
void CacheManager::InitializeCache(void) throw (CacheException)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   150
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   151
	//assume the root directory is EPOCROOT/epoc32/build/.cache
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   152
	char* epocroot = getenv("EPOCROOT");
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   153
	if(! epocroot)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   154
		throw CacheException(CacheException::EPOCROOT_NOT_FOUND);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   155
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   156
	//initialize cacheroot member variable.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   157
	int cacherootstrlen = sizeof(char)*(strlen(epocroot)+strlen("/epoc32/build/.cache")+1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   158
	this->cacheroot = (char*)malloc(cacherootstrlen);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   159
	if(! this->cacheroot)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   160
		throw CacheException(CacheException::RESOURCE_ALLOCATION_FAILURE);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   161
	memset(this->cacheroot, 0, cacherootstrlen);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   162
	sprintf(this->cacheroot, "%s%s", epocroot, "/epoc32/build/.cache");
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   163
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   164
	//normalize cache root path.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   165
	this->NormalizeFilename(this->cacheroot);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   166
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   167
	//create cache root directory if it is not present.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   168
	boost::filesystem::path cacherootdir(this->cacheroot);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   169
	if(! exists(cacherootdir))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   170
		create_directories(cacherootdir);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   171
	printf("Using %s as cache root directory.\r\n", cacherootdir.file_string().c_str());
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   172
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   173
	//create cache instance.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   174
	Cache* cacheref = Cache::GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   175
	if(! cacheref)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   176
		throw CacheException(CacheException::RESOURCE_ALLOCATION_FAILURE);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   177
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   178
	//create cache validator instance.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   179
	if(! CacheValidator::GetInstance())
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   180
		throw CacheException(CacheException::RESOURCE_ALLOCATION_FAILURE);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   181
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   182
	//create cacheable list instance
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   183
	if(! CacheableList::GetInstance())
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   184
		throw CacheException(CacheException::RESOURCE_ALLOCATION_FAILURE);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   185
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   186
	//initialize cache container.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   187
	cacheref->Initialize();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   188
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   189
	//start cache generator.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   190
	CacheGenerator::GetInstance();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   191
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   192
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   193
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   194
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   195
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   196
void CacheManager::NormalizeFilename(char* Filename)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   197
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   198
	if(!Filename)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   199
		return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   200
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   201
	//convert back slashes into forward slashes.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   202
	char* normalizedfilename = Filename;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   203
	while(*normalizedfilename)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   204
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   205
		if(*normalizedfilename == '\\')
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   206
			*normalizedfilename = '/';
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   207
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   208
		normalizedfilename++;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   209
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   210
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   211
	//remove redundant slashes.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   212
	char* redundantfilename = Filename;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   213
	while(*redundantfilename)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   214
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   215
		if((*redundantfilename=='/') && (*(redundantfilename+1)=='/'))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   216
		{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   217
			redundantfilename++;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   218
			continue;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   219
		}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   220
		*Filename++ = *redundantfilename++;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   221
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   222
	*Filename = 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   223
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   224
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   225
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   226
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   227
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   228
CacheManager::CacheManager(void)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   229
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   230
	return;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   231
}