From 4127fc0dce0503cb52b0f65dc4b9428fe71997f9 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 12 Mar 2004 15:18:14 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://10.65.10.50/trunk@11843 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/filetext.cpp | 34 ++++++++++++++---------- include/form.cpp | 61 ++++++++++++++++++++++++++------------------ 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/include/filetext.cpp b/include/filetext.cpp index 7f9347e92..c535bf369 100755 --- a/include/filetext.cpp +++ b/include/filetext.cpp @@ -7,14 +7,15 @@ // Ritorna TRUE se la stringa e' piena di zero static bool zero_only(const TString& v) { - for (int i = v.len()-1; i>=0 && v[i]=='0'; i--); + int i; + for (i = v.len()-1; i>=0 && v[i]=='0'; i--); return i<0; } //////////////////////////////////////// TTracciato_Campo //////////////////////////////////////// TTracciato_campo::TTracciato_campo(int position, int length, int decimal, const char align, const char filler) - : _position(position), _length(length), _decimal(decimal), - _datatype('S'), _align(align), _filler(filler) + : _datatype('S'), _position(position), _length(length), + _decimal(decimal), _align(align), _filler(filler) {} TObject* TTracciato_campo::dup() const @@ -120,7 +121,9 @@ void TTracciato_record::add(TTracciato_campo* tc, int pos) int TTracciato_record::get_pos(const char* name) const { - for (int i = _tracciati_campo.last(); i >= 0; i = _tracciati_campo.pred(i)) + int i; + + for (i = _tracciati_campo.last(); i >= 0; i = _tracciati_campo.pred(i)) { const TTracciato_campo& tc = get(i); if (tc.name() == name) @@ -164,9 +167,9 @@ TTracciato_record* TFile_text::t_rec(int mainfile, const char * tabname) const if (tabname) mainfile=(tabname[0] != '%') ? LF_TAB: LF_TABCOM; TTracciato_record *trrd; - TAssoc_array &tr= ((TFile_text *)this)->_tracciati_record; + TAssoc_array &tr = (((TFile_text *)this)->_tracciati_record); tr.restart(); - while (trrd=(TTracciato_record *)tr.get()) + while ((trrd=(TTracciato_record *)tr.get())) { if (trrd->relation() && trrd->relation()->lfile().num()==mainfile) if (tabname) @@ -269,7 +272,7 @@ void TFile_text::set_rec_parm(TConfig& config, const char* section) } if (lavoro == "USE") // setta la relazione { - CHECKS(tmprel==NULL,"Relazione già definita per il tracciato: %s",sectkey); + CHECKS(tmprel == NULL,"Relazione già definita per il tracciato: %s", (const char *) sectkey); if (atoi((const char *)obj)!=0) tmprel= new TRelation(atoi((const char *)obj)); else @@ -347,7 +350,7 @@ void TFile_text::set_rec_parm(TConfig& config, const char* section) } if (lavoro == "FTY") // field type { - CHECKS(_tipi.objptr(obj)!=NULL,"Riferimento a campo inesistente:%s",obj); + CHECKS(_tipi.objptr(obj)!=NULL,"Riferimento a campo inesistente:%s", (const char *) obj); tc.set_ftype(obj); continue; } @@ -570,7 +573,6 @@ int TFile_text::write(TRecord_text& rec) const TString& type = rec.type(); TTracciato_record& tr = *t_rec(type); - TArray& a_tc = tr.tracciati_campo(); const int items = rec.items(); if (_typepos>=0) rec.add(type,_typepos); @@ -817,7 +819,7 @@ void TFile_text::add_field(TRecord_text& rec, const int ncampo, const char* val) { TTracciato_record* tr = t_rec(rec.type()); CHECKS(tr, "Tracciato inesistente ", (const char*)rec.type()); - TTracciato_campo& tc = tr->get(ncampo); + tr->get(ncampo); rec.add(val, ncampo); } @@ -917,7 +919,8 @@ TString& TFile_text::format_textfield(const TTracciato_campo& tc, TString& campo break; case 'D': //data { - TFormatted_date tmp(TDate (campo),tc.picture()); + TDate d(campo); + TFormatted_date tmp(d, tc.picture()); campo=tmp.string(); } break; @@ -994,7 +997,11 @@ int TFile_text::open(char mode) if (_read_file) delete _read_file; +#ifdef WIN32 _read_file = new ifstream(_name, ios::binary | ios::nocreate); +#else + _read_file = new ifstream(_name, ios::binary); +#endif if (!ok_r()) { error_box("Impossibile aprire il file %s in lettura", (const char *)_name); @@ -1010,8 +1017,9 @@ int TFile_text::open(char mode) } else if (_recordsep.not_empty()) { - int s = _skiplines; - for (int c = _read_file->get(); c != EOF; c = _read_file->get()) + int s = _skiplines; + int c; + for (c = _read_file->get(); c != EOF; c = _read_file->get()) { if (c == _recordsep[0]) { diff --git a/include/form.cpp b/include/form.cpp index 89ddceb8c..b9e6492ca 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -109,9 +109,9 @@ void TForm_flags::print_on(ostream& out) const // TForm_item /////////////////////////////////////////////////////////// TForm_item::TForm_item(TPrint_section* section) -: _section(section), _x(-1), _y(-1), _width(0), - _height(0),_effective_height(0), _id(0), _ofs(0), - _temp(FALSE) +: _temp(FALSE), _section(section), _id(0), _x(-1), _y(-1), + _width(0), _height(0), _effective_height(0), + _ofs(0) {} void TForm_item::copy_to_form_item(TForm_item* fi) const @@ -611,7 +611,9 @@ bool TForm_item::update() if (_prompt.right(1) == "#") { TString prompt(_prompt); - for (int i = prompt.len()-2; i >= 0; i--) + int i; + + for (i = prompt.len()-2; i >= 0; i--) if (prompt[i] != '#') break; prompt.cut(i+1); string_at(x(), _y, prompt); @@ -670,9 +672,10 @@ short TForm_item::x() TForm_subsection::TForm_subsection(TPrint_section* s, const char* nm) - : TForm_item(s), _ssec(&(s->form()), s->section_type(), s->page_type()), - _file_id(-1), _name(nm), _condexpr(NULL), - _title_section(NULL),_qtitle_section(NULL),_title_type(type_notitle),_show_title(FALSE) + : TForm_item(s), _title_section(NULL), _qtitle_section(NULL), + _ssec(&(s->form()), s->section_type(), s->page_type()), + _name(nm), _title_type(type_notitle), + _show_title(FALSE), _file_id(-1), _condexpr(NULL) { _ssec.set_subsection_above(this); } @@ -909,7 +912,6 @@ bool TForm_subsection::print_body(sec_print_mode showfields) bool at_newpage=(atnewpage() || printer().rows_left() < (word)minheight()); bool ok = FALSE; TCursor* cur = form().cursor(); - TRelation* rel = (TRelation* )form().relation(); set_effective_height(0); // resetta l'altezza della sottosezione al suo "minimo" @@ -1079,7 +1081,9 @@ void TForm_string::put_paragraph(const char* s) lines = _prompt; lines << s; TParagraph_string p(lines, width()); - for (int i=0; (s = p.get()) != NULL && i < h; i++) + int i; + + for (i = 0; (s = p.get()) != NULL && i < h; i++) string_at(x(), _y+i, s); _effective_height = i; @@ -1137,7 +1141,8 @@ void TForm_string::apply_format(TString& s) const if (ld > 0) // Se il primo delimitatore e' valido ... { - for (int spc = 0;s[spc]==' ' ; spc++) ; + int spc; + for (spc = 0;s[spc]==' ' ; spc++) ; if (spc < ld) { TString16 spazi; @@ -1358,7 +1363,9 @@ void TForm_number::apply_format(TString& s) const if (ld > 0) // Se il primo delimitatore e' valido ... { - for (int spc = 0;s[spc]==' ' ; spc++) ; + int spc; + + for (spc = 0;s[spc]==' ' ; spc++) ; if (spc < ld) { TString16 spazi; @@ -1449,8 +1456,8 @@ const char* TForm_currency::get() const TCurrency TForm_currency::get_currency() const { - const TString& codval = _driver ? _driver->get() : form().get_curr_codval(); - const real n(get()); + const char * codval = _driver ? _driver->get() : (const char *) form().get_curr_codval(); + const real n(get()); return TCurrency(n, codval, ZERO, _exchange_undefined, _flag.price != 0); } @@ -1985,7 +1992,7 @@ bool TForm_picture::update() const int pos = i.find('|'); if (pos >= 0) i.cut(pos); - if (stricmp(i.ext(), "bmp") == 0) + if (xvt_str_compare_ignoring_case(i.ext(), "bmp") == 0) { i.replace('\\', '/'); i.trim(); @@ -2149,9 +2156,9 @@ TExpression & TPrint_section::eval_expr(TExpression & expr,int defaultfile_id) } TPrint_section::TPrint_section(TForm* f, char st, pagetype pt, TForm_subsection* father) -: _height(0), _form(f), _sec_type(st), _page_type(pt), _dirty(FALSE), - _upsection(father), _repeat_count(0), _ofspc(0), _ofsvr(0), _nfld(0), _temp(0), - _columnwise(FALSE) +: _height(0), _ofspc(0), _ofsvr(0), _nfld(0), _dirty(FALSE), + _columnwise(FALSE), _temp(0), _form(f), _sec_type(st), _page_type(pt), + _upsection(father), _repeat_count(0) { reset_tabs(); } @@ -2274,7 +2281,9 @@ int TPrint_section::tab(int col) // compute column offset _nfld = 0; short maxcolreached = 0,mincolreached = MAXCOLUMNS+1; - for (word i = 0; i < fields(); i++) + word i; + + for (i = 0; i < fields(); i++) { const TForm_item& fi = field(i); if (!fi.is_section() && fi.shown()) @@ -2509,7 +2518,9 @@ TForm_item& TPrint_section::find_field(const char *sec_name) const TForm_item *TPrint_section::find_field_everywhere(const char *sec_name,const TPrint_section *starting_section) const { // search here - for (int j = 0; j < subsections(); j++) { + int j; + + for (j = 0; j < subsections(); j++) { const char *n=subsection(j)->name(); if (strcmp(n,sec_name)==0) return subsection(j); @@ -2664,7 +2675,7 @@ bool TForm::parse_sortedjoin(TScanner& scanner) TString16 subj(scanner.pop()); // File or table parse_join_param(scanner,sortrel,subj,atoi(j)); } else - yesnofatal_box("Token non riconosciuto in SORT:%s",scanner.key()); + yesnofatal_box("Token non riconosciuto in SORT:%s", (const char *) scanner.key()); } int to = 0; @@ -2723,7 +2734,7 @@ TToken_string TForm::parse_sortexpr(TScanner& scanner) TToken_string sortexp; TToken_string se(scanner.line(),' '); const char * c; - while (c=se.get()) + while ((c=se.get())) if (*c!='\0') sortexp.add(c); return sortexp; @@ -3185,7 +3196,7 @@ bool TPrint_section::update_and_print(const sec_print_mode show_fields, bool new { pr.formfeed(); } - int repeat_count=0; // numero di sottosezioni stampate o numero di stampe della stessa sottosezione + int last_hpos=0; for (word i = 0; i < fields(); i++) { @@ -3426,7 +3437,8 @@ bool TForm::genera_fincatura( if (grs->field(k-1).temp()) grs->destroy_field(k-1); - for (int i = 0; i < (int)body->fields(); i++) + int i; + for (i = 0; i < (int)body->fields(); i++) { TForm_item& f = body->field(i); if (!f.shown() || f.is_section()) @@ -3988,7 +4000,7 @@ bool TForm::validate(TForm_item &cf, TToken_string &s) // è un'espressione del tipo = // è un'espressione di costanti numeriche, stringhe e valori di campi della form (indicati con il loro numero preceduto da #) // è un'espressione del tipo = (se è un gruppo deve essere seguito da @) oppure solo (il campo della form è quello corrente) - int i, j, poseq, posrv, itms; + int i, j, poseq, posrv = 0, itms; pagetype pt; char sec; TLocalisamfile *file; @@ -4130,7 +4142,6 @@ bool TForm::validate(TForm_item &cf, TToken_string &s) if (in[0]== '#') in.ltrim(1); TForm_item &fi= cf.find_field(in); - int i= 2; for (const char * cmd = s.get(); cmd != NULL; cmd = s.get()) { // Calcola la nuova posizione TString align(cmd);