QCryptographicHash: move addData(QIODevice*) to Private
To be reused in QMessageAuthenticationCode. Pick-to: 6.5 Change-Id: Ie4f003ad38ce9072cf6ee52ef2d7a63438e4d7ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
d2e1c0aef1
commit
d53f8d6bbb
@ -243,6 +243,7 @@ public:
|
|||||||
|
|
||||||
void reset() noexcept;
|
void reset() noexcept;
|
||||||
void addData(QByteArrayView bytes) noexcept;
|
void addData(QByteArrayView bytes) noexcept;
|
||||||
|
bool addData(QIODevice *dev);
|
||||||
void finalize() noexcept;
|
void finalize() noexcept;
|
||||||
// when not called from the static hash() function, this function needs to be
|
// when not called from the static hash() function, this function needs to be
|
||||||
// called with finalizeMutex held (finalize() will do that):
|
// called with finalizeMutex held (finalize() will do that):
|
||||||
@ -698,6 +699,11 @@ void QCryptographicHashPrivate::addData(QByteArrayView bytes) noexcept
|
|||||||
\since 5.0
|
\since 5.0
|
||||||
*/
|
*/
|
||||||
bool QCryptographicHash::addData(QIODevice *device)
|
bool QCryptographicHash::addData(QIODevice *device)
|
||||||
|
{
|
||||||
|
return d->addData(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QCryptographicHashPrivate::addData(QIODevice *device)
|
||||||
{
|
{
|
||||||
if (!device->isReadable())
|
if (!device->isReadable())
|
||||||
return false;
|
return false;
|
||||||
@ -709,7 +715,7 @@ bool QCryptographicHash::addData(QIODevice *device)
|
|||||||
qint64 length;
|
qint64 length;
|
||||||
|
|
||||||
while ((length = device->read(buffer, sizeof(buffer))) > 0)
|
while ((length = device->read(buffer, sizeof(buffer))) > 0)
|
||||||
d->addData({buffer, qsizetype(length)}); // length always <= 1024
|
addData({buffer, qsizetype(length)}); // length always <= 1024
|
||||||
|
|
||||||
return device->atEnd();
|
return device->atEnd();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user