Skip to content

Commit bbd480d

Browse files
committed
change ffi elementAt(i).value assignment to [] indexed assignment
fixes #87
1 parent b733f30 commit bbd480d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/src/bindings/structs.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class OBX_id_array extends Struct {
3232
array.length = items.length;
3333
array._itemsPtr = allocate<Uint64>(count: array.length);
3434
for (int i = 0; i < items.length; ++i) {
35-
array._itemsPtr.elementAt(i).value = items[i];
35+
array._itemsPtr[i] = items[i];
3636
}
3737

3838
// call the function with the structure and free afterwards
@@ -83,7 +83,7 @@ class OBX_bytes extends Struct {
8383
// create a copy of the data
8484
bytes._dataPtr = allocate<Uint8>(count: bytes.length);
8585
for (int i = 0; i < data.length; ++i) {
86-
bytes._dataPtr.elementAt(i).value = data[i];
86+
bytes._dataPtr[i] = data[i];
8787
}
8888

8989
return ptr;

lib/src/box.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Box<T> {
109109
Pointer<Uint64> allIdsMemory = allocate<Uint64>(count: objects.length);
110110
try {
111111
for (int i = 0; i < allPropVals.length; ++i) {
112-
allIdsMemory.elementAt(i).value = (allPropVals[i][_modelEntity.idProperty.name] as int);
112+
allIdsMemory[i] = (allPropVals[i][_modelEntity.idProperty.name] as int);
113113
}
114114

115115
// marshal all objects to be put into the box

lib/src/query/query.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class StringCondition extends PropertyCondition<String> {
307307
final arrayOfCStrings = allocate<Pointer<Utf8>>(count: listLength);
308308
try {
309309
for (int i = 0; i < _list.length; i++) {
310-
arrayOfCStrings.elementAt(i).value = Utf8.toUtf8(_list[i]);
310+
arrayOfCStrings[i] = Utf8.toUtf8(_list[i]);
311311
}
312312
return func(builder._cBuilder, _property._propertyId, arrayOfCStrings, listLength, _caseSensitive ? 1 : 0);
313313
} finally {
@@ -373,7 +373,7 @@ class IntegerCondition extends PropertyCondition<int> {
373373
final listPtr = allocate<P>(count: length);
374374
try {
375375
for (int i=0; i<length; i++) {
376-
listPtr.elementAt(i).value = _list[i] as int; // Error: Expected type 'P' to be a valid and instantiated subtype of 'NativeType'. // wtf? Compiler bug?
376+
listPtr[i] = _list[i] as int; // Error: Expected type 'P' to be a valid and instantiated subtype of 'NativeType'. // wtf? Compiler bug?
377377
}
378378
return func(builder._cBuilder, _property.propertyId, listPtr, length);
379379
}finally {
@@ -388,7 +388,7 @@ class IntegerCondition extends PropertyCondition<int> {
388388
final listPtr = allocate<Int32>(count: length);
389389
try {
390390
for (int i = 0; i < length; i++) {
391-
listPtr.elementAt(i).value = _list[i];
391+
listPtr[i] = _list[i];
392392
}
393393
return func(builder._cBuilder, _property._propertyId, listPtr, length);
394394
} finally {
@@ -402,7 +402,7 @@ class IntegerCondition extends PropertyCondition<int> {
402402
final listPtr = allocate<Int64>(count: length);
403403
try {
404404
for (int i = 0; i < length; i++) {
405-
listPtr.elementAt(i).value = _list[i];
405+
listPtr[i] = _list[i];
406406
}
407407
return func(builder._cBuilder, _property._propertyId, listPtr, length);
408408
} finally {
@@ -506,7 +506,7 @@ class ConditionGroup extends Condition {
506506
throw Exception("Failed to create condition " + _conditions[i].toString());
507507
}
508508

509-
intArrayPtr.elementAt(i).value = cid;
509+
intArrayPtr[i] = cid;
510510
}
511511

512512
// root All (AND) is implicit so no need to actually combine the conditions

0 commit comments

Comments
 (0)