| 3182 | } |
| 3183 | |
| 3184 | const char* ImParseFormatFindEnd(const char* fmt) |
| 3185 | { |
| 3186 | // Printf/scanf types modifiers: I/L/h/j/l/t/w/z. Other uppercase letters qualify as types aka end of the format. |
| 3187 | if (fmt[0] != '%') |
| 3188 | return fmt; |
| 3189 | const unsigned int ignored_uppercase_mask = (1 << ('I'-'A')) | (1 << ('L'-'A')); |
| 3190 | const unsigned int ignored_lowercase_mask = (1 << ('h'-'a')) | (1 << ('j'-'a')) | (1 << ('l'-'a')) | (1 << ('t'-'a')) | (1 << ('w'-'a')) | (1 << ('z'-'a')); |
| 3191 | for (char c; (c = *fmt) != 0; fmt++) |
| 3192 | { |
| 3193 | if (c >= 'A' && c <= 'Z' && ((1 << (c - 'A')) & ignored_uppercase_mask) == 0) |
| 3194 | return fmt + 1; |
| 3195 | if (c >= 'a' && c <= 'z' && ((1 << (c - 'a')) & ignored_lowercase_mask) == 0) |
| 3196 | return fmt + 1; |
| 3197 | } |
| 3198 | return fmt; |
| 3199 | } |
| 3200 | |
| 3201 | // Extract the format out of a format string with leading or trailing decorations |
| 3202 | // fmt = "blah blah" -> return fmt |
no outgoing calls
no test coverage detected