Small code fixes

This commit is contained in:
Markus Gans 2018-10-22 01:26:24 +02:00
parent 540291b410
commit 3678d52766
11 changed files with 28 additions and 34 deletions

View File

@ -925,12 +925,8 @@ void FDialog::initDialogMenu()
dialog_menu->setPos (getX(), getY() + 1);
dgl_menuitem = dialog_menu->getItem();
if ( dgl_menuitem )
{
dgl_menuitem->ignorePadding();
dgl_menuitem->unsetFocusable();
}
dgl_menuitem->ignorePadding();
dgl_menuitem->unsetFocusable();
// Add the move/size menu item
initMoveSizeMenuItem (dialog_menu);

View File

@ -54,9 +54,7 @@ FDialogListMenu::~FDialogListMenu()
void FDialogListMenu::init()
{
FMenuItem* menuitem = getItem();
if ( menuitem )
menuitem->dialog_index = true;
menuitem->dialog_index = true;
}
} // namespace finalcut

View File

@ -529,8 +529,7 @@ void FLineEdit::onTimer (FTimerEvent*)
return;
}
if ( text_offset > 0 )
text_offset--;
text_offset--;
if ( cursor_pos > 0 )
cursor_pos--;

View File

@ -1154,11 +1154,11 @@ void FOptiMove::moveByMethod ( int method
if ( xold >= 0 )
std::strncat ( move_ptr
, F_carriage_return.cap
, BUF_SIZE - std::strlen(move_ptr) );
, BUF_SIZE - std::strlen(move_ptr) - 1 );
std::strncat ( move_ptr
, F_cursor_left.cap
, BUF_SIZE - std::strlen(move_ptr) );
, BUF_SIZE - std::strlen(move_ptr) - 1);
move_ptr[BUF_SIZE - 1] ='\0';
move_ptr += std::strlen(move_buf);
relativeMove (move_ptr, int(screen_width) - 1, yold - 1, xnew, ynew);

View File

@ -416,7 +416,7 @@ char* FTerm::enableCursor()
// Restore the last used Linux console cursor style
char* cstyle;
cstyle = linux->restoreCursorStyle();
std::strncat (enable_str, cstyle, SIZE - std::strlen(enable_str));
std::strncat (enable_str, cstyle, SIZE - std::strlen(enable_str) - 1);
}
#endif // defined(__linux__)

View File

@ -577,19 +577,14 @@ bool FTermLinux::getUnicodeMap()
if ( ret != 0 )
{
int count;
std::size_t count = screen_unicode_map.entry_ct;
if ( errno != ENOMEM || screen_unicode_map.entry_ct == 0 )
return false;
count = screen_unicode_map.entry_ct;
if ( count <= 0 )
if ( errno != ENOMEM || count == 0 )
return false;
try
{
screen_unicode_map.entries = new struct unipair[std::size_t(count)]();
screen_unicode_map.entries = new struct unipair[count]();
}
catch (const std::bad_alloc& ex)
{

View File

@ -63,11 +63,11 @@ class FPoint
FPoint& operator += (const FPoint&);
FPoint& operator -= (const FPoint&);
friend inline bool operator == (const FPoint&, const FPoint&);
friend inline bool operator != (const FPoint&, const FPoint&);
friend inline FPoint operator + (const FPoint&, const FPoint&);
friend inline FPoint operator - (const FPoint&, const FPoint&);
friend inline FPoint operator - (const FPoint&);
friend bool operator == (const FPoint&, const FPoint&);
friend bool operator != (const FPoint&, const FPoint&);
friend FPoint operator + (const FPoint&, const FPoint&);
friend FPoint operator - (const FPoint&, const FPoint&);
friend FPoint operator - (const FPoint&);
friend std::ostream& operator << (std::ostream&, const FPoint&);
friend std::istream& operator >> (std::istream&, FPoint&);

View File

@ -2763,7 +2763,7 @@ void FKeyboardTest::utf8Test()
keyboard->disableUTF8();
input("\360\220\200\200");
processInput();
CPPUNIT_ASSERT ( key_released == 0200 );
CPPUNIT_ASSERT ( key_released == 128 );
clear();
}

View File

@ -131,6 +131,7 @@ void FObjectTest::classNameTest()
void FObjectTest::noArgumentTest()
{
finalcut::FObject o1;
finalcut::FObject o2;
CPPUNIT_ASSERT ( ! o1.hasParent() );
CPPUNIT_ASSERT ( o1.getParent() == 0 );
CPPUNIT_ASSERT ( ! o1.hasChildren() );
@ -142,8 +143,8 @@ void FObjectTest::noArgumentTest()
CPPUNIT_ASSERT ( children_list.begin() == o1.end() );
CPPUNIT_ASSERT ( children_list.end() == o1.begin() );
CPPUNIT_ASSERT ( children_list.end() == o1.end() );
CPPUNIT_ASSERT ( ! o1.isChild(&o1) );
CPPUNIT_ASSERT ( ! o1.isDirectChild(&o1) );
CPPUNIT_ASSERT ( ! o1.isChild(&o2) );
CPPUNIT_ASSERT ( ! o1.isDirectChild(&o2) );
CPPUNIT_ASSERT ( ! o1.isWidget() );
CPPUNIT_ASSERT ( o1.isInstanceOf("FObject") );
CPPUNIT_ASSERT ( ! o1.isTimerInUpdating() );
@ -176,6 +177,7 @@ void FObjectTest::childObjectTest()
finalcut::FObject* c4 = new finalcut::FObject(&obj);
finalcut::FObject* c5 = new finalcut::FObject(c1);
finalcut::FObject* c6 = new finalcut::FObject(c5);
finalcut::FObject* c7 = new finalcut::FObject();
CPPUNIT_ASSERT ( obj.hasChildren() );
CPPUNIT_ASSERT ( obj.getChild(0) == 0 );
@ -213,7 +215,7 @@ void FObjectTest::childObjectTest()
CPPUNIT_ASSERT ( children_list2.begin() != c1->end() );
CPPUNIT_ASSERT ( children_list2.end() != c1->begin() );
CPPUNIT_ASSERT ( children_list2.end() == c1->end() );
CPPUNIT_ASSERT ( ! c1->isDirectChild(c1) );
CPPUNIT_ASSERT ( ! c1->isDirectChild(c7) );
CPPUNIT_ASSERT ( ! c1->isWidget() );
CPPUNIT_ASSERT ( c1->isInstanceOf("FObject") );
CPPUNIT_ASSERT ( ! c1->isTimerInUpdating() );

View File

@ -219,8 +219,10 @@ void FPointTest::equalTest()
CPPUNIT_ASSERT ( p1 == p2 );
CPPUNIT_ASSERT ( finalcut::FPoint(1,2) == p2 );
CPPUNIT_ASSERT ( p1 == finalcut::FPoint(1,2) );
CPPUNIT_ASSERT ( finalcut::FPoint() == finalcut::FPoint() );
CPPUNIT_ASSERT ( finalcut::FPoint() == -finalcut::FPoint() );
const finalcut::FPoint p3;
const finalcut::FPoint p4;
CPPUNIT_ASSERT ( p3 == p4 );
CPPUNIT_ASSERT ( p3 == -p4 );
}
//----------------------------------------------------------------------

View File

@ -299,7 +299,9 @@ void FRectTest::equalTest()
CPPUNIT_ASSERT ( r1 == r2 );
CPPUNIT_ASSERT ( finalcut::FRect(1, 2, 10, 20) == r2 );
CPPUNIT_ASSERT ( r1 == finalcut::FRect(1, 2, 10, 20) );
CPPUNIT_ASSERT ( finalcut::FRect() == finalcut::FRect() );
const finalcut::FRect r3;
const finalcut::FRect r4;
CPPUNIT_ASSERT ( r3 == r4 );
}
//----------------------------------------------------------------------