MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / getVersion

Function getVersion

gui/mainwindow.cpp:2225–2250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2223}
2224
2225static int getVersion(const QString& nameWithVersion) {
2226 int ret = 0;
2227 int v = 0;
2228 int dot = 0;
2229 for (const auto c: nameWithVersion) {
2230 if (c == '\n' || c == '\r')
2231 break;
2232 if (c == ' ') {
2233 if (ret > 0 && dot == 1 && nameWithVersion.endsWith(" dev"))
2234 return (ret * 1000000) + (v * 1000) + 500;
2235 dot = ret = v = 0;
2236 }
2237 else if (c == '.') {
2238 ++dot;
2239 ret = (ret * 1000) + v;
2240 v = 0;
2241 } else if (c >= '0' && c <= '9')
2242 v = (v * 10) + (c.toLatin1() - '0');
2243 }
2244 ret = (ret * 1000) + v;
2245 while (dot < 2) {
2246 ++dot;
2247 ret *= 1000;
2248 }
2249 return ret;
2250}
2251
2252void MainWindow::replyFinished(QNetworkReply *reply) {
2253 reply->deleteLater();

Callers 3

parseFromArgsMethod · 0.85
replyFinishedMethod · 0.85
hideInformationMethod · 0.85

Calls 1

endsWithMethod · 0.80

Tested by

no test coverage detected