Commit 499e8134b4c24e9ad44ff7b0a10c38d4dd8790b9

Laurent Vivier 2015-11-06T15:06:25

toke: fix line parsing on big-endian Trying to compile openbios on Fedora 22 ppc64, I had the following error: toke -o QEMU,VGA.bin ~/openbios/drivers/vga.fs ... Tokenizing ~/openbios/drivers/vga.fs Binary output to QEMU,VGA.bin Warning: File ~/openbios/drivers/vga.fs, Line 1. Unterminated comment Nothing Tokenized. 1 Warning. This can be reproduced with the fcode-utils examples. "toke" is parsing the comment line until it finds a '\n'. The '\n' is stored as a char in a field of an union, but it is read as a long. It works well on little endian but not on big endian. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/fcode-utils-devel@1354 f158a5a8-5612-0410-a976-696ce0be7e32

diff --git a/toke/scanner.c b/toke/scanner.c
index 7b8c615..3dab55f 100644
--- a/toke/scanner.c
+++ b/toke/scanner.c
@@ -1625,7 +1625,7 @@ static void handle_user_message( char delim, bool print_it )
 
 void user_message( tic_param_t pfield )
 {
-    char delim = (char)pfield.deflt_elem ;
+    char delim = (char)pfield.fw_token ;
     handle_user_message( delim, TRUE);
 }
 
@@ -5295,7 +5295,7 @@ void skip_string( tic_param_t pfield)
 
 void process_remark( tic_param_t pfield )
 {
-    char until_char = (char)pfield.deflt_elem ;
+    char until_char = (char)pfield.fw_token ;
     unsigned int start_lineno = lineno;
 
 #ifdef DEBUG_SCANNER