CVS: libraries/mspgcc escape_decode.c,1.3,1.4

Chris Liechti <[email protected]> Thu, 09 Aug 2007 09:54:12 -0700
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/libraries/mspgcc
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29563/libraries/mspgcc

Modified Files:
	escape_decode.c 
Log Message:
fix state machine error for escapes other than \xNN

Index: escape_decode.c
===================================================================
RCS file: /cvsroot/mspgcc/libraries/mspgcc/escape_decode.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- escape_decode.c	18 Sep 2005 15:05:57 -0000	1.3
+++ escape_decode.c	9 Aug 2007 16:54:10 -0000	1.4
@@ -19,6 +19,8 @@
                 }
                 break;
             case M_ESCAPE:
+                // by default fall back to print mode
+                mode = M_PRINT;
                 // interpret escapes
                 switch (character) {
                     case '0':
@@ -46,10 +48,11 @@
                         ((unsigned char *)dst)[output_size++] = '\\';
                         break;
                     case 'x':
-                        mode = M_HEX_DIGIT_1;
+                        mode = M_HEX_DIGIT_1;   // keep parsing the hex digits
                         break;
                     default:
-                        mode = M_PRINT;
+                        // unknown escapes are just printed normally
+                        ((unsigned char *)dst)[output_size++] = character;
                         break;
                 }
                 break;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/