mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 05:58:35 +02:00
Typed arrays bug fixing
This commit is contained in:
parent
ff378b60ac
commit
3070ac457f
2 changed files with 21 additions and 16 deletions
|
@ -74,12 +74,9 @@ QScriptValue DataViewClass::construct(QScriptContext *context, QScriptEngine *en
|
||||||
engine->evaluate("throw \"RangeError: byteLength out of range\"");
|
engine->evaluate("throw \"RangeError: byteLength out of range\"");
|
||||||
return QScriptValue();
|
return QScriptValue();
|
||||||
}
|
}
|
||||||
|
quint32 byteOffset = (byteOffsetArg.isNumber()) ? byteOffsetArg.toInt32() : 0;
|
||||||
QScriptValue newObject = cls->newInstance(bufferArg,
|
quint32 byteLength = (byteLengthArg.isNumber()) ? byteLengthArg.toInt32() : arrayBuffer->size() - byteOffset;
|
||||||
(byteOffsetArg.isNumber()) ? byteOffsetArg.toInt32()
|
QScriptValue newObject = cls->newInstance(bufferArg, byteOffset, byteLength);
|
||||||
: 0,
|
|
||||||
(byteLengthArg.isNumber()) ? byteLengthArg.toInt32()
|
|
||||||
: arrayBuffer->size());
|
|
||||||
|
|
||||||
if (context->isCalledAsConstructor()) {
|
if (context->isCalledAsConstructor()) {
|
||||||
context->setThisObject(newObject);
|
context->setThisObject(newObject);
|
||||||
|
|
|
@ -97,11 +97,15 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam
|
||||||
_arrayBufferClass(NULL)
|
_arrayBufferClass(NULL)
|
||||||
{
|
{
|
||||||
_arrayBufferClass = new ArrayBufferClass(this);
|
_arrayBufferClass = new ArrayBufferClass(this);
|
||||||
qDebug() << "Engine: " << this;
|
new DataViewClass(this);
|
||||||
qDebug() << "ArrayBuffer: " <<_arrayBufferClass;
|
new Int8ArrayClass(this);
|
||||||
qDebug() << "DataView: " << new DataViewClass(this);
|
new Uint8ArrayClass(this);
|
||||||
qDebug() << "Int8Array: " << new Int8ArrayClass(this);
|
new Int16ArrayClass(this);
|
||||||
qDebug() << "Initial thread: " << QThread::currentThread() << " " << thread();
|
new Uint16ArrayClass(this);
|
||||||
|
new Int32ArrayClass(this);
|
||||||
|
new Uint32ArrayClass(this);
|
||||||
|
new Float32ArrayClass(this);
|
||||||
|
new Float64ArrayClass(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
||||||
|
@ -134,11 +138,15 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
||||||
QUrl url(scriptURL);
|
QUrl url(scriptURL);
|
||||||
|
|
||||||
_arrayBufferClass = new ArrayBufferClass(this);
|
_arrayBufferClass = new ArrayBufferClass(this);
|
||||||
qDebug() << "Engine: " << this;
|
new DataViewClass(this);
|
||||||
qDebug() << "ArrayBuffer: " <<_arrayBufferClass;
|
new Int8ArrayClass(this);
|
||||||
qDebug() << "DataView: " << new DataViewClass(this);
|
new Uint8ArrayClass(this);
|
||||||
qDebug() << "Int8Array: " << new Int8ArrayClass(this);
|
new Int16ArrayClass(this);
|
||||||
qDebug() << "Initial thread: " << QThread::currentThread() << " " << thread();
|
new Uint16ArrayClass(this);
|
||||||
|
new Int32ArrayClass(this);
|
||||||
|
new Uint32ArrayClass(this);
|
||||||
|
new Float32ArrayClass(this);
|
||||||
|
new Float64ArrayClass(this);
|
||||||
|
|
||||||
// if the scheme length is one or lower, maybe they typed in a file, let's try
|
// if the scheme length is one or lower, maybe they typed in a file, let's try
|
||||||
const int WINDOWS_DRIVE_LETTER_SIZE = 1;
|
const int WINDOWS_DRIVE_LETTER_SIZE = 1;
|
||||||
|
|
Loading…
Reference in a new issue