Some code improvements

This commit is contained in:
Markus Gans 2015-10-01 05:08:05 +02:00
parent 2ba6b0bcf7
commit b24c349204
2 changed files with 11 additions and 6 deletions

View File

@ -96,9 +96,12 @@ void FMenuItem::init (FWidget* parent)
if ( parent ) if ( parent )
{ {
FMenuList* super_menu_list = dynamic_cast<FMenuList*>(parent); FMenuList* sm_list = dynamic_cast<FMenuList*>(parent);
setSuperMenu(super_menu_list); if ( sm_list )
super_menu_list->insert(this); {
setSuperMenu(sm_list);
sm_list->insert(this);
}
if ( isMenuBar(parent) ) // Parent is menubar if ( isMenuBar(parent) ) // Parent is menubar
{ {

View File

@ -412,7 +412,9 @@ int FOptiMove::relative_move ( char*& move
if ( F_column_address.cap ) if ( F_column_address.cap )
{ {
strcat (hmove, tparm(F_column_address.cap, to_x)); strncat ( hmove
, tparm(F_column_address.cap, to_x)
, sizeof(hmove) - strlen(hmove) - 1 );
htime = F_column_address.duration; htime = F_column_address.duration;
} }
@ -637,13 +639,13 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
break; break;
case 2: case 2:
strcpy (move_ptr, F_carriage_return.cap); strncpy (move_ptr, F_carriage_return.cap, sizeof(move_buf) - 1);
move_ptr += F_carriage_return.length; move_ptr += F_carriage_return.length;
relative_move (move_ptr, 0, yold, xnew, ynew); relative_move (move_ptr, 0, yold, xnew, ynew);
break; break;
case 3: case 3:
strcpy (move_ptr, F_cursor_home.cap); strncpy (move_ptr, F_cursor_home.cap, sizeof(move_buf) - 1);
move_ptr += F_cursor_home.length; move_ptr += F_cursor_home.length;
relative_move (move_ptr, 0, 0, xnew, ynew); relative_move (move_ptr, 0, 0, xnew, ynew);
break; break;