diff --git a/src/include/alex.cpp b/src/include/alex.cpp index 12cdfa7c9..37dd01e0f 100755 --- a/src/include/alex.cpp +++ b/src/include/alex.cpp @@ -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); } diff --git a/src/include/array.h b/src/include/array.h index 210d2a20f..5bd98d5bb 100755 --- a/src/include/array.h +++ b/src/include/array.h @@ -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 ) diff --git a/src/include/brwbut.cpp b/src/include/brwbut.cpp index f720d13a8..ab845f104 100644 --- a/src/include/brwbut.cpp +++ b/src/include/brwbut.cpp @@ -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) diff --git a/src/include/brwbut.h b/src/include/brwbut.h index 0612b005b..1e6950d24 100644 --- a/src/include/brwbut.h +++ b/src/include/brwbut.h @@ -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 - 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 + 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 + void add_input_field(short id, const char * name, const int pos = -1, bool select = false); // @cmember Elimina un campo di display alla posizione void remove_display_field(const int pos = -1); @@ -221,6 +223,8 @@ public: // @cmember Aggiunge un campo di output alla posizione void add_output_field(const char * id, const char * name, const int pos = -1); + // @cmember Aggiunge un campo di output alla posizione + void add_output_field(short id, const char * name, const int pos = -1); // @cmember Elimina un campo di output alla posizione void remove_output_field(const int pos = -1); diff --git a/src/include/date.h b/src/include/date.h index c30b6ebc1..581c7d695 100755 --- a/src/include/date.h +++ b/src/include/date.h @@ -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 diff --git a/src/include/doc.h b/src/include/doc.h index 52298bd34..9ebd23085 100755 --- a/src/include/doc.h +++ b/src/include/doc.h @@ -104,7 +104,7 @@ #define DOC_NOINVIOSDI "NOINVIOSDI" // Virtuali - +#define DOC_PLAFOND "PLAFOND" // modulo pe #define DOC_SPESEUPD "SPESEUPD" #define DOC_USEK "USEK" diff --git a/src/include/maskfld.cpp b/src/include/maskfld.cpp index ee723ec66..6d739a46e 100755 --- a/src/include/maskfld.cpp +++ b/src/include/maskfld.cpp @@ -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 diff --git a/src/include/msksheet.cpp b/src/include/msksheet.cpp index e79c3d43d..75f39c447 100755 --- a/src/include/msksheet.cpp +++ b/src/include/msksheet.cpp @@ -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; } diff --git a/src/include/postman.cpp b/src/include/postman.cpp index 7d811ae3d..8d33b6960 100755 --- a/src/include/postman.cpp +++ b/src/include/postman.cpp @@ -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"); diff --git a/src/include/prefix.cpp b/src/include/prefix.cpp index b7485fc5f..8930b5982 100755 --- a/src/include/prefix.cpp +++ b/src/include/prefix.cpp @@ -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; diff --git a/src/include/progind.cpp b/src/include/progind.cpp index 0a390426c..4f3fcda80 100755 --- a/src/include/progind.cpp +++ b/src/include/progind.cpp @@ -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++; } diff --git a/src/include/reprint.cpp b/src/include/reprint.cpp index 590636677..80952e5f2 100755 --- a/src/include/reprint.cpp +++ b/src/include/reprint.cpp @@ -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(); diff --git a/src/include/utility.h b/src/include/utility.h index 158a7e7c1..60ecd3ca7 100755 --- a/src/include/utility.h +++ b/src/include/utility.h @@ -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 void safe_delete(T*& a) { +template void safe_delete(T*& a) +{ delete a; a = nullptr; }