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> 2018-08-31 Markus Gans <guru.mail@muenster.de>
* Fixed a problem for a non-debug compilation * 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) void debug (FApplication& TermApp)
{ {
#if DEBUG
const FString& ab_s = TermApp.getAnswerbackString(); const FString& ab_s = TermApp.getAnswerbackString();
const FString& sec_da = TermApp.getSecDAString(); const FString& sec_da = TermApp.getSecDAString();
std::cout << "\n.------------------- debug -------------------\r\n"; std::cout << "\n.------------------- debug -------------------\r\n";
@ -228,8 +228,12 @@ void debug (FApplication& TermApp)
tcapString ("| The SecDA String", sec_da); tcapString ("| The SecDA String", sec_da);
std::cout << "`------------------- debug -------------------\r\n"; std::cout << "`------------------- debug -------------------\r\n";
#endif
} }
#else
void debug (FApplication&)
{ }
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void booleans() void booleans()

View File

@ -725,9 +725,11 @@ int FOptiMove::relativeMove ( char move[]
if ( move ) if ( 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 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 ) 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; htime = htime_r;
} }
} }
@ -929,7 +932,8 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
if ( htime_l < 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; htime = htime_l;
} }
} }

View File

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

View File

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