diff options
author | jkim <jkim@FreeBSD.org> | 2010-11-30 16:46:15 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2010-11-30 16:46:15 +0000 |
commit | 119917bd4df2cef00f75d52afbff5e8e1ab57eab (patch) | |
tree | 1cd549fb84209ffdebc2738f30a6bdbfda7365fd /sys/dev/syscons | |
parent | 87d14992592feabc42a5d50ae0dca07b22028468 (diff) | |
download | FreeBSD-src-119917bd4df2cef00f75d52afbff5e8e1ab57eab.zip FreeBSD-src-119917bd4df2cef00f75d52afbff5e8e1ab57eab.tar.gz |
Clean up code a bit to make it more readable.
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r-- | sys/dev/syscons/scvidctl.c | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c index 5c3dc8e..7e26fcf 100644 --- a/sys/dev/syscons/scvidctl.c +++ b/sys/dev/syscons/scvidctl.c @@ -150,34 +150,33 @@ sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize, fontwidth = info.vi_cwidth; if (fontsize <= 0) fontsize = info.vi_cheight; - if (fontsize < 14) { + if (fontsize < 14) fontsize = 8; -#ifndef SC_NO_FONT_LOADING - if (!(scp->sc->fonts_loaded & FONT_8)) - return EINVAL; - font = scp->sc->font_8; -#else - font = NULL; -#endif - } else if (fontsize >= 16) { + else if (fontsize >= 16) fontsize = 16; -#ifndef SC_NO_FONT_LOADING - if (!(scp->sc->fonts_loaded & FONT_16)) - return EINVAL; - font = scp->sc->font_16; -#else - font = NULL; -#endif - } else { + else fontsize = 14; #ifndef SC_NO_FONT_LOADING - if (!(scp->sc->fonts_loaded & FONT_14)) - return EINVAL; + switch (fontsize) { + case 8: + if ((scp->sc->fonts_loaded & FONT_8) == 0) + return (EINVAL); + font = scp->sc->font_8; + break; + case 14: + if ((scp->sc->fonts_loaded & FONT_14) == 0) + return (EINVAL); font = scp->sc->font_14; + break; + case 16: + if ((scp->sc->fonts_loaded & FONT_16) == 0) + return (EINVAL); + font = scp->sc->font_16; + break; + } #else - font = NULL; + font = NULL; #endif - } if ((xsize <= 0) || (xsize > info.vi_width)) xsize = info.vi_width; if ((ysize <= 0) || (ysize > info.vi_height)) @@ -333,34 +332,33 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, /* adjust argument values */ if (fontsize <= 0) fontsize = info.vi_cheight; - if (fontsize < 14) { + if (fontsize < 14) fontsize = 8; -#ifndef SC_NO_FONT_LOADING - if (!(scp->sc->fonts_loaded & FONT_8)) - return EINVAL; - font = scp->sc->font_8; -#else - font = NULL; -#endif - } else if (fontsize >= 16) { + else if (fontsize >= 16) fontsize = 16; -#ifndef SC_NO_FONT_LOADING - if (!(scp->sc->fonts_loaded & FONT_16)) - return EINVAL; - font = scp->sc->font_16; -#else - font = NULL; -#endif - } else { + else fontsize = 14; #ifndef SC_NO_FONT_LOADING - if (!(scp->sc->fonts_loaded & FONT_14)) - return EINVAL; + switch (fontsize) { + case 8: + if ((scp->sc->fonts_loaded & FONT_8) == 0) + return (EINVAL); + font = scp->sc->font_8; + break; + case 14: + if ((scp->sc->fonts_loaded & FONT_14) == 0) + return (EINVAL); font = scp->sc->font_14; + break; + case 16: + if ((scp->sc->fonts_loaded & FONT_16) == 0) + return (EINVAL); + font = scp->sc->font_16; + break; + } #else - font = NULL; + font = NULL; #endif - } if (xsize <= 0) xsize = info.vi_width/8; if (ysize <= 0) |