quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit 87fa35c53cbf14e86f856bfe2bf64c2686743786
parent 7322a28ec06abbc510097b8f08e065128ada9924
Author: Marc Stibane <marc@taler.net>
Date:   Tue, 22 Aug 2023 14:42:17 +0200

Definitions for Apple, Warnings fixed

Diffstat:
MQuickJS-rt.xcodeproj/project.pbxproj | 168++++++-------------------------------------------------------------------------
Mtart_module.c | 12++++++++----
2 files changed, 20 insertions(+), 160 deletions(-)

diff --git a/QuickJS-rt.xcodeproj/project.pbxproj b/QuickJS-rt.xcodeproj/project.pbxproj @@ -246,7 +246,6 @@ 4E328F19296CDF82006D0E3C /* libunicode.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E328EB9296CCBA5006D0E3C /* libunicode.c */; }; 4E328F2A296CE0FF006D0E3C /* quickjs-libc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E328ED5296CCCB3006D0E3C /* quickjs-libc.c */; }; 4E328F33296CE145006D0E3C /* quickjs.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E328EE3296CCF17006D0E3C /* quickjs.c */; }; - 4E328F3C296CE23C006D0E3C /* tart_module.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E328E84296CC12C006D0E3C /* tart_module.c */; }; 4E328F45296CE6C6006D0E3C /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C3125296C8B110031A049 /* debug.c */; }; 4E328F46296CE6C6006D0E3C /* mps_reader.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C312B296C8BB80031A049 /* mps_reader.c */; }; 4E328F47296CE6C6006D0E3C /* mps_trace.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C3129296C8BB80031A049 /* mps_trace.c */; }; @@ -788,41 +787,6 @@ remoteGlobalIDString = 4E328F5A296CE71A006D0E3C; remoteInfo = "mbedx509-mac"; }; - 4E3290BD296CECEA006D0E3C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4E5C3060296C77AF0031A049 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4E328F6A296CE801006D0E3C; - remoteInfo = "mbedcrypto-mac"; - }; - 4E3290BF296CECEA006D0E3C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4E5C3060296C77AF0031A049 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4E328F40296CE57D006D0E3C; - remoteInfo = "mbedtls-mac"; - }; - 4E3290C1296CECEA006D0E3C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4E5C3060296C77AF0031A049 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4E328F5A296CE71A006D0E3C; - remoteInfo = "mbedx509-mac"; - }; - 4E3290C3296CECFA006D0E3C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4E5C3060296C77AF0031A049 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4E328FD0296CE95C006D0E3C; - remoteInfo = "curl-mac"; - }; - 4E3290C5296CECFA006D0E3C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 4E5C3060296C77AF0031A049 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4E329074296CEAD2006D0E3C; - remoteInfo = "sodium-mac"; - }; 4E3290C7296CEDB9006D0E3C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4E5C3060296C77AF0031A049 /* Project object */; @@ -1413,7 +1377,6 @@ 4E328F1E296CE004006D0E3C /* libcutils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcutils.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4E328F26296CE077006D0E3C /* libquickjs-libc.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libquickjs-libc.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 4E328F2F296CE12C006D0E3C /* libquickjs.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libquickjs.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 4E328F38296CE230006D0E3C /* libtart.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtart.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4E328F41296CE57D006D0E3C /* libmbedtls.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmbedtls.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4E328F5B296CE71A006D0E3C /* libmbedx509.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmbedx509.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4E328F6B296CE801006D0E3C /* libmbedcrypto.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmbedcrypto.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1616,7 +1579,6 @@ 4E328F1E296CE004006D0E3C /* libcutils.a */, 4E328F26296CE077006D0E3C /* libquickjs-libc.a */, 4E328F2F296CE12C006D0E3C /* libquickjs.a */, - 4E328F38296CE230006D0E3C /* libtart.a */, 4E328F41296CE57D006D0E3C /* libmbedtls.a */, 4E328F5B296CE71A006D0E3C /* libmbedx509.a */, 4E328F6B296CE801006D0E3C /* libmbedcrypto.a */, @@ -2666,13 +2628,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 4E328F34296CE230006D0E3C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 4E328F3D296CE57D006D0E3C /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -3013,27 +2968,6 @@ productReference = 4E328F2F296CE12C006D0E3C /* libquickjs.a */; productType = "com.apple.product-type.library.static"; }; - 4E328F37296CE230006D0E3C /* tart-mac */ = { - isa = PBXNativeTarget; - buildConfigurationList = 4E328F39296CE230006D0E3C /* Build configuration list for PBXNativeTarget "tart-mac" */; - buildPhases = ( - 4E328F34296CE230006D0E3C /* Headers */, - 4E328F35296CE230006D0E3C /* Sources */, - ); - buildRules = ( - ); - dependencies = ( - 4E3290BE296CECEA006D0E3C /* PBXTargetDependency */, - 4E3290C0296CECEA006D0E3C /* PBXTargetDependency */, - 4E3290C2296CECEA006D0E3C /* PBXTargetDependency */, - 4E3290C4296CECFA006D0E3C /* PBXTargetDependency */, - 4E3290C6296CECFA006D0E3C /* PBXTargetDependency */, - ); - name = "tart-mac"; - productName = "tart-mac"; - productReference = 4E328F38296CE230006D0E3C /* libtart.a */; - productType = "com.apple.product-type.library.static"; - }; 4E328F40296CE57D006D0E3C /* mbedtls-mac */ = { isa = PBXNativeTarget; buildConfigurationList = 4E328F44296CE57D006D0E3C /* Build configuration list for PBXNativeTarget "mbedtls-mac" */; @@ -3296,9 +3230,6 @@ 4E328F2E296CE12C006D0E3C = { CreatedOnToolsVersion = 14.2; }; - 4E328F37296CE230006D0E3C = { - CreatedOnToolsVersion = 14.2; - }; 4E328F40296CE57D006D0E3C = { CreatedOnToolsVersion = 14.2; }; @@ -3347,31 +3278,30 @@ projectDirPath = ""; projectRoot = ""; targets = ( + 4E328F00296CD174006D0E3C /* bf-mac */, + 4E328FD0296CE95C006D0E3C /* curl-mac */, + 4E328F1D296CE004006D0E3C /* cutils-mac */, 4E328F6A296CE801006D0E3C /* mbedcrypto-mac */, 4E328F40296CE57D006D0E3C /* mbedtls-mac */, 4E328F5A296CE71A006D0E3C /* mbedx509-mac */, - 4E328FD0296CE95C006D0E3C /* curl-mac */, - 4E329074296CEAD2006D0E3C /* sodium-mac */, - 4E328F37296CE230006D0E3C /* tart-mac */, - 4E328F00296CD174006D0E3C /* bf-mac */, - 4E328F09296CD6B6006D0E3C /* regexp-mac */, - 4E328F14296CDF66006D0E3C /* unicode-mac */, - 4E328F1D296CE004006D0E3C /* cutils-mac */, 4E328F25296CE077006D0E3C /* quickjs-libc-mac */, 4E328F2E296CE12C006D0E3C /* quickjs-mac */, + 4E328F09296CD6B6006D0E3C /* regexp-mac */, + 4E329074296CEAD2006D0E3C /* sodium-mac */, + 4E328F14296CDF66006D0E3C /* unicode-mac */, 4E328EE8296CD029006D0E3C /* qjsc */, + 4E328E94296CC59E006D0E3C /* bf */, + 4E328C6B296C9A27006D0E3C /* curl */, + 4E328EBF296CCBFE006D0E3C /* cutils */, 4E5C3075296C7A5C0031A049 /* mbedcrypto */, 4E5C311A296C899D0031A049 /* mbedtls */, 4E328C50296C980F006D0E3C /* mbedx509 */, - 4E328C6B296C9A27006D0E3C /* curl */, + 4E328ECD296CCC9E006D0E3C /* quickjs-libc */, + 4E328EDB296CCF05006D0E3C /* quickjs */, + 4E328EA3296CC6F0006D0E3C /* regexp */, 4E328DAC296CA3D0006D0E3C /* sodium */, 4E328E7C296CC0BC006D0E3C /* tart */, - 4E328E94296CC59E006D0E3C /* bf */, - 4E328EA3296CC6F0006D0E3C /* regexp */, 4E328EB1296CCB85006D0E3C /* unicode */, - 4E328EBF296CCBFE006D0E3C /* cutils */, - 4E328ECD296CCC9E006D0E3C /* quickjs-libc */, - 4E328EDB296CCF05006D0E3C /* quickjs */, 4EE211FA296DB6D1000D7228 /* prelude */, 4EE21222296DBC7C000D7228 /* wallet_core */, 4EE21232296DBEE1000D7228 /* talerwalletcore */, @@ -3809,14 +3739,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 4E328F35296CE230006D0E3C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4E328F3C296CE23C006D0E3C /* tart_module.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 4E328F3E296CE57D006D0E3C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -4369,31 +4291,6 @@ target = 4E328F5A296CE71A006D0E3C /* mbedx509-mac */; targetProxy = 4E32906F296CEA0D006D0E3C /* PBXContainerItemProxy */; }; - 4E3290BE296CECEA006D0E3C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4E328F6A296CE801006D0E3C /* mbedcrypto-mac */; - targetProxy = 4E3290BD296CECEA006D0E3C /* PBXContainerItemProxy */; - }; - 4E3290C0296CECEA006D0E3C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4E328F40296CE57D006D0E3C /* mbedtls-mac */; - targetProxy = 4E3290BF296CECEA006D0E3C /* PBXContainerItemProxy */; - }; - 4E3290C2296CECEA006D0E3C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4E328F5A296CE71A006D0E3C /* mbedx509-mac */; - targetProxy = 4E3290C1296CECEA006D0E3C /* PBXContainerItemProxy */; - }; - 4E3290C4296CECFA006D0E3C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4E328FD0296CE95C006D0E3C /* curl-mac */; - targetProxy = 4E3290C3296CECFA006D0E3C /* PBXContainerItemProxy */; - }; - 4E3290C6296CECFA006D0E3C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4E329074296CEAD2006D0E3C /* sodium-mac */; - targetProxy = 4E3290C5296CECFA006D0E3C /* PBXContainerItemProxy */; - }; 4E3290C8296CEDB9006D0E3C /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 4E328F00296CD174006D0E3C /* bf-mac */; @@ -4988,38 +4885,6 @@ }; name = Release; }; - 4E328F3A296CE230006D0E3C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - HEADER_SEARCH_PATHS = ( - "\"subprojects/mbedtls/include\"", - "\"subprojects/curl/include\"", - "\"subprojects/libsodium/src/libsodium/include\"", - "\"subprojects/libsodium/src/libsodium/include/sodium\"", - "\"subprojects/libsodium/builds/xcode\"", - ); - PRODUCT_NAME = tart; - SDKROOT = macosx; - }; - name = Debug; - }; - 4E328F3B296CE230006D0E3C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - HEADER_SEARCH_PATHS = ( - "\"subprojects/mbedtls/include\"", - "\"subprojects/curl/include\"", - "\"subprojects/libsodium/src/libsodium/include\"", - "\"subprojects/libsodium/src/libsodium/include/sodium\"", - "\"subprojects/libsodium/builds/xcode\"", - ); - PRODUCT_NAME = tart; - SDKROOT = macosx; - }; - name = Release; - }; 4E328F42296CE57D006D0E3C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -5676,15 +5541,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4E328F39296CE230006D0E3C /* Build configuration list for PBXNativeTarget "tart-mac" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4E328F3A296CE230006D0E3C /* Debug */, - 4E328F3B296CE230006D0E3C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 4E328F44296CE57D006D0E3C /* Build configuration list for PBXNativeTarget "mbedtls-mac" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/tart_module.c b/tart_module.c @@ -29,7 +29,11 @@ #include <arpa/inet.h> +#if defined(__APPLE__) +#include <sqlite3.h> +#else #include "sqlite3/sqlite3.h" +#endif static JSValue js_encode_utf8(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) @@ -824,7 +828,7 @@ kdf_mod_mpi(mbedtls_mpi *r, const char *ctx) { int rc; - unsigned int nbits; + size_t nbits; uint16_t ctr; size_t ctxlen = strlen(ctx); size_t my_ctx_len = ctxlen + 2; @@ -1653,7 +1657,7 @@ static JSValue js_sqlite3_prepare(JSContext *ctx, JSValue this_val, goto done; } - ret = sqlite3_prepare_v3(sqlite3_db, stmt_cstr, strlen(stmt_cstr), 0, &stmt, &tail); + ret = sqlite3_prepare_v3(sqlite3_db, stmt_cstr, (int) strlen(stmt_cstr), 0, &stmt, &tail); if (SQLITE_OK != ret) { ret_val = JS_ThrowTypeError(ctx, "unable to prepare"); goto done; @@ -1790,7 +1794,7 @@ static int bind_from_object(JSContext *ctx, sqlite3_stmt *stmt, JSValueConst obj if (JS_IsString(val)) { const char *cstr; cstr = JS_ToCString(ctx, val); - sqlite3_bind_text(stmt, param_index, cstr, strlen(cstr), SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, param_index, cstr, (int) strlen(cstr), SQLITE_TRANSIENT); JS_FreeCString(ctx, cstr); goto next; } @@ -1807,7 +1811,7 @@ static int bind_from_object(JSContext *ctx, sqlite3_stmt *stmt, JSValueConst obj if (!data) { goto fail; } - sqlite3_bind_blob(stmt, param_index, data, size, SQLITE_TRANSIENT); + sqlite3_bind_blob(stmt, param_index, data, (int) size, SQLITE_TRANSIENT); goto next; } JS_ThrowTypeError(ctx, "unable to bind, unsupported type for arg %s", key);