Skip to content

Commit 68d5000

Browse files
authored
Make libsql-ffi workspace dependency (#1996)
2 parents eba2582 + 7437691 commit 68d5000

File tree

7 files changed

+28
-12
lines changed

7 files changed

+28
-12
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ license = "MIT"
3232
repository = "https://github.com/tursodatabase/libsql"
3333

3434
[workspace.dependencies]
35+
libsql-ffi = { path = "libsql-ffi", version = "0.9.0" }
3536
libsql-sys = { path = "libsql-sys", version = "0.9.0", default-features = false }
3637
libsql-hrana = { path = "libsql-hrana", version = "0.9.0" }
3738
libsql_replication = { path = "libsql-replication", version = "0.9.0" }

libsql-ffi/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[package]
22
name = "libsql-ffi"
3-
version = "0.5.0"
4-
edition = "2021"
5-
build = "build.rs"
6-
license = "MIT"
3+
version.workspace = true
4+
authors.workspace = true
5+
edition.workspace = true
6+
license.workspace = true
7+
repository.workspace = true
78
description = "Native bindings to libSQL"
8-
repository = "https://github.com/tursodatabase/libsql"
9+
build = "build.rs"
910
exclude = ["bundled/SQLite3MultipleCiphers/build", "bundled/SQLite3MultipleCiphers/test"]
1011

1112
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

libsql-ffi/bundled/src/sqlite3.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65364,18 +65364,25 @@ SQLITE_PRIVATE int sqlite3PagerWalInsert(Pager *pPager, unsigned int iFrame, voi
6536465364
}
6536565365
if (iFrame <= mxFrame) {
6536665366
unsigned long frame_len = nBuf-24;
65367-
unsigned char current[frame_len];
65367+
unsigned char *current;
65368+
65369+
current = (unsigned char *)sqlite3MallocZero(frame_len);
65370+
if (current == NULL) {
65371+
return SQLITE_NOMEM;
65372+
}
6536865373
rc = pPager->wal->methods.xReadFrame(pPager->wal->pData, iFrame, frame_len, current);
6536965374
if (rc != SQLITE_OK) {
65375+
sqlite3_free(current);
6537065376
return rc;
6537165377
}
6537265378
int conflict = 0;
65373-
if (memcmp(pBuf+24, current, frame_len) != 0) {
65379+
if (memcmp((unsigned char*)pBuf+24, current, frame_len) != 0) {
6537465380
conflict = 1;
6537565381
}
6537665382
if (pConflict) {
6537765383
*pConflict = conflict;
6537865384
}
65385+
sqlite3_free(current);
6537965386
if (conflict) {
6538065387
return SQLITE_ERROR;
6538165388
}

libsql-sqlite3/src/pager.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7842,18 +7842,25 @@ int sqlite3PagerWalInsert(Pager *pPager, unsigned int iFrame, void *pBuf, unsign
78427842
}
78437843
if (iFrame <= mxFrame) {
78447844
unsigned long frame_len = nBuf-24;
7845-
unsigned char current[frame_len];
7845+
unsigned char *current;
7846+
7847+
current = (unsigned char *)sqlite3MallocZero(frame_len);
7848+
if (current == NULL) {
7849+
return SQLITE_NOMEM;
7850+
}
78467851
rc = pPager->wal->methods.xReadFrame(pPager->wal->pData, iFrame, frame_len, current);
78477852
if (rc != SQLITE_OK) {
7853+
sqlite3_free(current);
78487854
return rc;
78497855
}
78507856
int conflict = 0;
7851-
if (memcmp(pBuf+24, current, frame_len) != 0) {
7857+
if (memcmp((unsigned char*)pBuf+24, current, frame_len) != 0) {
78527858
conflict = 1;
78537859
}
78547860
if (pConflict) {
78557861
*pConflict = conflict;
78567862
}
7863+
sqlite3_free(current);
78577864
if (conflict) {
78587865
return SQLITE_ERROR;
78597866
}

libsql-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ categories = ["external-ffi-bindings"]
1111

1212
[dependencies]
1313
bytes = "1.5.0"
14-
libsql-ffi = { version = "0.5", path = "../libsql-ffi/" }
14+
libsql-ffi = { workspace = true }
1515
once_cell = "1.18.0"
1616
rusqlite = { workspace = true, features = ["trace"], optional = true }
1717
tracing = "0.1.37"

vendored/rusqlite/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fallible-iterator = "0.2"
109109
fallible-streaming-iterator = "0.1"
110110
uuid = { version = "1.0", optional = true }
111111
smallvec = "1.6.1"
112-
libsql-ffi = { version = "0.5", path = "../../libsql-ffi" }
112+
libsql-ffi = { workspace = true }
113113

114114
[dev-dependencies]
115115
doc-comment = "0.3"

0 commit comments

Comments
 (0)