Showing the changes to libraries/script-engine/src/qtscript/ArrayBufferClass.cpp (1 of 2 files). Show all
Unified · Split
| @@ -30,11 +30,11 @@ QObject(scriptEngine), · 29 unmodified lines | ||
| 30 | 30 | QScriptClass(scriptEngine) { |
| 31 | 31 | qScriptRegisterMetaType<QByteArray>(engine(), toScriptValue, fromScriptValue); |
| 32 | 32 | QScriptValue global = engine()->globalObject(); |
| 33 | − | |
| 33 | + | |
| 34 | 34 | // Save string handles for quick lookup |
| 35 | 35 | _name = engine()->toStringHandle(CLASS_NAME.toLatin1()); |
| 36 | 36 | _byteLength = engine()->toStringHandle(BYTE_LENGTH_PROPERTY_NAME.toLatin1()); |
| 37 | − | |
| 37 | + | |
| 38 | 38 | // build prototype |
| 39 | 39 | _proto = engine()->newQObject(new ArrayBufferPrototype(this), |
| 40 | 40 | QScriptEngine::QtOwnership, |
| @@ -42,13 +42,13 @@ QScriptClass(scriptEngine) { · 1 unmodified line | ||
| 42 | 42 | QScriptEngine::ExcludeSuperClassMethods | |
| 43 | 43 | QScriptEngine::ExcludeSuperClassProperties); |
| 44 | 44 | _proto.setPrototype(global.property("Object").property("prototype")); |
| 45 | − | |
| 45 | + | |
| 46 | 46 | // Register constructor |
| 47 | 47 | _ctor = engine()->newFunction(construct, _proto); |
| 48 | 48 | _ctor.setData(engine()->toScriptValue(this)); |
| 49 | − | |
| 49 | + | |
| 50 | 50 | engine()->globalObject().setProperty(name(), _ctor); |
| 51 | − | |
| 51 | + | |
| 52 | 52 | // Registering other array types |
| 53 | 53 | // The script engine is there parent so it'll delete them with itself |
| 54 | 54 | new DataViewClass(scriptEngine); |
| @@ -99,16 +99,16 @@ QScriptValue ArrayBufferClass::construct(QScriptContext* context, QScriptEngine* · 44 unmodified lines | ||
| 99 | 99 | if (!arg.isValid() || !arg.isNumber()) { |
| 100 | 100 | return QScriptValue(); |
| 101 | 101 | } |
| 102 | − | |
| 102 | + | |
| 103 | 103 | quint32 size = arg.toInt32(); |
| 104 | 104 | QScriptValue newObject = cls->newInstance(size); |
| 105 | − | |
| 105 | + | |
| 106 | 106 | if (context->isCalledAsConstructor()) { |
| 107 | 107 | // if called with keyword new, replace this object. |
| 108 | 108 | context->setThisObject(newObject); |
| 109 | 109 | return engine->undefinedValue(); |
| 110 | 110 | } |
| 111 | − | |
| 111 | + | |
| 112 | 112 | return newObject; |
| 113 | 113 | } |
| 114 | 114 | |
| @@ -120,7 +120,7 @@ QScriptClass::QueryFlags ArrayBufferClass::queryProperty(const QScriptValue& obj · 5 unmodified lines | ||
| 120 | 120 | // if the property queried is byteLength, only handle read access |
| 121 | 121 | return flags &= HandlesReadAccess; |
| 122 | 122 | } |
| 123 | − return 0; // No access | |
| 123 | + return QScriptClass::QueryFlags(); // No access | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | QScriptValue ArrayBufferClass::property(const QScriptValue& object, |