summaryrefslogtreecommitdiffstats
path: root/sys/modules/splash/bmp
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1999-06-16 14:04:45 +0000
committeryokota <yokota@FreeBSD.org>1999-06-16 14:04:45 +0000
commitef7a7a001b4df084cccea0c127a53fc0346cb8d0 (patch)
treeed253e160556eaa2e8fd34babf21210b2ee3794a /sys/modules/splash/bmp
parentd1ef08d6092c801146f82b4f2bd7d94364c08c4a (diff)
downloadFreeBSD-src-ef7a7a001b4df084cccea0c127a53fc0346cb8d0.zip
FreeBSD-src-ef7a7a001b4df084cccea0c127a53fc0346cb8d0.tar.gz
Print verbose messages when there is error.
Oked by: des
Diffstat (limited to 'sys/modules/splash/bmp')
-rw-r--r--sys/modules/splash/bmp/splash_bmp.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/modules/splash/bmp/splash_bmp.c b/sys/modules/splash/bmp/splash_bmp.c
index 3b0e500..44ac914 100644
--- a/sys/modules/splash/bmp/splash_bmp.c
+++ b/sys/modules/splash/bmp/splash_bmp.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: splash_bmp.c,v 1.6 1999/02/05 11:52:13 yokota Exp $
+ * $Id: splash_bmp.c,v 1.7 1999/03/29 15:13:53 yokota Exp $
*/
#include <sys/param.h>
@@ -73,8 +73,10 @@ bmp_start(video_adapter_t *adp)
video_info_t info;
int i;
- if ((bmp_decoder.data == NULL) || (bmp_decoder.data_size <= 0))
+ if ((bmp_decoder.data == NULL) || (bmp_decoder.data_size <= 0)) {
+ printf("splash_bmp: No bitmap file found\n");
return ENODEV;
+ }
for (i = 0; modes[i] >= 0; ++i) {
if (((*vidsw[adp->va_index]->get_info)(adp, modes[i], &info) == 0)
&& (bmp_Init((u_char *)bmp_decoder.data,
@@ -82,6 +84,8 @@ bmp_start(video_adapter_t *adp)
break;
}
splash_mode = modes[i];
+ if (splash_mode < 0)
+ printf("splash_bmp: No appropriate video mode found\n");
if (bootverbose)
printf("bmp_start(): splash_mode:%d\n", splash_mode);
return ((splash_mode < 0) ? ENODEV : 0);
@@ -482,9 +486,17 @@ bmp_Init(const char *data, int swidth, int sheight, int sdepth)
/* check file ID */
if (bmf->bmfh.bfType != 0x4d42) {
+ printf("splash_bmp: not a BMP file\n");
return(1); /* XXX check word ordering for big-endian ports? */
}
+ /* do we understand this bitmap format? */
+ if (bmf->bmfi.bmiHeader.biSize > sizeof(bmf->bmfi.bmiHeader)) {
+ printf("splash_bmp: unsupported BMP format (size=%d)\n",
+ bmf->bmfi.bmiHeader.biSize);
+ return(1);
+ }
+
/* save what we know about the screen */
bmp_info.swidth = swidth;
bmp_info.sheight = sheight;
@@ -504,6 +516,7 @@ bmp_Init(const char *data, int swidth, int sheight, int sdepth)
case BI_RLE8:
break;
default:
+ printf("splash_bmp: unsupported compression format\n");
return(1); /* unsupported compression format */
}
@@ -513,6 +526,12 @@ bmp_Init(const char *data, int swidth, int sheight, int sdepth)
if (bmp_info.ncols == 0) { /* uses all of them */
bmp_info.ncols = 1 << bmf->bmfi.bmiHeader.biBitCount;
}
+ if ((bmf->bmfi.bmiHeader.biBitCount != sdepth)
+ || (bmp_info.ncols > (1 << sdepth))) {
+ printf("splash_bmp: unsupported color depth (%d bits, %d colors)\n",
+ bmf->bmfi.bmiHeader.biBitCount, bmp_info.ncols);
+ return(1);
+ }
if ((bmp_info.height > bmp_info.sheight) ||
(bmp_info.width > bmp_info.swidth) ||
(bmp_info.ncols > (1 << sdepth))) {
OpenPOWER on IntegriCloud