comparison src/editfns.c @ 48020:7ac7ca5ac550

(Fformat): Detect invalid format letters for floats.
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Oct 2002 22:52:36 +0000
parents da8405c812f2
children 2a8ba962e34d
comparison
equal deleted inserted replaced
48019:ed648a134b7e 48020:7ac7ca5ac550
3257 } 3257 }
3258 } 3258 }
3259 else if (FLOATP (args[n]) && *format != 's') 3259 else if (FLOATP (args[n]) && *format != 's')
3260 { 3260 {
3261 if (! (*format == 'e' || *format == 'f' || *format == 'g')) 3261 if (! (*format == 'e' || *format == 'f' || *format == 'g'))
3262 args[n] = Ftruncate (args[n], Qnil); 3262 {
3263 if (*format != 'd' && *format != 'o' && *format != 'x'
3264 && *format != 'i' && *format != 'X' && *format != 'c')
3265 error ("Invalid format operation %%%c", *format);
3266 args[n] = Ftruncate (args[n], Qnil);
3267 }
3263 3268
3264 /* Note that we're using sprintf to print floats, 3269 /* Note that we're using sprintf to print floats,
3265 so we have to take into account what that function 3270 so we have to take into account what that function
3266 prints. */ 3271 prints. */
3267 thissize = MAX_10_EXP + 100 + precision; 3272 thissize = MAX_10_EXP + 100 + precision;