Add more range/argument checking

Submitted by: charnier@lirmm.fr
This commit is contained in:
Andrey A. Chernov 1995-01-30 14:11:58 +00:00
parent 7cb18415b8
commit 255ec70534
7 changed files with 15 additions and 6 deletions

View file

@ -65,10 +65,11 @@ int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, in
height = strheight(prompt)+list_height+4+2;
if (width < 0) {
i = strwidth(prompt);
j = strwidth(title);
j = ((title != NULL) ? strwidth(title) : 0);
width = MAX(i,j);
width = MAX(width,check_x+4)+4;
}
width = MAX(width,24);
if (width > COLS)
width = COLS;

View file

@ -37,9 +37,10 @@ int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int
height = strheight(prompt)+2+4;
if (width < 0) {
i = strwidth(prompt);
j = strwidth(title);
j = ((title != NULL) ? strwidth(title) : 0);
width = MAX(i,j) + 4;
}
width = MAX(width,24);
if (width > COLS)
width = COLS;

View file

@ -55,10 +55,11 @@ int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int wid
height = strheight(prompt)+menu_height+4+2;
if (width < 0) {
i = strwidth(prompt);
j = strwidth(title);
j = ((title != NULL) ? strwidth(title) : 0);
width = MAX(i,j);
width = MAX(width,tag_x+4)+4;
}
width = MAX(width,24);
if (width > COLS)
width = COLS;

View file

@ -36,9 +36,11 @@ int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int w
height = strheight(prompt)+2+2*(!!pause);
if (width < 0) {
i = strwidth(prompt);
j = strwidth(title);
j = ((title != NULL) ? strwidth(title) : 0);
width = MAX(i,j)+4;
}
if (pause)
width = MAX(width,10);
if (width > COLS)
width = COLS;

View file

@ -39,6 +39,8 @@ int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, i
fprintf(stderr, "\nAutosizing is impossible in dialog_prgbox().\n");
exit(-1);
}
width = MAX(width,10);
if (width > COLS)
width = COLS;
if (height > LINES)

View file

@ -73,10 +73,11 @@ int dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, in
height = strheight(prompt)+list_height+4+2;
if (width < 0) {
i = strwidth(prompt);
j = strwidth(title);
j = ((title != NULL) ? strwidth(title) : 0);
width = MAX(i,j);
width = MAX(width,check_x+4)+4;
}
width = MAX(width,24);
if (width > COLS)
width = COLS;

View file

@ -35,9 +35,10 @@ int dialog_yesno(unsigned char *title, unsigned char * prompt, int height, int w
height = strheight(prompt)+4;
if (width < 0) {
i = strwidth(prompt);
j = strwidth(title);
j = ((title != NULL) ? strwidth(title) : 0);
width = MAX(i,j)+4;
}
width = MAX(width,23);
if (width > COLS)
width = COLS;