Patch level : 12.0 no-patch

Files correlati     :
Commento            :

xml.ccp

Aggiunto Append e corretta SetAttr

msksheet.cpp

modificata delete in safe_delete
This commit is contained in:
Alessandro Bonazzi 2020-08-12 14:24:37 +02:00
parent b82b932ff4
commit f1e9dcb75e
5 changed files with 28 additions and 11 deletions

View File

@ -2939,10 +2939,9 @@ bool TSheet_field::is_kind_of(word cid) const
// Certified 100%
TSheet_field::~TSheet_field()
{
if (_sheetfile!=NULL)
delete _sheetfile;
if (_linee_rec!=NULL && !_external_record)
delete _linee_rec;
safe_delete(_sheetfile);
if (!_external_record)
safe_delete(_linee_rec);
}
@ -3899,8 +3898,8 @@ void TSheet_field::check_row(int n, int mode)
// Certified: ...under debug..
void TSheet_field::set_lines_record(TRecord_array & r_a)
{
if (_linee_rec && !_external_record)
delete _linee_rec;
if (!_external_record)
safe_delete(_linee_rec);
_linee_rec= & r_a;
_external_record = true; // il record attuale è esterno...
}
@ -3933,7 +3932,7 @@ TRectype* TSheet_field::putkey(const TRelation& r)
}
return &_sheetfile->curr();
}
return NULL;
return nullptr;
}
// Certified: ...under debug..
@ -3989,7 +3988,7 @@ bool TSheet_field::autoload(const TRelation& rel)
for (int i = 1; i <= last_line; i++)
autoload_line(i,_linee_rec->row(i, true));
return(0);
return false;
}
return _enable_autoload;
}

View File

@ -358,12 +358,15 @@ int TRecord_array::read(TRectype* filter)
#endif
_data.destroy();
set_key(filter);
set_key(filter);
int err = NOERR;
if (!filter->empty())
{
TLocalisamfile f(_file);
TRectype* rec = (TRectype*)filter->dup();
err = rec->read(f, _isgteq);
for (int e = err; e == NOERR && good(*rec); e = rec->next(f))
{

View File

@ -96,7 +96,7 @@ enum TIsamerr {
_islocked = 225, // @emem Record bloccato
_isbadtrc = 226, // @emem Tracciato Record errato o mancante
_istrcerr = 227, // @emem Tracciato record incoerente
_isnowarning = 86552 // @emem Il messaggio di errore è già stato visualizzato
_isnowarning = 86552 // @emem Il messaggio di errore è già stato visualizzato - Doppia puttanata di Mattia Tollari per l'idea e per il valore
};
typedef long TRecnotype;

View File

@ -1,6 +1,7 @@
#include <colors.h>
#include <dongle.h>
#include <real.h>
#include <utility.h>
#include <xml.h>
#include <incstr.h>
@ -142,7 +143,7 @@ TXmlItem& TXmlItem::SetAttr(const char* strAttr, const char* strVal)
if (m_Attributes == NULL)
m_Attributes = new TAssoc_array;
m_Attributes->remove(strAttr);
if (strVal && *strVal)
if (strVal)
m_Attributes->add(strAttr, new TXmlAttr(strVal));
return *this;
}
@ -518,7 +519,11 @@ void TXmlItem::AsString(TString& str) const
{
char* buf = str.get_buffer(nSize);
memset(buf, 0, nSize);
#ifdef WIN32
ostrstream outf(buf, nSize);
#else
ostringstream outf(buf);
#endif
Write(outf, 0);
if (buf[nSize-1] == '\0')
@ -532,6 +537,15 @@ void TXmlItem::Save(const char* strFilename) const
Write(outf, 0);
}
void TXmlItem::Append(const char* strFilename) const
{
bool AppendToExisting = fexist(strFilename);
ofstream outf;
outf.open(strFilename, ios::app);
Write(outf, AppendToExisting);
}
bool TXmlItem::Load(const char* strFilename)
{
bool ok = false;

View File

@ -67,6 +67,7 @@ public:
void Save(const char* strFilename) const;
bool Load(const char* strFilename);
void Append(const char* strFilename) const;
TXmlItem* ForEach(XmlItemCallback cb, long jolly = 0);
TXmlItem* FindFirst(const char* strTag) const; // Recursive