[OpenBIOS] [PATCH 15/20] video_common.c: fix 32-bit display modes on 64-bit architectures

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat Jun 15 10:38:53 CEST 2013


Switch from using unsigned long to uint32_t in the 32-bit primitives and
unsigned short to uint16_t in the 16-bit primitives. While not a complete
fix (endian-swapping, 24-bit mode) it does fix 32-bit display depth on
64-bit architectures such as SPARC64.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/libopenbios/video_common.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/openbios-devel/libopenbios/video_common.c b/openbios-devel/libopenbios/video_common.c
index ca2826e..83270a0 100644
--- a/openbios-devel/libopenbios/video_common.c
+++ b/openbios-devel/libopenbios/video_common.c
@@ -107,9 +107,9 @@ video_mask_blit(void)
 				}
 
 				if( d >= 24 )
-					*((unsigned long*)dst) = color;
+					*((uint32_t*)dst) = color;
 				else if( d >= 15 )
-					*((short*)dst) = color;
+					*((uint16_t*)dst) = color;
 				else
 					*dst = color;
 
@@ -146,7 +146,7 @@ video_invert_rect( void )
 	for( ; h--; pp += *(video.rb) ) {
 		int ww = w;
 		if( VIDEO_DICT_VALUE(video.depth) == 24 || VIDEO_DICT_VALUE(video.depth) == 32 ) {
-			unsigned long *p = (unsigned long*)pp + x;
+			uint32_t *p = (uint32_t*)pp + x;
 			while( ww-- ) {
 				if (*p == fgcolor) {
 					*p++ = bgcolor;
@@ -155,11 +155,11 @@ video_invert_rect( void )
 				}
 			}
 		} else if( VIDEO_DICT_VALUE(video.depth) == 16 || VIDEO_DICT_VALUE(video.depth) == 15 ) {
-			unsigned short *p = (unsigned short*)pp + x;
+			uint16_t *p = (uint16_t*)pp + x;
 			while( ww-- ) {
-				if (*p == (unsigned short)fgcolor) {
+				if (*p == (uint16_t)fgcolor) {
 					*p++ = bgcolor;
-				} else if (*p == (unsigned short)bgcolor) {
+				} else if (*p == (uint16_t)bgcolor) {
 					*p++ = fgcolor;
 				}
 			}
@@ -198,11 +198,11 @@ video_fill_rect(void)
 	for( ; h--; pp += VIDEO_DICT_VALUE(video.rb) ) {
 		int ww = w;
 		if( VIDEO_DICT_VALUE(video.depth) == 24 || VIDEO_DICT_VALUE(video.depth) == 32 ) {
-			unsigned long *p = (unsigned long*)pp + x;
+			uint32_t *p = (uint32_t*)pp + x;
 			while( ww-- )
 				*p++ = col;
 		} else if( VIDEO_DICT_VALUE(video.depth) == 16 || VIDEO_DICT_VALUE(video.depth) == 15 ) {
-			unsigned short *p = (unsigned short*)pp + x;
+			uint16_t *p = (uint16_t*)pp + x;
 			while( ww-- )
 				*p++ = col;
 		} else {
-- 
1.7.10.4




More information about the OpenBIOS mailing list