qt: Make sure expiration time is interpreted as unsigned number

* lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp (add_subkey): Convert
expiration time to uint_least32_t.
--

This fixes the corresponding test on 32-bit systems where time_t (the
return type of expirationTime()) is a signed 32-bit integer type.

GnuPG-bug-id: 6137
This commit is contained in:
Ingo Klöcker 2022-08-17 14:51:19 +02:00
parent 5f51a9b458
commit c977424a1d

View File

@ -64,7 +64,8 @@ static QGpgMEAddExistingSubkeyJob::result_type add_subkey(Context *ctx, const Ke
std::unique_ptr<GpgAddExistingSubkeyEditInteractor> interactor{new GpgAddExistingSubkeyEditInteractor{subkey.keyGrip()}};
if (!subkey.neverExpires()) {
const auto expiry = QDateTime::fromSecsSinceEpoch(subkey.expirationTime(), Qt::UTC).toString(u"yyyyMMdd'T'hhmmss").toStdString();
const auto expiry = QDateTime::fromSecsSinceEpoch(uint_least32_t(subkey.expirationTime()),
Qt::UTC).toString(u"yyyyMMdd'T'hhmmss").toStdString();
interactor->setExpiry(expiry);
}