mirror of
https://github.com/fluencelabs/sqlite
synced 2025-04-24 17:02:14 +00:00
final preparation
This commit is contained in:
parent
2150b81cf6
commit
932bfb38a1
@ -1,4 +1,4 @@
|
||||
(@interface it_version "0.19.0"
|
||||
(@interface it_version "0.19.0")
|
||||
|
||||
;; Types
|
||||
(@interface type (func
|
||||
|
@ -35,7 +35,7 @@ void sqlite3_exec_(
|
||||
sqlite3_callback xCallback, /* Invoke this callback routine */
|
||||
void *pArg /* First argument to xCallback() */
|
||||
) __EXPORT_NAME(sqlite3_exec) {
|
||||
zSql[zSql_len] = '\x00';
|
||||
zSql = handle_input_string(zSql, zSql_len);
|
||||
|
||||
char *pzErrMsg = 0;
|
||||
const int ret_code = sqlite3_exec(db, zSql, xCallback, pArg, &pzErrMsg);
|
||||
|
@ -3443,9 +3443,8 @@ void sqlite3_open_v2_(
|
||||
char *zVfs, /* Name of VFS module to use */
|
||||
int zVfs_len
|
||||
) __EXPORT_NAME(sqlite3_open_v2) {
|
||||
// this strings were allocated by the allocate function that allocates 1 byte more for null character
|
||||
filename[filename_len] = '\x00';
|
||||
zVfs[zVfs_len] = '\x00';
|
||||
filename = handle_input_string(filename, filename_len);
|
||||
zVfs = handle_input_string(zVfs, zVfs_len);
|
||||
|
||||
sqlite3 *ppDb;
|
||||
|
||||
|
@ -4913,6 +4913,8 @@ void add_object_to_release(void *object);
|
||||
|
||||
void set_result_ptr(void *ptr);
|
||||
void set_result_size(int size);
|
||||
|
||||
char *handle_input_string(char *str, int len);
|
||||
#endif
|
||||
|
||||
#endif /* SQLITEINT_H */
|
||||
|
@ -43,6 +43,17 @@ void *get_result_ptr() {
|
||||
return RESULT_PTR;
|
||||
}
|
||||
|
||||
char *handle_input_string(char *str, int len) {
|
||||
if (len == 0) {
|
||||
free(str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// this strings are supposed to be allocated by the allocate function, which allocates 1 byte more for null character
|
||||
str[len] = '\x00';
|
||||
return str;
|
||||
}
|
||||
|
||||
int main() {
|
||||
// the main purpose of this empty main is to initialize WASI subsystem
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user