Subject: Re: CVS commit: src/sys/dev
To: None <jdolecek@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: source-changes
Date: 02/09/2003 17:51:16
jdolecek@netbsd.org said:
> Modified Files:
> 	src/sys/dev/ic: vga.c vga_subr.c vgavar.h
> 	src/sys/dev/wscons: wsconsio.h
> 	src/sys/dev/wsfont: bold8x16.h gallant12x22.h lucida16x29.h
> 	    omron12x20.h qvss8x15.h sony12x24.h sony8x16.h vt220iso8x16.h
> 	    vt220l8x10.h vt220l8x16.h vt220l8x8.h wsfont.c wsfont.h
> Log Message:
> make 'name' and 'data' of struct wsdisplay_font const,
> mark data arrays in font sources const 

The "data" part is wrong.
If a font is needed during early console initialization where
compiled-in data and graphics driver requirements don't match,
the data are bit-/bytereversed in place.
See wsfont.c:wsfont_rev{bit,byte}.

I don't like this much; fonts are good candidates for ROMing
in embedded applications, and I'd expect a port to know which
font flavours it might need in startup and embed the right one(s).
But this is how it works now...

(The bug is masked a bit by casting the data pointer to non-const*
tupes in the mentioned functions. At least "lint" shows it:
/usr/src/sys/dev/wsfont/wsfont.c(239): warning: cast discards 'const' from
pointer target type [275]
/usr/src/sys/dev/wsfont/wsfont.c(255): warning: cast discards 'const' from
pointer target type [275]
)

best regards
Matthias