Migliorato decoder che ora funziona anche per codici nulli

git-svn-id: svn://10.65.10.50/trunk@2288 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-12-14 13:16:48 +00:00
parent 68ea3ebd0a
commit 5a02356a3a

View File

@ -238,15 +238,24 @@ TDecoder::~TDecoder()
}
const TString& TDecoder::decode(const char* code)
{
{
if (code == NULL)
code = "";
TObject* obj = objptr(code);
if (obj == NULL)
{
_file->setkey(1);
_file->put(_if, code);
const int err = _file->read();
CHECKS(err == NOERR, "Can't decode ", code);
obj = new TString(_file->get(_of));
{
int err = ~NOERR;
if (*code)
{
_file->setkey(1);
_file->put(_if, code);
err = _file->read();
}
if (err == NOERR)
obj = new TString(_file->get(_of)); // Found
else
obj = new TString(1); // Not found
add(code, obj);
}
const TString& s = (const TString&)*obj;