From 39102f264b7d4820f7f0241fcb19643da97a29ed Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 21 Oct 2003 11:10:01 +0000 Subject: [PATCH] Patch level : 2.0 610 Files correlati : cg1.exe cg3.exe sc2.exe Ricompilazione Demo : [ ] Commento : AO20112 Migliorate prestazioni stampe con dati condivisi in rete. ATTENZIONE: verificare anche altri programmi con stampe pesanti git-svn-id: svn://10.65.10.50/trunk@11518 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/isam.cpp | 40 ++++++++++++++++++++++++++++++---------- include/maskfld.cpp | 2 +- include/strings.cpp | 18 ++++++++---------- include/utility.cpp | 11 ++++++----- 4 files changed, 45 insertions(+), 26 deletions(-) diff --git a/include/isam.cpp b/include/isam.cpp index 9a6c3c5e4..511bdbec4 100755 --- a/include/isam.cpp +++ b/include/isam.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1125,8 +1126,12 @@ int TBaseisamfile::_rewrite(const TRectype& rec) _recno = DB_recno(fhnd); prefix().unlock_record(_isam_handle, _recno); - if(_lasterr == NOERR && curr().has_memo( )) - ((TRectype &)rec).write_memo(_isam_handle, _recno ); + if(_lasterr == NOERR) + { + if (curr().has_memo( )) + ((TRectype &)rec).write_memo(_isam_handle, _recno ); + rec_cache(_logicnum).notify_change(); + } } return _lasterr; @@ -1155,8 +1160,14 @@ int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec) } else _lasterr = get_error(_lasterr); _recno = DB_recno(fhnd); - if(_lasterr == NOERR && curr().has_memo( )) - ((TRectype &)rec).write_memo(_isam_handle, _recno ); + + if(_lasterr == NOERR) + { + if (curr().has_memo( )) + ((TRectype &)rec).write_memo(_isam_handle, _recno ); + rec_cache(_logicnum).notify_change(); + } + return _lasterr; } @@ -1197,8 +1208,12 @@ int TBaseisamfile::_remove(const TRectype& rec) } } - if(_lasterr == NOERR && curr().has_memo()) - curr().init_memo(); + if(_lasterr == NOERR) + { + if (curr().has_memo( )) + curr().init_memo(); + rec_cache(_logicnum).notify_change(); + } return _lasterr; } @@ -1410,12 +1425,13 @@ bool TBaseisamfile::get_relapp(TString& app) const bool TBaseisamfile::is_changed_since(long& last) const { - bool yes = FALSE; - const int fh = ::_sopen(filename(), _O_RDONLY, _SH_DENYNO); + bool yes = FALSE; + + const int fh = ::sopen(filename(), _O_RDONLY, _SH_DENYNO); if (fh > 0) { - struct _stat stat; - if (::_fstat(fh, &stat) == 0) + struct stat stat; + if (::fstat(fh, &stat) == 0) { const long tim = long(stat.st_mtime) ^ long(stat.st_size); yes = tim != last; @@ -1423,6 +1439,7 @@ bool TBaseisamfile::is_changed_since(long& last) const } ::_close(fh); } + return yes; } @@ -3520,6 +3537,9 @@ bool TRectype::edit(int logicnum, const char * alternate_key_fields) const TExternal_app a(app); ok = a.run() == 0; xvt_fsys_removefile(ininame); + + if (ok) + rec_cache(logicnum).notify_change(); } return ok; } diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 576171118..ed55746f2 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -2384,7 +2384,7 @@ bool TBrowse::do_link(bool insert) ok = _cursor->ok(); if (ok) { - rec_cache(_cursor->file().num()).destroy(); // Svuota eventule cache + rec_cache(_cursor->file().num()).notify_change(); // Svuota eventule cache do_output(); } } diff --git a/include/strings.cpp b/include/strings.cpp index 688db9487..08b9697ff 100755 --- a/include/strings.cpp +++ b/include/strings.cpp @@ -797,17 +797,14 @@ TString& TString::format( // @comm Funziona come la funzione "sprintf" standard del C e ritorna la // stringa formattata con i parametri passati. { - TString& spark = get_tmp_string(512); + char spark[512]; va_list pars; va_start(pars, fmt); - const int tot = vsprintf(spark.get_buffer(), fmt, pars); + const int tot = vsprintf(spark, fmt, pars); va_end(pars); - CHECK(tot >= 0 && tot < spark.size(), "Ue'! Quanto scrivi?"); - if (tot > size()) resize(tot, FALSE); - strcpy(_str, spark); - - return *this; + CHECK(tot < sizeof(spark), "Ue'! Quanto scrivi?"); + return set(spark); } // Certified 99% @@ -1935,13 +1932,14 @@ TToken_string& get_tmp_string(int len) static int next = 0; TToken_string* str = (TToken_string*)ararar.objptr(next); - if (str == NULL || str->size() < len) + if (str == NULL) { str = new TToken_string(len); ararar.add(str, next); } - else - str->cut(0); + if (str->size() < len) + str->spaces(len); + str->cut(0); if (++next >= ararar.size()) next = 0; diff --git a/include/utility.cpp b/include/utility.cpp index e97918ec4..7b75b3a84 100755 --- a/include/utility.cpp +++ b/include/utility.cpp @@ -204,15 +204,16 @@ char* format( { va_list pars; - TString& tmp = get_tmp_string(512); - char* buf = tmp.get_buffer(); - + char buf[512]; va_start(pars, fmt); const int tot = vsprintf(buf, fmt, pars); va_end(pars); - CHECK(tot >= 0 && tot < 512, "Ue'! Ma quanto scrivi?"); - return buf; + CHECK(tot < 512, "Ue'! Ma quanto scrivi?"); + TString& tmp = get_tmp_string(); + tmp = buf; + + return tmp.get_buffer(); } // @doc EXTERNAL