Previous 15994 Revisions Next

r11444 Thursday 5th May, 2011 at 20:48:55 UTC by Fabio Priuli
srcclean.c: srcclean should remove invalid chars only for source files which are not xml (softlists have UTF-8 characters). no whatsnew.
[src/tools]srcclean.c

src/tools/srcclean.c
r11443r11444
7070   int removed_tabs = 0, removed_spaces = 0, fixed_mac_style = 0, fixed_nix_style = 0, added_newline = 0;
7171   int src = 0, dst = 0, in_c_comment = FALSE, in_cpp_comment = FALSE, in_c_string = FALSE;
7272   int hichars = 0;
73   int is_c_file;
73   int is_c_file, is_xml_file;
7474   const char *ext;
7575   FILE *file;
7676   int bytes;
r11443r11444
9797   /* determine if we are a C file */
9898   ext = strrchr(argv[1], '.');
9999   is_c_file = (ext && (core_stricmp(ext, ".c") == 0 || core_stricmp(ext, ".h") == 0 || core_stricmp(ext, ".cpp") == 0));
100   is_xml_file = (ext && core_stricmp(ext, ".xml") == 0);
100101
101102   /* rip through it */
102103   for (src = 0; src < bytes; )
103104   {
104105      UINT8 ch = original[src++];
105106
106      /* check for invalid upper-ASCII chars */
107      if (ch != 13 && ch != 10 && ch != 9 && (ch > 127 || ch < 32))
107      /* check for invalid upper-ASCII chars, but only for non-xml files (swlists might contain UTF-8 chars) */
108      if (!is_xml_file && ch != 13 && ch != 10 && ch != 9 && (ch > 127 || ch < 32))
108109      {
109110         ch = '?';
110111         hichars++;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team