MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / getSoVersion

Function getSoVersion

ui-linux/src/deployer.cpp:17–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#define ELFCLASS64 2
16
17static QString getSoVersion(const QString &path)
18{
19 QFile f(path);
20 if (!f.open(QIODevice::ReadOnly))
21 return QString();
22
23 QByteArray data = f.readAll();
24 f.close();
25
26 const char* p = data.constData();
27 const char* end = p + data.size() - 20;
28
29 for (; p < end; ++p) {
30 if (p[0] >= '0' && p[0] <= '9' &&
31 p[1] == '.' &&
32 p[2] >= '0' && p[2] <= '9' &&
33 p[3] == '.' &&
34 p[4] >= '0' && p[4] <= '9' &&
35 p[5] == '+') {
36 const char* start = p;
37 const char* q = p + 6;
38 int hexCount = 0;
39 while (q < data.constData() + data.size() &&
40 ((*q >= '0' && *q <= '9') || (*q >= 'a' && *q <= 'f'))) {
41 ++hexCount;
42 ++q;
43 }
44 if (hexCount == 7) {
45 if (q + 6 <= data.constData() + data.size() &&
46 strncmp(q, "-dirty", 6) == 0) {
47 q += 6;
48 }
49 return QString::fromLatin1(start, q - start);
50 }
51 if (strncmp(p + 6, "unknown", 7) == 0) {
52 return QString::fromLatin1(start, 13);
53 }
54 }
55 }
56
57 return QString();
58}
59
60static bool isElf32Bit(const QString &path)
61{

Callers 1

checkPrerequisitesMethod · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected