Added attributes to code such that -Wformat-truncation=0 can be removed
This commit is contained in:
parent
4bfaa26297
commit
c72abd8bbf
2 changed files with 12 additions and 4 deletions
2
makefile
2
makefile
|
|
@ -19,7 +19,7 @@ FLAGS += -Wall
|
|||
FLAGS += -Wextra
|
||||
FLAGS += -Werror
|
||||
# This flag is because of the compiler otherwise giving too much warning
|
||||
FLAGS += -Wformat-truncation=0
|
||||
#FLAGS += -Wformat-truncation=0
|
||||
|
||||
# Compile flag for defining GITHASH to put at the end of the version string
|
||||
GITFLAG = -D'GITHASH=$(shell git rev-parse --short=1 HEAD)'
|
||||
|
|
|
|||
14
ui_ncurses.c
14
ui_ncurses.c
|
|
@ -71,6 +71,7 @@ void initBoard( const board_t board ){
|
|||
keypad(stdscr, TRUE);
|
||||
nonl();
|
||||
echo();
|
||||
__attribute__((assume(board.columns < 999)));
|
||||
for( columnsint_t column = 0; column < board.columns; column++ ){
|
||||
char colnum[4];
|
||||
snprintf(
|
||||
|
|
@ -96,8 +97,10 @@ void initBoard( const board_t board ){
|
|||
}
|
||||
for( rowsint_t row = 0; row < board.rows; row++ ){
|
||||
char rownum[4];
|
||||
const int intToPrint = board.rows - row + FIRST_NUMBER - 1;
|
||||
__attribute__((assume(intToPrint <= 256)));
|
||||
snprintf(
|
||||
rownum, sizeof(rownum), "%2d", board.rows - row + FIRST_NUMBER - 1
|
||||
rownum, sizeof(rownum), "%2d", intToPrint
|
||||
);
|
||||
mvaddstr(
|
||||
BOARD_Y + BOARD_DY * ( row + 1 ),
|
||||
|
|
@ -215,8 +218,13 @@ columnsint_t askColumn(
|
|||
if( board.player ) addstr( "p1" );
|
||||
else addstr( "p0" );
|
||||
refresh();
|
||||
for(; board.height[ column ] >= board.rows; )
|
||||
column += ( column < board.columns - 1 );
|
||||
for(; board.height[ column ] >= board.rows; ){
|
||||
column++;
|
||||
if( column == board.columns ){
|
||||
getch();
|
||||
return QUITCOLUMN;
|
||||
}
|
||||
}
|
||||
for(;;){
|
||||
int ch = mvgetch(
|
||||
BOARD_Y + BOARD_DY * ( board.rows - board.height[ column ] ),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue