added user tag for reports, fixed couple of compile warnings in gcc

This commit is contained in:
John Preston 2016-02-15 18:52:11 +03:00
parent ebd77ba71d
commit 71e544e0fc
7 changed files with 43 additions and 4 deletions

View File

@ -215,6 +215,7 @@ struct SandboxDataStruct {
ConnectionProxy PreLaunchProxy;
};
SandboxDataStruct *SandboxData = 0;
uint64 SandboxUserTag = 0;
namespace Sandbox {
@ -276,6 +277,27 @@ namespace Sandbox {
f.write("1");
}
}
srand((int32)time(NULL));
SandboxUserTag = 0;
QFile usertag(cWorkingDir() + qsl("tdata/usertag"));
if (usertag.open(QIODevice::ReadOnly)) {
if (usertag.read(reinterpret_cast<char*>(&SandboxUserTag), sizeof(uint64)) != sizeof(uint64)) {
SandboxUserTag = 0;
}
usertag.close();
}
if (!SandboxUserTag) {
do {
memsetrnd_bad(SandboxUserTag);
} while (!SandboxUserTag);
if (usertag.open(QIODevice::WriteOnly)) {
usertag.write(reinterpret_cast<char*>(&SandboxUserTag), sizeof(uint64));
usertag.close();
}
}
}
void start() {
@ -290,8 +312,6 @@ namespace Sandbox {
break;
}
}
srand((int32)time(NULL));
}
void finish() {
@ -299,6 +319,10 @@ namespace Sandbox {
SandboxData = 0;
}
uint64 UserTag() {
return SandboxUserTag;
}
DefineReadOnlyVar(Sandbox, QString, LangSystemISO);
DefineReadOnlyVar(Sandbox, int32, LangSystem);
DefineVar(Sandbox, QByteArray, LastCrashDump);

View File

@ -112,6 +112,8 @@ namespace Sandbox {
void start();
void finish();
uint64 UserTag();
DeclareReadOnlyVar(QString, LangSystemISO);
DeclareReadOnlyVar(int32, LangSystem);
DeclareVar(QByteArray, LastCrashDump);

View File

@ -3803,6 +3803,7 @@ HistoryDocument::HistoryDocument(DocumentData *document, const QString &caption,
}
HistoryDocument::HistoryDocument(const HistoryDocument &other) : HistoryFileMedia()
, Interfaces()
, _parent(0)
, _data(other._data) {
const HistoryDocumentCaptioned *captioned = other.Get<HistoryDocumentCaptioned>();

View File

@ -868,6 +868,7 @@ namespace SignalHandlers {
ProcessAnnotations["Version"] = (cBetaVersion() ? qsl("%1 beta").arg(cBetaVersion()) : (cDevVersion() ? qsl("%1 dev") : qsl("%1")).arg(AppVersion)).toUtf8().constData();
ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData();
ProcessAnnotations["Platform"] = cPlatformString().toUtf8().constData();
ProcessAnnotations["UserTag"] = QString::number(Sandbox::UserTag(), 16).toUtf8().constData();
QString dumpspath = cWorkingDir() + qsl("tdata/dumps");
QDir().mkpath(dumpspath);

View File

@ -426,7 +426,7 @@ namespace {
size = (((uint32(bytes[3]) << 8) | uint32(bytes[2])) << 8) | uint32(bytes[1]);
len -= 3;
}
if (size * sizeof(mtpPrime) != len) {
if (size * int32(sizeof(mtpPrime)) != len) {
LOG(("TCP Error: bad packet header"));
TCP_LOG(("TCP Error: bad packet header, packet: %1").arg(Logs::mb(packet, length).str()));
return mtpBuffer(1, -500);

View File

@ -222,6 +222,17 @@ inline void memsetrnd(T &value) {
memset_rand(&value, sizeof(value));
}
inline void memset_rand_bad(void *data, uint32 len) {
for (uchar *i = reinterpret_cast<uchar*>(data), *e = i + len; i != e; ++i) {
*i = uchar(rand() & 0xFF);
}
}
template <typename T>
inline void memsetrnd_bad(T &value) {
memset_rand_bad(&value, sizeof(value));
}
class ReadLockerAttempt {
public:

View File

@ -2118,7 +2118,7 @@ LastCrashedWindow::LastCrashedWindow()
#endif
_pleaseSendReport.setText(qsl("Please send us a crash report."));
_yourReportName.setText(qsl("Your crash report tag: %1").arg(_minidumpName));
_yourReportName.setText(qsl("Your Report Tag: %1\nYour User Tag: %2").arg(QString(_minidumpName).replace(".dmp", "")).arg(Sandbox::UserTag(), 0, 16));
_yourReportName.setCursor(style::cur_text);
_yourReportName.setTextInteractionFlags(Qt::TextSelectableByMouse);