Patch level : 12.0 no-patch
Files correlati : Commento : Aggiunto operatore [] agli string array Corretto errore di creazione browse nel costruttore (era *orderby && *orderby invece di orderby && *orderby) Aggiunte add_input_field e add_output_field con id Aggiunta data nulla (nulldate) Aggiunta definizione del campo virtuale PLAFOND Aggiunta notifica del tasto SHIFT+INS prima dell'aggiunta di una riga per poterla rifiutare o aggiungere le grighe a mano. Sostituira strcpy a strncpy cons strcpy_s strncpy_s (sicure) in prefix
This commit is contained in:
parent
a15418ad08
commit
57eee7a34c
@ -1170,7 +1170,12 @@ bool TAlex_virtual_machine::execute(const TBytecode& bc)
|
||||
|
||||
bool TAlex_virtual_machine::compile(const char* cmd, TBytecode& bc)
|
||||
{
|
||||
#ifdef LINUX
|
||||
string s(cmd);
|
||||
istringstream instr(s);
|
||||
#else
|
||||
istrstream instr((const char*)cmd, strlen(cmd));
|
||||
#endif
|
||||
return compile(instr, bc);
|
||||
}
|
||||
|
||||
|
@ -245,12 +245,14 @@ public:
|
||||
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
|
||||
TToken_string& row(int n)
|
||||
{ return (TToken_string&)operator[](n); }
|
||||
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
|
||||
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
|
||||
const TToken_string& row(int n) const
|
||||
{ return (const TToken_string&)operator[](n); }
|
||||
// @cmember Restituisce il puntatore alla stringa n dell'array (NULL se non esiste)
|
||||
TToken_string* rowptr(int n)
|
||||
{ return (TToken_string*)objptr(n); }
|
||||
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
|
||||
TToken_string& operator[] (int n) const { return (TToken_string&)TArray::operator[](n); }
|
||||
// @cmember assegnamento di un array
|
||||
const TString_array& operator=(const TString_array& a);
|
||||
// @cmember Aggiunge una Token string all'array (chiama <mf TArray::add>)
|
||||
|
@ -204,7 +204,7 @@ TBrowse::TBrowse(TEdit_field* f, TRelation* r, int key, const char* filter, cons
|
||||
_relation(r), _filter(filter), _secondary(false), _alt_browse(NULL),
|
||||
_custom_filter_handler(NULL)
|
||||
{
|
||||
if (*orderby && *orderby)
|
||||
if (orderby && *orderby)
|
||||
_cursor = new TSorted_cursor(r, orderby, "", key);
|
||||
else
|
||||
_cursor = new TCursor (r, "", key);
|
||||
@ -558,7 +558,25 @@ const char* TBrowse::get_input_field_names() const
|
||||
|
||||
void TBrowse::add_input_field(const char * id, const char * name, const int pos, bool select)
|
||||
{
|
||||
TString strid(id) ;
|
||||
TString strid(id);
|
||||
|
||||
if (select)
|
||||
strid << '@';
|
||||
if (pos < 0 || pos >= _items.items())
|
||||
{
|
||||
_inp_id.add(strid);
|
||||
_inp_fn.add(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
_inp_id.insert_at(strid, pos);
|
||||
_inp_fn.insert_at(name, pos);
|
||||
}
|
||||
}
|
||||
|
||||
void TBrowse::add_input_field(short id, const char * name, const int pos, bool select)
|
||||
{
|
||||
TString strid; strid << id;
|
||||
|
||||
if (select)
|
||||
strid << '@';
|
||||
@ -653,6 +671,22 @@ void TBrowse::add_output_field(const char * id, const char * name, const int pos
|
||||
}
|
||||
}
|
||||
|
||||
void TBrowse::add_output_field(short id, const char * name, const int pos)
|
||||
{
|
||||
TString strid; strid << id;
|
||||
|
||||
if (pos < 0 || pos >= _items.items())
|
||||
{
|
||||
_out_id.add(strid);
|
||||
_out_fn.add(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
_out_id.insert_at(strid, pos);
|
||||
_out_fn.insert_at(name, pos);
|
||||
}
|
||||
}
|
||||
|
||||
void TBrowse::remove_output_field(const int pos)
|
||||
{
|
||||
if (pos < 0)
|
||||
|
@ -179,8 +179,10 @@ public:
|
||||
// @cmember Aggiorna la lista completa dei nomi dei campi di input
|
||||
void set_input_field_names(const char * inp_names) { _inp_fn = inp_names;}
|
||||
|
||||
// @cmember Aggiunge un campo di input alla posizione <pos>
|
||||
void add_input_field(const char * id, const char * name, const int pos = - 1, bool select = false);
|
||||
// @cmember Aggiunge un campo di input alla posizione <pos>
|
||||
void add_input_field(const char * id, const char * name, const int pos = -1, bool select = false);
|
||||
// @cmember Aggiunge un campo di input alla posizione <pos>
|
||||
void add_input_field(short id, const char * name, const int pos = -1, bool select = false);
|
||||
|
||||
// @cmember Elimina un campo di display alla posizione <pos>
|
||||
void remove_display_field(const int pos = -1);
|
||||
@ -221,6 +223,8 @@ public:
|
||||
|
||||
// @cmember Aggiunge un campo di output alla posizione <pos>
|
||||
void add_output_field(const char * id, const char * name, const int pos = -1);
|
||||
// @cmember Aggiunge un campo di output alla posizione <pos>
|
||||
void add_output_field(short id, const char * name, const int pos = -1);
|
||||
|
||||
// @cmember Elimina un campo di output alla posizione <pos>
|
||||
void remove_output_field(const int pos = -1);
|
||||
|
@ -296,6 +296,6 @@ const TDate& fnc_max(const TDate& a, const TDate& b);
|
||||
const char* itom(int month);
|
||||
const char* itow(int dayofweek);
|
||||
|
||||
const TDate botime(0,0,0), eotime(31,12,3000);
|
||||
const TDate botime(0,0,0), eotime(31,12,3000), nulldate(NULLDATE);
|
||||
|
||||
#endif // __DATE_H
|
||||
|
@ -104,7 +104,7 @@
|
||||
#define DOC_NOINVIOSDI "NOINVIOSDI"
|
||||
|
||||
// Virtuali
|
||||
|
||||
#define DOC_PLAFOND "PLAFOND"
|
||||
// modulo pe
|
||||
#define DOC_SPESEUPD "SPESEUPD"
|
||||
#define DOC_USEK "USEK"
|
||||
|
@ -2874,9 +2874,8 @@ bool TEdit_field::check(CheckTime t)
|
||||
|
||||
void TEdit_field::set_query_button(TBrowse_button * brw)
|
||||
{
|
||||
if (_browse)
|
||||
delete _browse;
|
||||
_browse=brw;
|
||||
safe_delete(_browse);
|
||||
_browse = brw;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
@ -1371,7 +1371,8 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
}
|
||||
}
|
||||
else
|
||||
add_row_auto();
|
||||
if (notify(_cur_rec, K_SHIFT + K_INS))
|
||||
add_row_auto();
|
||||
}
|
||||
break;
|
||||
case XIE_SELECT:
|
||||
@ -1754,6 +1755,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
notify(_cur_rec, K_DEL))
|
||||
{
|
||||
int rec = _cur_rec;
|
||||
|
||||
_row_dirty = _cell_dirty = false;
|
||||
destroy(rec);
|
||||
if (rec < items())
|
||||
@ -1771,9 +1773,14 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
}
|
||||
break;
|
||||
case K_CTRL + '+': // ********* insert line
|
||||
add_row_auto();
|
||||
refused = true;
|
||||
break;
|
||||
{
|
||||
int rec = _cur_rec;
|
||||
|
||||
if (notify(rec, K_SHIFT + K_INS))
|
||||
add_row_auto();
|
||||
refused = true;
|
||||
}
|
||||
break;
|
||||
case K_CTRL + 'A':
|
||||
{
|
||||
_check_enabled = false;
|
||||
@ -3681,7 +3688,10 @@ bool TSheet_field::on_key(KEY k)
|
||||
if (k == K_CTRL+'+')
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
s->add_row_auto();
|
||||
int rec = s->_cur_rec;
|
||||
|
||||
if (s->notify(rec, K_SHIFT + K_INS))
|
||||
s->add_row_auto();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,12 @@ bool TPostman::dispatch_transaction(const TRectype& rec,
|
||||
TSocketClient socket;
|
||||
char * buf = new char[1024 * 256];
|
||||
|
||||
#ifdef WIN32
|
||||
ostrstream stream(buf, 1024 * 256);
|
||||
#else
|
||||
ostringstream stream(buf);
|
||||
#endif
|
||||
|
||||
bool ok = true;
|
||||
|
||||
item.SetTag("m:CampoTransaction");
|
||||
|
@ -495,7 +495,7 @@ const TFilename& TFile_info::load_filedes()
|
||||
{
|
||||
_dir = _filedes.SysName[0] != '$' ? _comdir : _nordir;
|
||||
_name = CAddPref(_filedes.SysName);
|
||||
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
|
||||
strncpy_s(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
|
||||
}
|
||||
else
|
||||
_name.cut(0);
|
||||
@ -534,7 +534,7 @@ TFile_info::TFile_info(int logicnum, TFilename& name)
|
||||
int err = DB_recinfo(_name, &_filedes, (RecDes*)&rec.rec(), keys.get_buffer());
|
||||
if (err == NOERR && prefix().add_recdes(logicnum, rec, keys))
|
||||
{
|
||||
strncpy(_filedes.SysName, _name, sizeof(_filedes.SysName));
|
||||
strncpy_s(_filedes.SysName, _name, sizeof(_filedes.SysName));
|
||||
_filedes.SysName[41] = '\0';
|
||||
}
|
||||
else
|
||||
@ -1036,7 +1036,7 @@ void TPrefix::set(
|
||||
{
|
||||
const TString saved_prf = __ptprf; // Salvo __ptprf che viene cambiato da CGetPref
|
||||
char* prfx = (char*)CGetPref(); // Safe non const cast for StPath cprefix
|
||||
strcpy(__ptprf, saved_prf);
|
||||
strcpy_s(__ptprf, saved_prf);
|
||||
xvt_fsys_build_pathname(prfx, NULL, __ptprf, _prefix, NULL, NULL);
|
||||
}
|
||||
else
|
||||
@ -1168,7 +1168,7 @@ bool TPrefix::set_studio(const char* study, long ditta)
|
||||
const TString old_firm(_prefix);
|
||||
|
||||
strcpy_s(__ptprf, sizeof(__ptprf), study);
|
||||
const word len = strlen(__ptprf);
|
||||
const word len = (word) strlen(__ptprf);
|
||||
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
|
||||
{
|
||||
__ptprf[len] = SLASH;
|
||||
|
@ -19,7 +19,7 @@ word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||
word lines = 0;
|
||||
FOR_EACH_TOKEN(s, t)
|
||||
{
|
||||
const word l = strlen(t);
|
||||
const word l = (word) strlen(t);
|
||||
if (l > maxlen) maxlen = l;
|
||||
lines++;
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ void TPrint_preview_window::page_select()
|
||||
_page = m.get_int(101);
|
||||
if (_page < 1) _page = 1;
|
||||
if (_page > _book->pages())
|
||||
_page = _book->pages();
|
||||
_page = (word)_book->pages();
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,8 +533,8 @@ long TPrint_preview_window::handler(WINDOW win, EVENT* ep)
|
||||
if (processed) _page++;
|
||||
break;
|
||||
case POPUP_LAST :
|
||||
processed = _page < _book->pages();
|
||||
if (processed) _page = _book->pages();
|
||||
processed = _page < (word) _book->pages();
|
||||
if (processed) _page = (word) _book->pages();
|
||||
break;
|
||||
case POPUP_ZOOMIN : if (_zoom < SCREENDPI*4) { _zoom += SCREENDPI/8; update_scroll_range(); } break;
|
||||
case POPUP_ZOOMOUT: if (_zoom > SCREENDPI/4) { _zoom -= SCREENDPI/8; update_scroll_range(); } break;
|
||||
@ -2452,7 +2452,7 @@ bool TReport_book::open_page()
|
||||
if (!TBook::open_page())
|
||||
return false;
|
||||
|
||||
_report->set_page(++_rep_page, page());
|
||||
_report->set_page((word) ++_rep_page, (word) page());
|
||||
|
||||
_page_break_allowed = false;
|
||||
_delta.reset();
|
||||
|
@ -24,7 +24,8 @@ bool sirio_codesigning(const TFilename& filename, bool verify = false);
|
||||
#define SIRIOSIGN(filename) sirio_codesigning((const TFilename&)((filename)), false)
|
||||
#define SIRIOSIGN_VERIFY(filename) sirio_codesigning((const TFilename&)((filename)), true)
|
||||
|
||||
template<typename T> void safe_delete(T*& a) {
|
||||
template<typename T> void safe_delete(T*& a)
|
||||
{
|
||||
delete a;
|
||||
a = nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user