types cast
parent
13fd211507
commit
53f177b7df
|
@ -126,10 +126,10 @@ void ZeroStorageCaptcha::updateCaptcha()
|
||||||
painter.setPen(QPen(Qt::black, m_lineWidth));
|
painter.setPen(QPen(Qt::black, m_lineWidth));
|
||||||
for (int i = 0; i < m_lineCount; i++)
|
for (int i = 0; i < m_lineCount; i++)
|
||||||
{
|
{
|
||||||
int x1 = (static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.width();
|
int x1 = static_cast<int>((static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.width());
|
||||||
int y1 = (static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.height();
|
int y1 = static_cast<int>((static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.height());
|
||||||
int x2 = (static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.width();
|
int x2 = static_cast<int>((static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.width());
|
||||||
int y2 = (static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.height();
|
int y2 = static_cast<int>((static_cast<qreal>(qrand()) / RAND_MAX) * m_captchaImage.height());
|
||||||
painter.drawLine(x1, y1, x2, y2);
|
painter.drawLine(x1, y1, x2, y2);
|
||||||
}
|
}
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
|
|
|
@ -60,12 +60,12 @@ QString KeyHolder::captchaSecretLine(const QString &captchaAnswer, bool prevTime
|
||||||
(prevTimeToken ? TimeToken::prevToken() : TimeToken::currentToken()) );
|
(prevTimeToken ? TimeToken::prevToken() : TimeToken::currentToken()) );
|
||||||
|
|
||||||
uint8_t signature[SIGSIZE];
|
uint8_t signature[SIGSIZE];
|
||||||
sign(reinterpret_cast<const uint8_t *>(hashedAnswer.toStdString().c_str()), hashedAnswer.size(), signature, m_key);
|
sign(reinterpret_cast<const uint8_t *>(hashedAnswer.toStdString().c_str()), static_cast<size_t>(hashedAnswer.size()), signature, m_key);
|
||||||
|
|
||||||
QByteArray rawResultArray;
|
QByteArray rawResultArray;
|
||||||
for(int i = 0; i < SIGSIZE; ++i)
|
for(int i = 0; i < SIGSIZE; ++i)
|
||||||
{
|
{
|
||||||
rawResultArray += signature[i];
|
rawResultArray += static_cast<char>(signature[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return compact(rawResultArray.toBase64(QByteArray::Base64Option::Base64UrlEncoding));
|
return compact(rawResultArray.toBase64(QByteArray::Base64Option::Base64UrlEncoding));
|
||||||
|
|
Loading…
Reference in New Issue