]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
JNI: when fetching text-or-blob/length pairs, fetch the text-or-blob first, then...
authorstephan <stephan@noemail.net>
Mon, 2 Oct 2023 17:12:16 +0000 (17:12 +0000)
committerstephan <stephan@noemail.net>
Mon, 2 Oct 2023 17:12:16 +0000 (17:12 +0000)
FossilOrigin-Name: e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1

ext/jni/src/c/sqlite3-jni.c
manifest
manifest.uuid

index 9381bb0005428070af391f725fdbba28549f80f6..b7297f609f60e6cdd3771846676f01570e30dcba 100644 (file)
@@ -2770,8 +2770,8 @@ S3JniApi(sqlite3_column_text(),jbyteArray,1column_1text)(
   JniArgsEnvClass, jobject jpStmt, jint ndx
 ){
   sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt);
-  const int n = sqlite3_column_bytes(stmt, (int)ndx);
   const unsigned char * const p = sqlite3_column_text(stmt, (int)ndx);
+  const int n = sqlite3_column_bytes(stmt, (int)ndx);
   return p ? s3jni_new_jbyteArray(p, n) : NULL;
 }
 
@@ -2781,8 +2781,8 @@ S3JniApi(sqlite3_column_text(),jstring,1column_1text)(
   JniArgsEnvClass, jobject jpStmt, jint ndx
 ){
   sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt);
-  const int n = sqlite3_column_bytes(stmt, (int)ndx);
   const unsigned char * const p = sqlite3_column_text(stmt, (int)ndx);
+  const int n = sqlite3_column_bytes(stmt, (int)ndx);
   return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0;
 }
 #endif
@@ -2791,8 +2791,8 @@ S3JniApi(sqlite3_column_text16(),jstring,1column_1text16)(
   JniArgsEnvClass, jobject jpStmt, jint ndx
 ){
   sqlite3_stmt * const stmt = PtrGet_sqlite3_stmt(jpStmt);
-  const int n = sqlite3_column_bytes16(stmt, (int)ndx);
   const void * const p = sqlite3_column_text16(stmt, (int)ndx);
+  const int n = sqlite3_column_bytes16(stmt, (int)ndx);
   return s3jni_text16_to_jstring(env, p, n);
 }
 
@@ -4685,8 +4685,8 @@ S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)(
   JniArgsEnvClass, jlong jpSVal
 ){
   sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
-  int const nLen = sqlite3_value_bytes(sv);
   const jbyte * pBytes = sqlite3_value_blob(sv);
+  int const nLen = sqlite3_value_bytes(sv);
 
   s3jni_oom_check( nLen ? !!pBytes : 1 );
   return pBytes
@@ -4738,8 +4738,8 @@ S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)(
   JniArgsEnvClass, jlong jpSVal
 ){
   sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
-  int const n = sqlite3_value_bytes(sv);
   const unsigned char * const p = sqlite3_value_text(sv);
+  int const n = sqlite3_value_bytes(sv);
   return p ? s3jni_new_jbyteArray(p, n) : 0;
 }
 
@@ -4749,8 +4749,8 @@ S3JniApi(sqlite3_value_text(),jstring,1value_1text)(
   JniArgsEnvClass, jlong jpSVal
 ){
   sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
-  int const n = sqlite3_value_bytes(sv);
   const unsigned char * const p = sqlite3_value_text(sv);
+  int const n = sqlite3_value_bytes(sv);
   return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0;
 }
 #endif
index ec1bdf15fed36345b0bbf8c00c319a87601cdb91..678a86c22fedd0bed9b89883f3b01adff50c3bfa 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\slength\sof\sthe\sstring\sin\sthe\snew\sconcat()\sand\sconcat_ws()\sfunctions.
-D 2023-10-02T17:06:28.465
+C JNI:\swhen\sfetching\stext-or-blob/length\spairs,\sfetch\sthe\stext-or-blob\sfirst,\sthen\sthe\slength,\sas\sthe\sAPI\sdocs\ssuggest.
+D 2023-10-02T17:12:16.304
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -238,7 +238,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3
 F ext/jni/GNUmakefile 7278812b41ced95fe67a9e5823aee027d641fd26fdfabe66c62b102a3a4e0631
 F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75
 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
-F ext/jni/src/c/sqlite3-jni.c 8710e78156b35f5e79d96c0d317bb203317c9976af99fd124d0b2ce4ad7093e0
+F ext/jni/src/c/sqlite3-jni.c 2c4948634fd7f6460b074b72328b9c885ec11333bbc98144f745e4d6203a7ac2
 F ext/jni/src/c/sqlite3-jni.h 74e3da791f748f02d0d684562126cf6bfdd2a85cbb6a5d1354b14fcd46e187bc
 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436
 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4
@@ -2122,8 +2122,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 3a1feb1c469d3dd50e2558581199b16bfd59b9d5bcb0de5f1a8f0ec30a17b4d1
-R 1612d597de54e1c9956c6bcdc588fe33
-U drh
-Z 2af91933ac5e23ad24b4f2c2921203ef
+P 325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f
+R 46fa2dcc5034c47ceb71e3721ad57fae
+U stephan
+Z c507ea20def3bb46f7fb137790b2fa35
 # Remove this line to create a well-formed Fossil manifest.
index a066e7c939ebaf82292737cc78b55d4d8bb15f2a..308d4d77e2ecbd60b56016addd06c501777130b9 100644 (file)
@@ -1 +1 @@
-325243226520376f4a142864ae3fb98866f25bff4dc50a6b648ef98428a7169f
\ No newline at end of file
+e4f9d3946fa570bccea2de17c5536901bdabd46cfe25678fdd37ba0e2bfd99b1
\ No newline at end of file