]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Rename wasm.cstringToJs() to wasm.cstrToJs() for consistency with other wasm.cstr...
authorstephan <stephan@noemail.net>
Tue, 6 Dec 2022 08:46:39 +0000 (08:46 +0000)
committerstephan <stephan@noemail.net>
Tue, 6 Dec 2022 08:46:39 +0000 (08:46 +0000)
FossilOrigin-Name: cbf483ea0ba3e6dc08ad7ed654380f818544b4c3cedfdb8aa848a83298268ceb

ext/wasm/api/sqlite3-api-glue.js
ext/wasm/api/sqlite3-api-oo1.js
ext/wasm/api/sqlite3-api-prologue.js
ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
ext/wasm/common/whwasmutil.js
ext/wasm/tester1.c-pp.js
manifest
manifest.uuid

index 89c8044be11c102987fe14cfc81172e4e8e7cbe0..14c0d58a42885b0dcec8060f3b60ee42b6c83acf 100644 (file)
@@ -193,8 +193,8 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
         try {
           let aVals = [], aNames = [], i = 0, offset = 0;
           for( ; i < nCols; offset += (wasm.ptrSizeof * ++i) ){
-            aVals.push( wasm.cstringToJs(wasm.getPtrValue(pColVals + offset)) );
-            aNames.push( wasm.cstringToJs(wasm.getPtrValue(pColNames + offset)) );
+            aVals.push( wasm.cstrToJs(wasm.getPtrValue(pColVals + offset)) );
+            aNames.push( wasm.cstrToJs(wasm.getPtrValue(pColNames + offset)) );
           }
           rc = callback(pVoid, nCols, aVals, aNames) | 0;
           /* The first 2 args of the callback are useless for JS but
@@ -610,7 +610,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
       toss("Maintenance required: increase sqlite3_wasm_enum_json()'s",
            "static buffer size!");
     }
-    wasm.ctype = JSON.parse(wasm.cstringToJs(cJson));
+    wasm.ctype = JSON.parse(wasm.cstrToJs(cJson));
     //console.debug('wasm.ctype length =',wasm.cstrlen(cJson));
     const defineGroups = ['access', 'authorizer',
                           'blobFinalizers', 'dataTypes',
@@ -702,7 +702,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
           try {
             const zXKey = kvvfsMakeKey(zClass,zKey);
             if(!zXKey) return -3/*OOM*/;
-            const jKey = wasm.cstringToJs(zXKey);
+            const jKey = wasm.cstrToJs(zXKey);
             const jV = kvvfsStorage(zClass).getItem(jKey);
             if(!jV) return -1;
             const nV = jV.length /* Note that we are relying 100% on v being
@@ -731,8 +731,8 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
           try {
             const zXKey = kvvfsMakeKey(zClass,zKey);
             if(!zXKey) return 1/*OOM*/;
-            const jKey = wasm.cstringToJs(zXKey);
-            kvvfsStorage(zClass).setItem(jKey, wasm.cstringToJs(zData));
+            const jKey = wasm.cstrToJs(zXKey);
+            kvvfsStorage(zClass).setItem(jKey, wasm.cstrToJs(zData));
             return 0;
           }catch(e){
             console.error("kvstorageWrite()",e);
@@ -746,7 +746,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
           try {
             const zXKey = kvvfsMakeKey(zClass,zKey);
             if(!zXKey) return 1/*OOM*/;
-            kvvfsStorage(zClass).removeItem(wasm.cstringToJs(zXKey));
+            kvvfsStorage(zClass).removeItem(wasm.cstrToJs(zXKey));
             return 0;
           }catch(e){
             console.error("kvstorageDelete()",e);
index 6253c659fc25bd7740b6005fd677f721f6664ef8..4ec61af07c60f32fe666efd7548c2b02d6d69af0 100644 (file)
@@ -73,7 +73,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
           if(capi.SQLITE_TRACE_STMT===t){
             // x == SQL, p == sqlite3_stmt*
             console.log("SQL TRACE #"+(++this.counter),
-                        wasm.cstringToJs(x));
+                        wasm.cstrToJs(x));
           }
         }.bind({counter: 0}));
 
@@ -139,7 +139,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
       console.error("Invalid DB ctor args",opt,arguments);
       toss3("Invalid arguments for DB constructor.");
     }
-    let fnJs = ('number'===typeof fn) ? wasm.cstringToJs(fn) : fn;
+    let fnJs = ('number'===typeof fn) ? wasm.cstrToJs(fn) : fn;
     const vfsCheck = ctor._name2vfs[fnJs];
     if(vfsCheck){
       vfsName = vfsCheck.vfs;
@@ -600,7 +600,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
       );
       if(pVfs){
         const v = new capi.sqlite3_vfs(pVfs);
-        try{ rc = wasm.cstringToJs(v.$zName) }
+        try{ rc = wasm.cstrToJs(v.$zName) }
         finally { v.dispose() }
       }
       return rc;        
index 558fcda1e0801facf4b1378cbeec558a63414c86..bccae8b19919ae8e29ac67b27887157c1a3768c1 100644 (file)
@@ -348,13 +348,13 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
   /**
      If v is-a Array, its join("") result is returned.  If
      isSQLableTypedArray(v) is true then typedArrayToString(v) is
-     returned. If it looks like a WASM pointer, wasm.cstringToJs(v) is
+     returned. If it looks like a WASM pointer, wasm.cstrToJs(v) is
      returned. Else v is returned as-is.
   */
   const flexibleString = function(v){
     if(isSQLableTypedArray(v)) return typedArrayToString(v);
     else if(Array.isArray(v)) return v.join("");
-    else if(wasm.isPtr(v)) v = wasm.cstringToJs(v);
+    else if(wasm.isPtr(v)) v = wasm.cstrToJs(v);
     return v;
   };
 
@@ -1339,7 +1339,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
     let pVfs = capi.sqlite3_vfs_find(0);
     while(pVfs){
       const oVfs = new capi.sqlite3_vfs(pVfs);
-      rc.push(wasm.cstringToJs(oVfs.$zName));
+      rc.push(wasm.cstrToJs(oVfs.$zName));
       pVfs = oVfs.$pNext;
       oVfs.dispose();
     }
index f5a1eb6cc25b9201044e02268a7085c5a1e3f102..99d79641f4d7ad0fc2b1b8eaa0c89b3fadbe36ec 100644 (file)
@@ -803,7 +803,7 @@ const installOpfsVfs = function callee(options){
     const vfsSyncWrappers = {
       xAccess: function(pVfs,zName,flags,pOut){
         mTimeStart('xAccess');
-        const rc = opRun('xAccess', wasm.cstringToJs(zName));
+        const rc = opRun('xAccess', wasm.cstrToJs(zName));
         wasm.setMemValue( pOut, (rc ? 0 : 1), 'i32' );
         mTimeEnd();
         return 0;
@@ -823,7 +823,7 @@ const installOpfsVfs = function callee(options){
       },
       xDelete: function(pVfs, zName, doSyncDir){
         mTimeStart('xDelete');
-        opRun('xDelete', wasm.cstringToJs(zName), doSyncDir, false);
+        opRun('xDelete', wasm.cstrToJs(zName), doSyncDir, false);
         /* We're ignoring errors because we cannot yet differentiate
            between harmless and non-harmless failures. */
         mTimeEnd();
@@ -855,7 +855,7 @@ const installOpfsVfs = function callee(options){
                C-string here. */
             opfsFlags |= state.opfsFlags.OPFS_UNLOCK_ASAP;
           }
-          zName = wasm.cstringToJs(zName);
+          zName = wasm.cstrToJs(zName);
         }
         const fh = Object.create(null);
         fh.fid = pFile;
@@ -1231,7 +1231,7 @@ const installOpfsVfs = function callee(options){
         const readBuf = wasm.scopedAlloc(16);
         rc = ioSyncWrappers.xRead(sq3File.pointer, readBuf, 6, 2);
         wasm.setMemValue(readBuf+6,0);
-        let jRead = wasm.cstringToJs(readBuf);
+        let jRead = wasm.cstrToJs(readBuf);
         log("xRead() got:",jRead);
         if("sanity"!==jRead) toss("Unexpected xRead() value.");
         if(vfsSyncWrappers.xSleep){
index 571486912fc099be96a6bba81f51dfe233601c2b..0da1841b6e1490edf95f76016d4643bc0d3bd7d6 100644 (file)
@@ -756,7 +756,7 @@ self.WhWasmUtilInstaller = function(target){
      JS-format string representing its contents. As a special case, if
      ptr is falsy or not a pointer, `null` is returned.
   */
-  target.cstringToJs = function(ptr){
+  target.cstrToJs = function(ptr){
     const n = target.cstrlen(ptr);
     return n ? __utf8Decode(heapWrappers().HEAP8U, ptr, ptr+n) : (null===n ? n : "");
   };
@@ -1147,7 +1147,7 @@ self.WhWasmUtilInstaller = function(target){
     const list = [];
     for(let i = 0; i < argc; ++i){
       const arg = target.getPtrValue(pArgv + (target.ptrSizeof * i));
-      list.push( arg ? target.cstringToJs(arg) : null );
+      list.push( arg ? target.cstrToJs(arg) : null );
     }
     return list;
   };
@@ -1315,14 +1315,14 @@ self.WhWasmUtilInstaller = function(target){
       if('string'===typeof v) return target.scopedAllocCString(v);
       return v ? xcv.arg[ptrIR](v) : null;
     };
-  xcv.result.string = xcv.result.utf8 = (i)=>target.cstringToJs(i);
+  xcv.result.string = xcv.result.utf8 = (i)=>target.cstrToJs(i);
   xcv.result['string:dealloc'] = xcv.result['utf8:dealloc'] = (i)=>{
-    try { return i ? target.cstringToJs(i) : null }
+    try { return i ? target.cstrToJs(i) : null }
     finally{ target.dealloc(i) }
   };
-  xcv.result.json = (i)=>JSON.parse(target.cstringToJs(i));
+  xcv.result.json = (i)=>JSON.parse(target.cstrToJs(i));
   xcv.result['json:dealloc'] = (i)=>{
-    try{ return i ? JSON.parse(target.cstringToJs(i)) : null }
+    try{ return i ? JSON.parse(target.cstrToJs(i)) : null }
     finally{ target.dealloc(i) }
   }
   xcv.result['void'] = (v)=>undefined;
@@ -1460,7 +1460,7 @@ self.WhWasmUtilInstaller = function(target){
 
 ```js
    target.xWrap.resultAdapter('string:my_free',(i)=>{
-      try { return i ? target.cstringToJs(i) : null }
+      try { return i ? target.cstrToJs(i) : null }
       finally{ target.exports.my_free(i) }
    };
 ```
index 8ba88db18fb6ba22ba0ebd65c3ad663730d59a94..c32c4e5e8448e4ab62ea1ae4cf585265072a3243 100644 (file)
@@ -547,13 +547,13 @@ self.sqlite3InitModule = sqlite3InitModule;
           let cpy = w.scopedAlloc(n+10);
           let rc = w.cstrncpy(cpy, cStr, n+10);
           T.assert(n+1 === rc).
-            assert("hello" === w.cstringToJs(cpy)).
+            assert("hello" === w.cstrToJs(cpy)).
             assert(chr('o') === w.getMemValue(cpy+n-1)).
             assert(0 === w.getMemValue(cpy+n));
           let cStr2 = w.scopedAllocCString("HI!!!");
           rc = w.cstrncpy(cpy, cStr2, 3);
           T.assert(3===rc).
-            assert("HI!lo" === w.cstringToJs(cpy)).
+            assert("HI!lo" === w.cstrToJs(cpy)).
             assert(chr('!') === w.getMemValue(cpy+2)).
             assert(chr('l') === w.getMemValue(cpy+3));
         }finally{
@@ -675,7 +675,7 @@ self.sqlite3InitModule = sqlite3InitModule;
         // 'string:flexible' argAdapter() sanity checks...
         w.scopedAllocCall(()=>{
           const argAd = w.xWrap.argAdapter('string:flexible');
-          const cj = (v)=>w.cstringToJs(argAd(v));
+          const cj = (v)=>w.cstrToJs(argAd(v));
           T.assert('Hi' === cj('Hi'))
             .assert('hi' === cj(['h','i']))
             .assert('HI' === cj(new Uint8Array([72, 73])));
index d416956d91975e8543296b9dbef5e4d82e107b66..cd9692c3930de3693aa2aee29ba5bafa94bab91f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\swasm.cArgvToJs()\sto\ssupport\ssqlite3_module::xConnect().
-D 2022-12-06T08:39:17.647
+C Rename\swasm.cstringToJs()\sto\swasm.cstrToJs()\sfor\sconsistency\swith\sother\swasm.cstr...\sAPIs.
+D 2022-12-06T08:46:39.353
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -503,14 +503,14 @@ F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08
 F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
 F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f
 F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
-F ext/wasm/api/sqlite3-api-glue.js 057c9ed555ee68ee795dc61e8d923862a0ddeb3d4cbad89866515cf5a1b77343
-F ext/wasm/api/sqlite3-api-oo1.js b970787aaf0bdd3a3df59cf66aeb84d0decaaa0529aed7eaf45121087181245f
-F ext/wasm/api/sqlite3-api-prologue.js 31cffd8ce212fad8d316a08decd864b0f614c5fce3686153707dffe40f8279e8
+F ext/wasm/api/sqlite3-api-glue.js 8fa55af37c9880f94a803f32591dc0304750cc2f750048daf41fe942757bee64
+F ext/wasm/api/sqlite3-api-oo1.js 416e6398721a4cbb80ddfa3d7b303216790f1d344efdbbc36239d39abc66aa27
+F ext/wasm/api/sqlite3-api-prologue.js a7596c30392d9ca8f5b7c14feb4e6788107d1159fd5f90eb26708d653d36c9bc
 F ext/wasm/api/sqlite3-api-worker1.js e94ba98e44afccfa482874cd9acb325883ade50ed1f9f9526beb9de1711f182f
 F ext/wasm/api/sqlite3-license-version-header.js a661182fc93fc2cf212dfd0b987f8e138a3ac98f850b1112e29b5fbdaecc87c3
 F ext/wasm/api/sqlite3-opfs-async-proxy.js f79dd8d98ef3e0b55c10bb2bee7a3840fa967318e1f577c156aafc34664271d1
 F ext/wasm/api/sqlite3-v-helper.js 4451763a0cd85734f0afe18b48918cb3c88ca99cef399b7c5f12119281e7b6a8
-F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 29d6487a26b2fb6a471cde52c37ffee7c27ed6a91914b308c247e0706f454ffb
+F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js e9656232ae4f5ef2d2fdd1711e89d40ba81c8f0faed0aadb22004341da5c8184
 F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
 F ext/wasm/api/sqlite3-wasm.c 723522a6c2a2463884a83fa1cc7ae5770deaaf0856a1058cc1023b2bfa1c898b
 F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
@@ -521,7 +521,7 @@ F ext/wasm/c-pp.c 92285f7bce67ed7b7020b40fde8ed0982c442b63dc33df9dfd4b658d4a6c07
 F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
 F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
 F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f
-F ext/wasm/common/whwasmutil.js 8be1a3a3ebca51ab5d02fc89f6d45f974b99f0d99262227094e8af4b7ade3234
+F ext/wasm/common/whwasmutil.js f0a742270b490748b9fdb0974287429b036698609b40eee81f13fe13e64358a7
 F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
 F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
 F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
@@ -555,7 +555,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
 F ext/wasm/test-opfs-vfs.js 44363db07b2a20e73b0eb1808de4400ca71b703af718d0fa6d962f15e73bf2ac
 F ext/wasm/tester1-worker.html d43f3c131d88f10d00aff3e328fed13c858d674ea2ff1ff90225506137f85aa9
 F ext/wasm/tester1.c-pp.html d34bef3d48e5cbc1c7c06882ad240fec49bf88f5f65696cc2c72c416933aa406
-F ext/wasm/tester1.c-pp.js 51d396bc0a4e6abc700def5529ce290ea84ba2018741fc7e701c5162b0f1e5fb
+F ext/wasm/tester1.c-pp.js 81c40395be4a7e97a3ca0ff62a4e02204239b1db6f24fe15b3c96a17fb41f29b
 F ext/wasm/tests/opfs/concurrency/index.html 86d8ac435074d1e7007b91105f4897f368c165e8cecb6a9aa3d81f5cf5dcbe70
 F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 21331bdd36a91b07a687ffadce392dcf2ccd0fd824b35d9dd027d4289a40fc96
-R f99279163c9ea24b92a1c120dee81c3c
+P c3ebdccf94d5e63c229bf91056c08052d78732e663334070ef3b0ef6fb4bfb8f
+R 89bdf08b4a75fdd12936e8e156f340f6
 U stephan
-Z 5af57eae4e4ffe17648ac57b69cb7a17
+Z 095ae4e504a3bccb462600500450b6bf
 # Remove this line to create a well-formed Fossil manifest.
index 9e31dbe0cc675463e0116ca3b4dd9c446f2dce8f..143d7cba7b56d28367662aac527ff638ad5ba1ff 100644 (file)
@@ -1 +1 @@
-c3ebdccf94d5e63c229bf91056c08052d78732e663334070ef3b0ef6fb4bfb8f
\ No newline at end of file
+cbf483ea0ba3e6dc08ad7ed654380f818544b4c3cedfdb8aa848a83298268ceb
\ No newline at end of file