Skip to content

Commit 399f1da

Browse files
committed
Fix pointers >= 2**31.
1 parent 57d7ff8 commit 399f1da

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wa-sqlite",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"type": "module",
55
"main": "src/sqlite-api.js",
66
"types": "src/types/index.d.ts",

src/libmodule.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ const mod_methods = {
6363
const struct = {};
6464
struct['nConstraint'] = getValue(p + offset[0], 'i32');
6565
struct['aConstraint'] = [];
66-
const constraintPtr = getValue(p + offset[1], 'i32');
66+
const constraintPtr = getValue(p + offset[1], '*');
6767
const constraintSize = mapStructToLayout.get('sqlite3_index_constraint').size;
6868
for (let i = 0; i < struct['nConstraint']; ++i) {
6969
struct['aConstraint'].push(
7070
unpack_sqlite3_index_constraint(constraintPtr + i * constraintSize));
7171
}
7272
struct['nOrderBy'] = getValue(p + offset[2], 'i32');
7373
struct['aOrderBy'] = [];
74-
const orderPtr = getValue(p + offset[3], 'i32');
74+
const orderPtr = getValue(p + offset[3], '*');
7575
const orderSize = mapStructToLayout.get('sqlite3_index_orderby').size;
7676
for (let i = 0; i < struct['nOrderBy']; ++i) {
7777
struct['aOrderBy'].push(
@@ -117,7 +117,7 @@ const mod_methods = {
117117
function pack_sqlite3_index_info(p, struct) {
118118
const layout = mapStructToLayout.get('sqlite3_index_info');
119119
const offset = layout.offsets;
120-
const usagePtr = getValue(p + offset[4], 'i32');
120+
const usagePtr = getValue(p + offset[4], '*');
121121
const usageSize = mapStructToLayout.get('sqlite3_index_constraint_usage').size;
122122
for (let i = 0; i < struct['nConstraint']; ++i) {
123123
pack_sqlite_index_constraint_usage(
@@ -129,7 +129,7 @@ const mod_methods = {
129129
const length = lengthBytesUTF8(struct['idxStr']);
130130
const z = ccall('sqlite3_malloc', 'number', ['number'], [length + 1]);
131131
stringToUTF8(struct['idxStr'], z, length + 1);
132-
setValue(p + offset[6], z, 'i32');
132+
setValue(p + offset[6], z, '*');
133133
setValue(p + offset[7], 1, 'i32');
134134
}
135135
setValue(p + offset[8], struct['orderByConsumed'], 'i32');

src/sqlite-api.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export function Factory(Module) {
490490
zVfs = createUTF8(zVfs);
491491
const result = await f(zFilename, tmpPtr[0], flags, zVfs);
492492

493-
const db = Module.getValue(tmpPtr[0], 'i32');
493+
const db = Module.getValue(tmpPtr[0], '*');
494494
databases.add(db);
495495
Module._sqlite3_free(zVfs);
496496

@@ -507,10 +507,10 @@ export function Factory(Module) {
507507
const result = await f(db, sql, -1, tmpPtr[0], tmpPtr[1]);
508508
check(fname, result, db);
509509

510-
const stmt = Module.getValue(tmpPtr[0], 'i32');
510+
const stmt = Module.getValue(tmpPtr[0], '*');
511511
if (stmt) {
512512
mapStmtToDB.set(stmt, db);
513-
return { stmt, sql: Module.getValue(tmpPtr[1], 'i32') };
513+
return { stmt, sql: Module.getValue(tmpPtr[1], '*') };
514514
}
515515
return null;
516516
};

0 commit comments

Comments
 (0)