Print verbose messages when there is error.

Oked by: des
This commit is contained in:
yokota 1999-06-16 14:04:45 +00:00
parent 640017df55
commit 12e2302e41
2 changed files with 42 additions and 4 deletions

View File

@ -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))) {

View File

@ -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))) {