Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
realtion.cpp    Corretta gestione cancellazione file indice dei cursori
utility.cpp     Aggiustati messaggi d'errore nella fcopy
viswin.*        Eliminata richiesta di conferma Esc quanto non e' toplevel
xvtility.cpp    Cambiata in TString80 la stringa della status bar


git-svn-id: svn://10.65.10.50/trunk@6950 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-08-10 10:28:11 +00:00
parent ca3715012a
commit 1e0ec20f1b
5 changed files with 28 additions and 27 deletions

View File

@ -935,7 +935,7 @@ FILE* TCursor::open_index(
bool create) // @parm Indica se creare l'indice nel caso manchi (default FALSE) bool create) // @parm Indica se creare l'indice nel caso manchi (default FALSE)
{ {
_last_created = create; _last_created = create;
if (create || _indexname.empty()) if (/*create ||*/ _indexname.empty())
{ {
TString16 radix; TString16 radix;
radix.format("c%d_", file().num()); radix.format("c%d_", file().num());
@ -969,34 +969,37 @@ void TCursor::close_index(FILE* f)
TRecnotype TCursor::buildcursor(TRecnotype rp) 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); FILE* _f = open_index(TRUE);
// rewind(_f);
const int handle = file().handle(); const int handle = file().handle();
if (DB_reccount(handle) == 0) if (DB_reccount(handle) == 0)
{ {
close_index(_f); close_index(_f);
return 0; return 0;
} }
rewind(_f);
l = strlen(to()); const int l = strlen(to());
junk=DB_index_seek(handle, (char*)(const char*) from()); int junk = DB_index_seek(handle, (char*)(const char*) from());
if (junk < 0) junk=get_error(junk); if (junk < 0) junk = get_error(junk);
if (junk == _iseof) return 0; 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]; TRecnotype* page = new TRecnotype [CMAXELPAGE];
pos = DB_index_recno(handle); TRecnotype pos = DB_index_recno(handle);
_pos=-1; _pos=-1;
while (TRUE) while (TRUE)
{ {
if (DB_index_eof(handle)) break; if (DB_index_eof(handle))
break;
const char* s0 = DB_index_getkey(handle); const char* s0 = DB_index_getkey(handle);
const TRecnotype recno = DB_index_recno(handle); const TRecnotype recno = DB_index_recno(handle);
if (l && (strncmp(to(), s0, l) < 0)) break; if (l && (strncmp(to(), s0, l) < 0)) break;
@ -1295,9 +1298,7 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop)
else else
{ {
FILE* _f = open_index(); FILE* _f = open_index();
rewind(_f);
if (fseek(_f, 0L, SEEK_SET) != 0)
fatal_box("Can't repos cursor : File %d\n", curfile.num());
TRecnotype *page = new TRecnotype [CMAXELPAGE]; TRecnotype *page = new TRecnotype [CMAXELPAGE];
int pagecnt; int pagecnt;
@ -1369,7 +1370,6 @@ TRecnotype TCursor::readrec()
file().setstatus(NOERR); file().setstatus(NOERR);
FILE* _f = open_index(); FILE* _f = open_index();
if (fseek(_f, _pos * sizeof(TRecnotype), SEEK_SET) != 0) if (fseek(_f, _pos * sizeof(TRecnotype), SEEK_SET) != 0)
fatal_box("Can't seek position %ld in cursor n. %d\n", _pos, file().num()); fatal_box("Can't seek position %ld in cursor n. %d\n", _pos, file().num());

View File

@ -33,13 +33,14 @@ bool fcopy(
return TRUE; // Or FALSE? return TRUE; // Or FALSE?
FILE* i = fopen(orig, rflag); 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); FILE* o = fopen(dest, wflag);
if (!o) if (o == NULL)
{ {
fclose(i); 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; const word size = 16*1024;

View File

@ -1876,7 +1876,7 @@ bool TViswin::on_key (KEY key)
check_link (&_point); check_link (&_point);
break; break;
case K_ESC: case K_ESC:
if (_isopen) if (_isopen && _toplevel)
abort_print (); abort_print ();
else else
{ {

View File

@ -311,7 +311,7 @@ public:
// @cmember Sposta la visualizzazione di stampa alla posizione indicata // @cmember Sposta la visualizzazione di stampa alla posizione indicata
void goto_pos(long r, long c, bool moveorigin = TRUE); 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(); void refresh();
// @cmember Indica se mostrare o no il righello // @cmember Indica se mostrare o no il righello

View File

@ -560,12 +560,12 @@ void xvt_statbar_set(
if (_statbar) if (_statbar)
{ {
const TDate oggi(TODAY); const TDate oggi(TODAY);
TString t(31); TString80 t;
t << text << '\t' << oggi.string() << " - " << main_app().title(); t << text << '\t' << oggi.string() << " - " << main_app().title();
if (def) if (def)
statbar_set_default_title(_statbar, (char*)(const char*)t); statbar_set_default_title(_statbar, t.get_buffer());
statbar_set_title(_statbar, (char*)(const char*)t); statbar_set_title(_statbar, t.get_buffer());
} }
} }