The following more correctly recognizes "flags" in the format.

--- a/src/GUI/dialog.cxx
+++ b/src/GUI/dialog.cxx
@@ -37,7 +37,7 @@ validate_format(const char *f)
      }
      if (*f++ != '%')
          return f_INVALID;
-    if (*f == ' ' || *f == '+' || *f == '-' || *f == '#')
+    while (*f == ' ' || *f == '+' || *f == '-' || *f == '#' || *f == '0')
          f++;
      while (*f && isdigit(*f))
          f++;

Reference:
   http://en.wikipedia.org/wiki/Printf

If you don't believe there can be multiple flags, in any order,
you can play with the following demonstration program:

#include <stdio.h>

void doit(const char* fmt, double num){
   printf("%10s  ", fmt);
   printf(fmt, num);
   printf("\n");
}

int main(){
   doit("% -8.2f",  1.23);
   doit("% -8.2f", -1.23);
   doit("%0 8.2f",  4./3.);
   doit("%0 8.2f", -4./3.);
   doit("% 08.2f",  4./3.);
   doit("% 08.2f", -4./3.);
   doit("%-05.f",  4./3.);
   doit("%-05.f", -4./3.);
   doit("%-0#5.f",  4./3.);
   doit("%-0#5.f", -4./3.);
}

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to