mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 07:04:42 +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\"");
|
||||
return QScriptValue();
|
||||
}
|
||||
|
||||
QScriptValue newObject = cls->newInstance(bufferArg,
|
||||
(byteOffsetArg.isNumber()) ? byteOffsetArg.toInt32()
|
||||
: 0,
|
||||
(byteLengthArg.isNumber()) ? byteLengthArg.toInt32()
|
||||
: arrayBuffer->size());
|
||||
quint32 byteOffset = (byteOffsetArg.isNumber()) ? byteOffsetArg.toInt32() : 0;
|
||||
quint32 byteLength = (byteLengthArg.isNumber()) ? byteLengthArg.toInt32() : arrayBuffer->size() - byteOffset;
|
||||
QScriptValue newObject = cls->newInstance(bufferArg, byteOffset, byteLength);
|
||||
|
||||
if (context->isCalledAsConstructor()) {
|
||||
context->setThisObject(newObject);
|
||||
|
|
|
@ -97,11 +97,15 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, const QString& fileNam
|
|||
_arrayBufferClass(NULL)
|
||||
{
|
||||
_arrayBufferClass = new ArrayBufferClass(this);
|
||||
qDebug() << "Engine: " << this;
|
||||
qDebug() << "ArrayBuffer: " <<_arrayBufferClass;
|
||||
qDebug() << "DataView: " << new DataViewClass(this);
|
||||
qDebug() << "Int8Array: " << new Int8ArrayClass(this);
|
||||
qDebug() << "Initial thread: " << QThread::currentThread() << " " << thread();
|
||||
new DataViewClass(this);
|
||||
new Int8ArrayClass(this);
|
||||
new Uint8ArrayClass(this);
|
||||
new Int16ArrayClass(this);
|
||||
new Uint16ArrayClass(this);
|
||||
new Int32ArrayClass(this);
|
||||
new Uint32ArrayClass(this);
|
||||
new Float32ArrayClass(this);
|
||||
new Float64ArrayClass(this);
|
||||
}
|
||||
|
||||
ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
||||
|
@ -134,11 +138,15 @@ ScriptEngine::ScriptEngine(const QUrl& scriptURL,
|
|||
QUrl url(scriptURL);
|
||||
|
||||
_arrayBufferClass = new ArrayBufferClass(this);
|
||||
qDebug() << "Engine: " << this;
|
||||
qDebug() << "ArrayBuffer: " <<_arrayBufferClass;
|
||||
qDebug() << "DataView: " << new DataViewClass(this);
|
||||
qDebug() << "Int8Array: " << new Int8ArrayClass(this);
|
||||
qDebug() << "Initial thread: " << QThread::currentThread() << " " << thread();
|
||||
new DataViewClass(this);
|
||||
new Int8ArrayClass(this);
|
||||
new Uint8ArrayClass(this);
|
||||
new Int16ArrayClass(this);
|
||||
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
|
||||
const int WINDOWS_DRIVE_LETTER_SIZE = 1;
|
||||
|
|
Loading…
Reference in a new issue