Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 4

EulerRobot/Cppcheck

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (16)
Tags (70)
master
main
8936
revert-2679-patch-1
windows-release-matchcompiler
danmar-release-windows
windows-tweaks
warnings
checkThisUseAfterFree
appveyor_z3
XhmikosR-patch-2
XhmikosR-patch-1
nightly
travis
1.76.1
1.63.x
2.3
2.2
2.1
2.0
1.90
1.89
1.88
1.87
1.86
1.85
1.84
1.83
1.82
1.81
1.80
1.79
1.78
1.77
1.76.1
1.76
master
Branches (16)
Tags (70)
master
main
8936
revert-2679-patch-1
windows-release-matchcompiler
danmar-release-windows
windows-tweaks
warnings
checkThisUseAfterFree
appveyor_z3
XhmikosR-patch-2
XhmikosR-patch-1
nightly
travis
1.76.1
1.63.x
2.3
2.2
2.1
2.0
1.90
1.89
1.88
1.87
1.86
1.85
1.84
1.83
1.82
1.81
1.80
1.79
1.78
1.77
1.76.1
1.76
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (16)
Tags (70)
master
main
8936
revert-2679-patch-1
windows-release-matchcompiler
danmar-release-windows
windows-tweaks
warnings
checkThisUseAfterFree
appveyor_z3
XhmikosR-patch-2
XhmikosR-patch-1
nightly
travis
1.76.1
1.63.x
2.3
2.2
2.1
2.0
1.90
1.89
1.88
1.87
1.86
1.85
1.84
1.83
1.82
1.81
1.80
1.79
1.78
1.77
1.76.1
1.76
cppcheck
/
lib
/
utils.cpp
cppcheck
/
lib
/
utils.cpp
utils.cpp 3.46 KB
Copy Edit Raw Blame History
PKEuS authored 2020年05月11日 02:32 +08:00 . Refactorization: Moved code from header to source
/*
* 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 later
backtrack.push(std::make_pair(p, n));
}
break;
case '?':
// Any character matches unless we're at the end of the name
if (*n != '0円') {
n++;
} else {
matching = false;
}
break;
default:
// Non-wildcard characters match literally
if (*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 success
if (matching && *n == '0円') {
return true;
}
// If there are no other paths to try, then fail
if (backtrack.empty()) {
return false;
}
// Restore pointers from backtrack stack
p = backtrack.top().first;
n = backtrack.top().second;
backtrack.pop();
// Advance name pointer by one because the current position didn't work
n++;
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/EulerRobot/cppcheck.git
git@gitee.com:EulerRobot/cppcheck.git
EulerRobot
cppcheck
Cppcheck
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /