| 10510 | } |
| 10511 | |
| 10512 | void Tokenizer::simplifyMicrosoftStringFunctions() |
| 10513 | { |
| 10514 | // skip if not Windows |
| 10515 | if (!mSettings.platform.isWindows()) |
| 10516 | return; |
| 10517 | |
| 10518 | const bool ansi = (mSettings.platform.type == Platform::Type::Win32A); // TODO: check for UNICODE define instead |
| 10519 | for (Token *tok = list.front(); tok; tok = tok->next()) { |
| 10520 | if (tok->strAt(1) != "(") |
| 10521 | continue; |
| 10522 | |
| 10523 | const auto match = apis.find(tok->str()); |
| 10524 | if (match!=apis.end()) { |
| 10525 | tok->str(ansi ? match->second.mbcs : match->second.unicode); |
| 10526 | tok->originalName(match->first); |
| 10527 | } else if (Token::Match(tok, "_T|_TEXT|TEXT ( %char%|%str% )")) { |
| 10528 | tok->deleteNext(); |
| 10529 | tok->deleteThis(); |
| 10530 | tok->deleteNext(); |
| 10531 | if (!ansi) { |
| 10532 | tok->isLong(true); |
| 10533 | if (tok->str()[0] != 'L') |
| 10534 | tok->str("L" + tok->str()); |
| 10535 | } |
| 10536 | while (Token::Match(tok->next(), "_T|_TEXT|TEXT ( %char%|%str% )")) { |
| 10537 | tok->next()->deleteNext(); |
| 10538 | tok->next()->deleteThis(); |
| 10539 | tok->next()->deleteNext(); |
| 10540 | tok->concatStr(tok->strAt(1)); |
| 10541 | tok->deleteNext(); |
| 10542 | } |
| 10543 | } |
| 10544 | } |
| 10545 | } |
| 10546 | |
| 10547 | // Remove Borland code |
| 10548 | void Tokenizer::simplifyBorland() |
nothing calls this directly
no test coverage detected