| 3254 | } |
| 3255 | |
| 3256 | const char* ImParseFormatFindEnd(const char* fmt) |
| 3257 | { |
| 3258 | // Printf/scanf types modifiers: I/L/h/j/l/t/w/z. Other uppercase letters qualify as types aka end of the format. |
| 3259 | if (fmt[0] != '%') |
| 3260 | return fmt; |
| 3261 | const unsigned int ignored_uppercase_mask = (1 << ('I' - 'A')) | (1 << ('L' - 'A')); |
| 3262 | const unsigned int ignored_lowercase_mask = (1 << ('h' - 'a')) | (1 << ('j' - 'a')) | (1 << ('l' - 'a')) | (1 << ('t' - 'a')) | (1 << ('w' - 'a')) | (1 << ('z' - 'a')); |
| 3263 | for (char c; (c = *fmt) != 0; fmt++) |
| 3264 | { |
| 3265 | if (c >= 'A' && c <= 'Z' && ((1 << (c - 'A')) & ignored_uppercase_mask) == 0) |
| 3266 | return fmt + 1; |
| 3267 | if (c >= 'a' && c <= 'z' && ((1 << (c - 'a')) & ignored_lowercase_mask) == 0) |
| 3268 | return fmt + 1; |
| 3269 | } |
| 3270 | return fmt; |
| 3271 | } |
| 3272 | |
| 3273 | // Extract the format out of a format string with leading or trailing decorations |
| 3274 | // fmt = "blah blah" -> return "" |
no outgoing calls
no test coverage detected