Rename QBA::{to,from}Uint8Array() → {to,from}EcmaUint8Array()
Found in API review: from/toUintArray() is too generic a name, make sure its name gives enough context. Change-Id: Ie10ff06ae11a5e168c4c91b60a9698a41d0429fc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 7db28fb4bd4f328cef3c722e4e9c00305f830858) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
b0d395e27c
commit
0f212adbd3
@ -464,12 +464,12 @@ QByteArray decoded = encoded.percentDecoded(); // Set to "Qt is great!"
|
||||
|
||||
//! [55]
|
||||
emscripten::val uint8array = emscripten::val::global("g_uint8array");
|
||||
QByteArray byteArray = QByteArray::fromUint8Array(uint8array);
|
||||
QByteArray byteArray = QByteArray::fromEcmaUint8Array(uint8array);
|
||||
//! [55]
|
||||
|
||||
//! [56]
|
||||
QByteArray byteArray = "test";
|
||||
emscripten::val uint8array = QByteArray::toUint8Array(byteArray);
|
||||
emscripten::val uint8array = QByteArray::toEcmaUint8Array(byteArray);
|
||||
//! [56]
|
||||
|
||||
}
|
||||
|
@ -4867,10 +4867,10 @@ QByteArray QByteArray::toPercentEncoding(const QByteArray &exclude, const QByteA
|
||||
\since 6.5
|
||||
\ingroup platform-type-conversions
|
||||
|
||||
\sa toUint8Array()
|
||||
\sa toEcmaUint8Array()
|
||||
*/
|
||||
|
||||
QByteArray QByteArray::fromUint8Array(emscripten::val uint8array)
|
||||
QByteArray QByteArray::fromEcmaUint8Array(emscripten::val uint8array)
|
||||
{
|
||||
return qstdweb::Uint8Array(uint8array).copyToQByteArray();
|
||||
}
|
||||
@ -4890,9 +4890,9 @@ QByteArray QByteArray::fromUint8Array(emscripten::val uint8array)
|
||||
\since 6.5
|
||||
\ingroup platform-type-conversions
|
||||
|
||||
\sa toUint8Array()
|
||||
\sa toEcmaUint8Array()
|
||||
*/
|
||||
emscripten::val QByteArray::toUint8Array()
|
||||
emscripten::val QByteArray::toEcmaUint8Array()
|
||||
{
|
||||
return qstdweb::Uint8Array::copyFrom(*this).val();
|
||||
}
|
||||
|
@ -394,8 +394,8 @@ public:
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WASM) || defined(Q_QDOC)
|
||||
static QByteArray fromUint8Array(emscripten::val uint8array);
|
||||
emscripten::val toUint8Array();
|
||||
static QByteArray fromEcmaUint8Array(emscripten::val uint8array);
|
||||
emscripten::val toEcmaUint8Array();
|
||||
#endif
|
||||
|
||||
typedef char *iterator;
|
||||
|
@ -12,21 +12,6 @@
|
||||
#include <emscripten/val.h>
|
||||
#include <emscripten/bind.h>
|
||||
|
||||
// FIXME: replace with shared implementation from qstdweb
|
||||
QByteArray fromUint8Array(emscripten::val uint8array)
|
||||
{
|
||||
qstdweb::ArrayBuffer arrayBuffer(uint8array);
|
||||
|
||||
using qstdweb::Uint8Array;
|
||||
Uint8Array sourceArray(arrayBuffer);
|
||||
if (sourceArray.length() > std::numeric_limits<qsizetype>::max())
|
||||
return QByteArray();
|
||||
QByteArray destinationArray;
|
||||
destinationArray.resize(sourceArray.length());
|
||||
sourceArray.copyTo(destinationArray.data());
|
||||
return destinationArray;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace emscripten;
|
||||
@ -121,7 +106,7 @@ void QWasmFontDatabase::populateFamily(const QString &familyName)
|
||||
.thenFunc = [](val status) {
|
||||
qCDebug(lcQpaFonts) << "onArrayBuffer" ;
|
||||
|
||||
QByteArray fontByteArray = fromUint8Array(status);
|
||||
QByteArray fontByteArray = QByteArray::fromEcmaUint8Array(status);
|
||||
|
||||
QFreeTypeFontDatabase::addTTFile(fontByteArray, QByteArray());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user