From 25a5d5d8bc7e6bba36759159fdc4c104a75a22ab Mon Sep 17 00:00:00 2001 From: sauro Date: Tue, 14 Oct 1997 08:26:26 +0000 Subject: [PATCH] Corretti i filler Corretto l'uso della lunghezza del campo Corretto bug di autosave git-svn-id: svn://10.65.10.50/trunk@5364 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/filetext.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/include/filetext.cpp b/include/filetext.cpp index de23e1bd8..3d192a978 100755 --- a/include/filetext.cpp +++ b/include/filetext.cpp @@ -279,14 +279,19 @@ void TFile_text::set_rec_parm(TConfig& config, const char* section) } if (lavoro == "FIL") { - if (!obj.blank()) - { - bool condition = tc.filler() != obj[1]; - if (condition) - tc.set_filler(obj[0]); - } - continue; - } + if (!obj.blank()) + { + bool condition = tc.filler() != obj[1]; + if (condition) + { + if (obj.len() > 1) + tc.set_filler(obj[1]); + else + tc.set_filler(obj[0]); + } + } + continue; + } if (lavoro == "PIC") { if (tc.picture().blank() && (!obj.blank())) @@ -428,7 +433,9 @@ int TFile_text::write(TRecord_text& rec) const TString& type = rec.type(); TTracciato_record& tr = *t_rec(type); TArray& a_tc = tr.tracciati_campo(); - int items = rec.items(); + int items = rec.items(); + if (_typepos>=0) + rec.add(type,_typepos); if (_fixedlen) // campi a lunghezza fissa { for (int i = 0; i < items; i++) @@ -467,7 +474,8 @@ int TFile_text::write(TRecord_text& rec) return 0; } -//Carica tutti i dati nel tracciato record (valido anche per header e footer) nel record_text +// Carica tutti i dati del tracciato record (anche header o footer) +// nel record_text void TFile_text::autoload(TRecord_text& rec, int mainfile) { TTracciato_record* tr = t_rec(mainfile); @@ -520,8 +528,9 @@ int TFile_text::autosave(int mainfile, const TRecord_text& rec) const TString& type = rec.type();//prendo il tracciato record del tipo del record_text TTracciato_record* tr = t_rec(type); if (tr) - if (tr->relation()->lfile().num()==mainfile) - return _autosave(*(tr->relation()),rec, *tr); + if (tr->relation()) + if (tr->relation()->lfile().num()==mainfile) + return _autosave(*(tr->relation()),rec, *tr); return NOERR; // l'assenza del tracciato non significa un errore } @@ -691,7 +700,7 @@ TString& TFile_text::format_field(const TTracciato_campo& tc, TString& campo) { const TRectype record(tc.field().file()); - int length = record.length(tc.name()); + int length = tc.field().len(record); if (!fpicture(tc).blank()) { TString tmp; tmp.picture(fpicture(tc), campo);