diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-25 13:24:11 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-25 13:24:11 (GMT) |
commit | 567df9318fff6d1bb570191c33ea68cd6ef88bee (patch) | |
tree | 72e310c422cea117abe859a6bddf0b613a2db589 /src/uscxml/plugins/datamodel/ecmascript | |
parent | be3c180fec71866a91b5f9297708d581bc1d6435 (diff) | |
download | uscxml-567df9318fff6d1bb570191c33ea68cd6ef88bee.zip uscxml-567df9318fff6d1bb570191c33ea68cd6ef88bee.tar.gz uscxml-567df9318fff6d1bb570191c33ea68cd6ef88bee.tar.bz2 |
More work on IMInvoker, renamed Blob attributes and some XPath datamodel fixes
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp | 28 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/TypedArray.h | 20 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp index d24639a..8d126e9 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.cpp @@ -4,14 +4,14 @@ #define DATAVIEW_TYPED_GET(type) \ type retVal;\ -if (index + _start + sizeof(type) > _buffer->_size)\ +if (index + _start + sizeof(type) > _buffer->size)\ return 0;\ -memcpy(&retVal, _buffer->_data + (_start + index), sizeof(type)); +memcpy(&retVal, _buffer->data + (_start + index), sizeof(type)); #define DATAVIEW_TYPED_SET(type) \ -if (index + _start + sizeof(type) > _buffer->_size)\ +if (index + _start + sizeof(type) > _buffer->size)\ return;\ -memcpy(_buffer->_data + (_start + index), &value, sizeof(type)); +memcpy(_buffer->data + (_start + index), &value, sizeof(type)); namespace uscxml { @@ -29,26 +29,26 @@ ArrayBuffer::ArrayBuffer(void* data, unsigned int size) { unsigned long ArrayBuffer::getByteLength() { if (!_buffer) return 0; - return _buffer->_size; + return _buffer->size; } ArrayBuffer ArrayBuffer::slice(long begin, long end) { if (!_buffer) { return ArrayBuffer(0); } - unsigned int realBegin = (begin + _buffer->_size) % _buffer->_size; - unsigned int realEnd = (end + _buffer->_size) % _buffer->_size; + unsigned int realBegin = (begin + _buffer->size) % _buffer->size; + unsigned int realEnd = (end + _buffer->size) % _buffer->size; if (realEnd < realBegin) { return ArrayBuffer(0); } ArrayBuffer arrBuffer(realEnd - realBegin); - memcpy(arrBuffer._buffer->_data, _buffer->_data + realBegin, realEnd - realBegin); + memcpy(arrBuffer._buffer->data, _buffer->data + realBegin, realEnd - realBegin); return arrBuffer; } ArrayBuffer ArrayBuffer::slice(long begin) { - return slice(begin, _buffer->_size); + return slice(begin, _buffer->size); } bool ArrayBuffer::isView(void*) { @@ -65,25 +65,25 @@ ArrayBuffer ArrayBufferView::getBuffer() { DataView::DataView(ArrayBuffer* buffer, unsigned long byteOffset, unsigned long byteLength) { _start = byteOffset; - if (_start > buffer->_buffer->_size) + if (_start > buffer->_buffer->size) return; _end = _start + byteLength; - if (_end > buffer->_buffer->_size) + if (_end > buffer->_buffer->size) return; _buffer = buffer->_buffer; } DataView::DataView(ArrayBuffer* buffer , unsigned long byteOffset) { _start = byteOffset; - _end = buffer->_buffer->_size; - if (_start > buffer->_buffer->_size) + _end = buffer->_buffer->size; + if (_start > buffer->_buffer->size) return; _buffer = buffer->_buffer; } DataView::DataView(ArrayBuffer* buffer) { _start = 0; - _end = (buffer->_buffer->_size); + _end = (buffer->_buffer->size); _buffer = buffer->_buffer; } diff --git a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h index 5584721..460afd4 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h +++ b/src/uscxml/plugins/datamodel/ecmascript/TypedArray.h @@ -199,7 +199,7 @@ public: _start = byteOffset / sizeof(S); _end = _start + length; - if (_end > buffer->_buffer->_size / sizeof(S)) + if (_end > buffer->_buffer->size / sizeof(S)) return; _buffer = buffer->_buffer; @@ -209,12 +209,12 @@ public: return; _start = byteOffset / sizeof(S); - _end = buffer->_buffer->_size / sizeof(S); + _end = buffer->_buffer->size / sizeof(S); _buffer = buffer->_buffer; } TypedArray(uscxml::ArrayBuffer* buffer) { _start = 0; - _end = (buffer->_buffer->_size) / sizeof(S); + _end = (buffer->_buffer->size) / sizeof(S); _buffer = buffer->_buffer; } @@ -225,7 +225,7 @@ public: _start = byteOffset / sizeof(S); _end = _start + length; - if (_end > buffer->_size / sizeof(S)) + if (_end > buffer->size / sizeof(S)) return; _buffer = buffer; @@ -271,7 +271,7 @@ public: if (index >= getLength()) return static_cast<T>(0); S retVal; - memcpy(&retVal, _buffer->_data + (_start + index) * sizeof(S), sizeof(S)); + memcpy(&retVal, _buffer->data + (_start + index) * sizeof(S), sizeof(S)); return retVal; } @@ -280,7 +280,7 @@ public: * Sets the element at the given numeric index to the given value. */ void set(unsigned long index, T value) { - memcpy(_buffer->_data + (_start + index) * sizeof(S), &value, sizeof(S)); + memcpy(_buffer->data + (_start + index) * sizeof(S), &value, sizeof(S)); } /** @@ -298,13 +298,13 @@ public: void set(TypedArray<T, S>* value, unsigned long offset) { if (!_buffer) return; - if (offset * sizeof(S) + value->getByteLength() > _buffer->_size) + if (offset * sizeof(S) + value->getByteLength() > _buffer->size) return; unsigned long otherOffset = value->_start * sizeof(S); // will this work if we use the same buffer? - memcpy(_buffer->_data + (_start + offset) * sizeof(S), value->_buffer->_data + otherOffset, value->getByteLength()); + memcpy(_buffer->data + (_start + offset) * sizeof(S), value->_buffer->data + otherOffset, value->getByteLength()); } void set(TypedArray<T, S>* value) { @@ -330,7 +330,7 @@ public: return; if (sizeof(T) == sizeof(S)) { - memcpy(_buffer->_data + offset, (void*)&data[0], data.size() * sizeof(S)); + memcpy(_buffer->data + offset, (void*)&data[0], data.size() * sizeof(S)); } else { S* buffer = (S*)malloc(data.size() * sizeof(S)); typename std::vector<T>::const_iterator dataIter = data.begin(); @@ -340,7 +340,7 @@ public: dataIter++; i++; } - memcpy(_buffer->_data + offset, buffer, data.size() * sizeof(S)); + memcpy(_buffer->data + offset, buffer, data.size() * sizeof(S)); free (buffer); } } |