同步操作将从 Gitee 极速下载/Cppcheck 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/** Cppcheck - A tool for static C/C++ code analysis* Copyright (C) 2007-2020 Cppcheck team.** This program is free software: you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation, either version 3 of the License, or* (at your option) any later version.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** You should have received a copy of the GNU General Public License* along with this program. If not, see <http://www.gnu.org/licenses/>.*/#include "utils.h"#include <utility>#include <stack>int caseInsensitiveStringCompare(const std::string &lhs, const std::string &rhs){if (lhs.size() != rhs.size())return (lhs.size() < rhs.size()) ? -1 : 1;for (unsigned int i = 0; i < lhs.size(); ++i) {const int c1 = std::toupper(lhs[i]);const int c2 = std::toupper(rhs[i]);if (c1 != c2)return (c1 < c2) ? -1 : 1;}return 0;}bool isValidGlobPattern(const std::string& pattern){for (std::string::const_iterator i = pattern.begin(); i != pattern.end(); ++i) {if (*i == '*' || *i == '?') {std::string::const_iterator j = i + 1;if (j != pattern.end() && (*j == '*' || *j == '?')) {return false;}}}return true;}bool matchglob(const std::string& pattern, const std::string& name){const char* p = pattern.c_str();const char* n = name.c_str();std::stack<std::pair<const char*, const char*> > backtrack;for (;;) {bool matching = true;while (*p != '0円' && matching) {switch (*p) {case '*':// Step forward until we match the next character after *while (*n != '0円' && *n != p[1]) {n++;}if (*n != '0円') {// If this isn't the last possibility, save it for laterbacktrack.push(std::make_pair(p, n));}break;case '?':// Any character matches unless we're at the end of the nameif (*n != '0円') {n++;} else {matching = false;}break;default:// Non-wildcard characters match literallyif (*n == *p) {n++;} else if (*n == '\\' && *p == '/') {n++;} else if (*n == '/' && *p == '\\') {n++;} else {matching = false;}break;}p++;}// If we haven't failed matching and we've reached the end of the name, then successif (matching && *n == '0円') {return true;}// If there are no other paths to try, then failif (backtrack.empty()) {return false;}// Restore pointers from backtrack stackp = backtrack.top().first;n = backtrack.top().second;backtrack.pop();// Advance name pointer by one because the current position didn't workn++;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。