Compiles now with newer gcc

This commit is contained in:
Markus Gans 2018-09-02 00:43:27 +02:00
parent c38775f878
commit 627ee0f094
5 changed files with 21 additions and 13 deletions

View File

@ -1,3 +1,6 @@
2018-09-01 Markus Gans <guru.mail@muenster.de>
* Compiles now with newer gcc
2018-08-31 Markus Gans <guru.mail@muenster.de>
* Fixed a problem for a non-debug compilation

View File

@ -203,9 +203,9 @@ void tcapString (const std::string& name, const char cap_str[])
}
//----------------------------------------------------------------------
#if DEBUG
void debug (FApplication& TermApp)
{
#if DEBUG
const FString& ab_s = TermApp.getAnswerbackString();
const FString& sec_da = TermApp.getSecDAString();
std::cout << "\n.------------------- debug -------------------\r\n";
@ -228,8 +228,12 @@ void debug (FApplication& TermApp)
tcapString ("| The SecDA String", sec_da);
std::cout << "`------------------- debug -------------------\r\n";
#endif
}
#else
void debug (FApplication&)
{ }
#endif
//----------------------------------------------------------------------
void booleans()

View File

@ -725,9 +725,11 @@ int FOptiMove::relativeMove ( char move[]
if ( move )
{
if ( *move )
std::strncat (move, hmove, BUF_SIZE - std::strlen(move) - 1);
std::strncat (move, hmove, BUF_SIZE - std::strlen(move));
else
std::strncpy (move, hmove, BUF_SIZE - 1);
std::strncpy (move, hmove, BUF_SIZE);
move[BUF_SIZE - 1] = '\0';
}
}
@ -876,7 +878,8 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
if ( htime_r < htime )
{
std::strncpy (hmove, str, BUF_SIZE - 1);
std::strncpy (hmove, str, BUF_SIZE);
hmove[BUF_SIZE - 1] = '\0';
htime = htime_r;
}
}
@ -929,7 +932,8 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
if ( htime_l < htime )
{
std::strncpy (hmove, str, BUF_SIZE - 1);
std::strncpy (hmove, str, BUF_SIZE);
hmove[BUF_SIZE - 1] = '\0';
htime = htime_l;
}
}

View File

@ -168,9 +168,8 @@ void FTerm::setTermType (const char term_name[])
if ( ! term_name )
return;
std::strncpy ( termtype
, term_name
, std::strlen(term_name) + 1 );
std::strncpy (termtype, term_name, sizeof(termtype));
termtype[sizeof(termtype) - 1] = '\0';
}
//----------------------------------------------------------------------

View File

@ -86,9 +86,7 @@ void FTermDetection::setTermFileName (char term_filename[])
if ( ! term_filename )
return;
std::strncpy ( termfilename
, term_filename
, std::strlen(term_filename) + 1 );
std::strncpy (termfilename, term_filename, sizeof(termfilename) - 1);
}
//----------------------------------------------------------------------
@ -314,7 +312,7 @@ void FTermDetection::detectTerminal()
if ( new_termtype )
{
setenv(C_STR("TERM"), new_termtype, 1);
std::strncpy (termtype, new_termtype, std::strlen(new_termtype) + 1);
std::strncpy (termtype, new_termtype, sizeof(termtype) - 1);
}
}