diff --git a/include/relation.cpp b/include/relation.cpp index f0065ca2a..bc8813364 100755 --- a/include/relation.cpp +++ b/include/relation.cpp @@ -935,7 +935,7 @@ FILE* TCursor::open_index( bool create) // @parm Indica se creare l'indice nel caso manchi (default FALSE) { _last_created = create; - if (create || _indexname.empty()) + if (/*create ||*/ _indexname.empty()) { TString16 radix; radix.format("c%d_", file().num()); @@ -969,34 +969,37 @@ void TCursor::close_index(FILE* f) TRecnotype TCursor::buildcursor(TRecnotype rp) { - TRecnotype oldrecno=0,pos,ap = 0; - int junk, l, pagecnt = 0; - const bool filtered = has_filter(); - FILE* _f = open_index(TRUE); - +// rewind(_f); const int handle = file().handle(); - if (DB_reccount(handle) == 0) { close_index(_f); return 0; } - - rewind(_f); - l = strlen(to()); - junk=DB_index_seek(handle, (char*)(const char*) from()); - if (junk < 0) junk=get_error(junk); - if (junk == _iseof) return 0; + const int l = strlen(to()); + int junk = DB_index_seek(handle, (char*)(const char*) from()); + if (junk < 0) junk = get_error(junk); + if (junk == _iseof) + { + close_index(_f); + return 0; + } + + TRecnotype oldrecno=0,ap = 0; + int pagecnt = 0; + const bool filtered = has_filter(); TRecnotype* page = new TRecnotype [CMAXELPAGE]; - pos = DB_index_recno(handle); + TRecnotype pos = DB_index_recno(handle); _pos=-1; while (TRUE) { - if (DB_index_eof(handle)) break; + if (DB_index_eof(handle)) + break; + const char* s0 = DB_index_getkey(handle); const TRecnotype recno = DB_index_recno(handle); if (l && (strncmp(to(), s0, l) < 0)) break; @@ -1295,9 +1298,7 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop) else { FILE* _f = open_index(); - - if (fseek(_f, 0L, SEEK_SET) != 0) - fatal_box("Can't repos cursor : File %d\n", curfile.num()); + rewind(_f); TRecnotype *page = new TRecnotype [CMAXELPAGE]; int pagecnt; @@ -1369,7 +1370,6 @@ TRecnotype TCursor::readrec() file().setstatus(NOERR); FILE* _f = open_index(); - if (fseek(_f, _pos * sizeof(TRecnotype), SEEK_SET) != 0) fatal_box("Can't seek position %ld in cursor n. %d\n", _pos, file().num()); diff --git a/include/utility.cpp b/include/utility.cpp index 6d5d39681..a51a71f35 100755 --- a/include/utility.cpp +++ b/include/utility.cpp @@ -33,13 +33,14 @@ bool fcopy( return TRUE; // Or FALSE? FILE* i = fopen(orig, rflag); - if (!i) return error_box("Impossibile leggere il file %s", orig); + if (i == NULL) + return error_box("Impossibile leggere il file %s\nda copiare in ", orig, dest); FILE* o = fopen(dest, wflag); - if (!o) + if (o == NULL) { fclose(i); - return error_box("Impossibile scrivere il file ", dest); + return error_box("Impossibile creare il file %s\nper copiare il file %s", dest, orig); } const word size = 16*1024; diff --git a/include/viswin.cpp b/include/viswin.cpp index f7f3ffb4e..60f5663cc 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -1876,7 +1876,7 @@ bool TViswin::on_key (KEY key) check_link (&_point); break; case K_ESC: - if (_isopen) + if (_isopen && _toplevel) abort_print (); else { diff --git a/include/viswin.h b/include/viswin.h index 2cae67b7a..eeaf87c32 100755 --- a/include/viswin.h +++ b/include/viswin.h @@ -311,7 +311,7 @@ public: // @cmember Sposta la visualizzazione di stampa alla posizione indicata void goto_pos(long r, long c, bool moveorigin = TRUE); - // @cmember Opera un ridisegno della pgina di anteprima a video + // @cmember Opera un ridisegno della pagina di anteprima a video void refresh(); // @cmember Indica se mostrare o no il righello diff --git a/include/xvtility.cpp b/include/xvtility.cpp index 47e41e949..6e1c70f3a 100755 --- a/include/xvtility.cpp +++ b/include/xvtility.cpp @@ -560,12 +560,12 @@ void xvt_statbar_set( if (_statbar) { const TDate oggi(TODAY); - TString t(31); + TString80 t; t << text << '\t' << oggi.string() << " - " << main_app().title(); if (def) - statbar_set_default_title(_statbar, (char*)(const char*)t); - statbar_set_title(_statbar, (char*)(const char*)t); + statbar_set_default_title(_statbar, t.get_buffer()); + statbar_set_title(_statbar, t.get_buffer()); } }