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:
parent
68ea3ebd0a
commit
5a02356a3a
@ -238,15 +238,24 @@ TDecoder::~TDecoder()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TString& TDecoder::decode(const char* code)
|
const TString& TDecoder::decode(const char* code)
|
||||||
{
|
{
|
||||||
|
if (code == NULL)
|
||||||
|
code = "";
|
||||||
|
|
||||||
TObject* obj = objptr(code);
|
TObject* obj = objptr(code);
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
{
|
{
|
||||||
_file->setkey(1);
|
int err = ~NOERR;
|
||||||
_file->put(_if, code);
|
if (*code)
|
||||||
const int err = _file->read();
|
{
|
||||||
CHECKS(err == NOERR, "Can't decode ", code);
|
_file->setkey(1);
|
||||||
obj = new TString(_file->get(_of));
|
_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);
|
add(code, obj);
|
||||||
}
|
}
|
||||||
const TString& s = (const TString&)*obj;
|
const TString& s = (const TString&)*obj;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user