From 923b760ed29716631c1b2d2e6ab94440fc80118c Mon Sep 17 00:00:00 2001 From: Hossein Yousefi Date: Wed, 21 Feb 2024 14:39:07 +0100 Subject: [PATCH] [jni] Fix analysis --- pkgs/jni/example/pubspec.lock | 88 +++++++++++++++++++++-------------- pkgs/jni/lib/src/jni.dart | 8 ++-- pkgs/jni/lib/src/jvalues.dart | 4 +- 3 files changed, 57 insertions(+), 43 deletions(-) diff --git a/pkgs/jni/example/pubspec.lock b/pkgs/jni/example/pubspec.lock index c8ee5ad97..a2026987e 100644 --- a/pkgs/jni/example/pubspec.lock +++ b/pkgs/jni/example/pubspec.lock @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: coverage - sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" + sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" url: "https://pub.dev" source: hosted - version: "1.6.4" + version: "1.7.2" crypto: dependency: transitive description: @@ -117,10 +117,10 @@ packages: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -209,6 +209,30 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: cdd14e3836065a1f6302a236ec8b5f700695c803c57ae11a1c84df31e6bcf831 + url: "https://pub.dev" + source: hosted + version: "10.0.3" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9b2ef90589911d665277464e0482b209d39882dffaaf4ef69a3561a3354b2ebc" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: fd3cd66cb2bcd7b50dcd3b413af49d78051f809c8b3f6e047962765c15a0d23d + url: "https://pub.dev" + source: hosted + version: "3.0.0" lints: dependency: transitive description: @@ -229,26 +253,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" mime: dependency: transitive description: @@ -277,18 +301,18 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" platform: dependency: transitive description: name: platform - sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: @@ -309,10 +333,10 @@ packages: dependency: transitive description: name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" url: "https://pub.dev" source: hosted - version: "4.2.4" + version: "5.0.2" pub_semver: dependency: transitive description: @@ -426,26 +450,26 @@ packages: dependency: "direct dev" description: name: test - sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f + sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" url: "https://pub.dev" source: hosted - version: "1.24.9" + version: "1.25.2" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" test_core: dependency: transitive description: name: test_core - sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a + sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" url: "https://pub.dev" source: hosted - version: "0.5.9" + version: "0.6.0" typed_data: dependency: transitive description: @@ -466,10 +490,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + sha256: a2662fb1f114f4296cf3f5a50786a2d888268d7776cf681aa17d660ffa23b246 url: "https://pub.dev" source: hosted - version: "11.10.0" + version: "14.0.0" watcher: dependency: transitive description: @@ -478,14 +502,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" - web: - dependency: transitive - description: - name: web - sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 - url: "https://pub.dev" - source: hosted - version: "0.3.0" web_socket_channel: dependency: transitive description: @@ -498,10 +514,10 @@ packages: dependency: transitive description: name: webdriver - sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" + sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" webkit_inspection_protocol: dependency: transitive description: @@ -519,5 +535,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" - flutter: ">=2.11.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pkgs/jni/lib/src/jni.dart b/pkgs/jni/lib/src/jni.dart index 4993aee9d..b64f7bbd6 100644 --- a/pkgs/jni/lib/src/jni.dart +++ b/pkgs/jni/lib/src/jni.dart @@ -149,19 +149,17 @@ abstract final class Jni { final optsPtr = (count != 0) ? allocator(count) : nullptr; args.ref.options = optsPtr; for (int i = 0; i < options.length; i++) { - optsPtr.elementAt(i).ref.optionString = - options[i].toNativeChars(allocator); + (optsPtr + i).ref.optionString = options[i].toNativeChars(allocator); } if (dylibPath != null) { - optsPtr - .elementAt(count - 1 - (classPath.isNotEmpty ? 1 : 0)) + (optsPtr + count - 1 - (classPath.isNotEmpty ? 1 : 0)) .ref .optionString = "-Djava.library.path=$dylibPath".toNativeChars(allocator); } if (classPath.isNotEmpty) { final classPathString = classPath.join(Platform.isWindows ? ';' : ":"); - optsPtr.elementAt(count - 1).ref.optionString = + (optsPtr + count - 1).ref.optionString = "-Djava.class.path=$classPathString".toNativeChars(allocator); } args.ref.nOptions = count; diff --git a/pkgs/jni/lib/src/jvalues.dart b/pkgs/jni/lib/src/jvalues.dart index dc1773617..ce8f27306 100644 --- a/pkgs/jni/lib/src/jvalues.dart +++ b/pkgs/jni/lib/src/jvalues.dart @@ -59,7 +59,7 @@ Pointer toJValues(List args, {Allocator allocator = calloc}) { final result = allocator(args.length); for (int i = 0; i < args.length; i++) { final arg = args[i]; - final pos = result.elementAt(i); + final pos = result + i; _fillJValue(pos, arg); } return result; @@ -123,7 +123,7 @@ final class JValueArgs { values = arena(args.length); for (int i = 0; i < args.length; i++) { final arg = args[i]; - final ptr = values.elementAt(i); + final ptr = values + i; if (arg is String) { final jstr = Jni.env.toJStringPtr(arg); ptr.ref.l = jstr;