pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patch for review: Fix error message for bad characters in syntax fil


From: John Darrington
Subject: Re: patch for review: Fix error message for bad characters in syntax files.
Date: Fri, 27 Mar 2009 15:40:22 +0900
User-agent: Mutt/1.5.13 (2006-08-11)

Fine by me.

On Thu, Mar 26, 2009 at 09:13:57PM -0700, Ben Pfaff wrote:
     This is aimed at "stable".
     
     commit 0aebb03b1f9c3a4a0dd99b715f13dc044540a0bd
     Author: Ben Pfaff <address@hidden>
     Date:   Thu Mar 26 21:11:12 2009 -0700
     
         Fix error message for bad characters in syntax files.
         
         Before this commit, on systems where "char" is a signed type,
         formatting a char with %o would sign-extend to the width of "int",
         so that a typical error message would look like:
            Bad character in input: `\37777777605'.
         
         With this commit, the value gets zero-extended, producing the more
         sensible error mesage:
            Bad character in input: `\205'.
     
     diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c
     index 16195b0..2651161 100644
     --- a/src/language/lexer/lexer.c
     +++ b/src/language/lexer/lexer.c
     @@ -1,5 +1,5 @@
      /* PSPP - a program for statistical analysis.
     -   Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
     +   Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc.
      
         This program is free software: you can redistribute it and/or modify
         it under the terms of the GNU General Public License as published by
     @@ -384,10 +384,11 @@ lex_get (struct lexer *lexer)
                  }
                else
                  {
     -              if (c_isgraph ((unsigned char) *lexer->prog))
     -                msg (SE, _("Bad character in input: `%c'."), 
*lexer->prog++);
     +              unsigned char c = *lexer->prog++;
     +              if (c_isgraph (c))
     +                msg (SE, _("Bad character in input: `%c'."), c);
                    else
     -                msg (SE, _("Bad character in input: `\\%o'."), 
*lexer->prog++);
     +                msg (SE, _("Bad character in input: `\\%o'."), c);
                    continue;
                  }
              }
     
     -- 
     Peter Seebach on managing engineers:
     "It's like herding cats, only most of the engineers are already
      sick of laser pointers."
     
     
     _______________________________________________
     pspp-dev mailing list
     address@hidden
     http://lists.gnu.org/mailman/listinfo/pspp-dev

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]