src/tools/srcclean.c
| r11443 | r11444 | |
| 70 | 70 | int removed_tabs = 0, removed_spaces = 0, fixed_mac_style = 0, fixed_nix_style = 0, added_newline = 0; |
| 71 | 71 | int src = 0, dst = 0, in_c_comment = FALSE, in_cpp_comment = FALSE, in_c_string = FALSE; |
| 72 | 72 | int hichars = 0; |
| 73 | | int is_c_file; |
| 73 | int is_c_file, is_xml_file; |
| 74 | 74 | const char *ext; |
| 75 | 75 | FILE *file; |
| 76 | 76 | int bytes; |
| r11443 | r11444 | |
| 97 | 97 | /* determine if we are a C file */ |
| 98 | 98 | ext = strrchr(argv[1], '.'); |
| 99 | 99 | 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); |
| 100 | 101 | |
| 101 | 102 | /* rip through it */ |
| 102 | 103 | for (src = 0; src < bytes; ) |
| 103 | 104 | { |
| 104 | 105 | UINT8 ch = original[src++]; |
| 105 | 106 | |
| 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)) |
| 108 | 109 | { |
| 109 | 110 | ch = '?'; |
| 110 | 111 | hichars++; |