From 3ac748ff28eb4ebb53630c66230b9b1be5df73c2 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 24 Jun 2026 03:02:58 +0800 Subject: [PATCH] feat: add device ID override functionality to ShorebirdUpdater - Introduced `setDeviceIdOverride` method in `ShorebirdUpdater` to allow clients to set a custom device ID for patch checks. - Implemented the method in `ShorebirdUpdaterImpl` for both IO and web platforms. - Updated the `Updater` class to handle the device ID override in native bindings. - Added tests for the new functionality in both IO and web test suites, ensuring proper behavior when the updater is available and unavailable. --- library/include/updater_dart.h | 9 + library/src/c_api/dart.rs | 19 +- library/src/cache/updater_state.rs | 37 +- library/src/updater.rs | 7 + shorebird_code_push/README.md | 16 + .../lib/src/generated/updater_bindings.g.dart | 2996 +++++++++-------- .../lib/src/shorebird_updater.dart | 10 + .../lib/src/shorebird_updater_io.dart | 43 +- .../lib/src/shorebird_updater_web.dart | 3 + shorebird_code_push/lib/src/updater.dart | 17 +- .../test/src/shorebird_updater_io_test.dart | 139 +- .../test/src/shorebird_updater_web_test.dart | 12 + .../test/src/updater_test.dart | 105 +- 13 files changed, 1824 insertions(+), 1589 deletions(-) diff --git a/library/include/updater_dart.h b/library/include/updater_dart.h index 1126e18..4769c39 100644 --- a/library/include/updater_dart.h +++ b/library/include/updater_dart.h @@ -83,6 +83,15 @@ SHOREBIRD_EXPORT uintptr_t shorebird_next_boot_patch_number(void); SHOREBIRD_EXPORT bool shorebird_check_for_downloadable_update(const char *c_channel); +/** + * Overrides the generated random per-install device/client id used in patch + * check requests. This is for applications that need to bind patch delivery + * to their own stable account/device identifier. The updater persists this + * value in state.json after a successful call. + */ +SHOREBIRD_EXPORT +bool shorebird_set_device_id_override(const char *c_device_id); + /** * Synchronously download an update on the first non-null channel of: * 1. `c_channel` diff --git a/library/src/c_api/dart.rs b/library/src/c_api/dart.rs index d0d3732..8200aad 100644 --- a/library/src/c_api/dart.rs +++ b/library/src/c_api/dart.rs @@ -15,7 +15,7 @@ //! `c_api::engine` — that surface is unstable and changes freely. use std::os::raw::c_char; -use super::{allocate_c_string, free_c_string, log_on_error, to_rust_option}; +use super::{allocate_c_string, free_c_string, log_on_error, to_rust, to_rust_option}; use crate::{updater, UpdateStatus}; /// An unknown error occurred while updating. The update was not installed. @@ -105,6 +105,23 @@ pub extern "C" fn shorebird_check_for_downloadable_update(c_channel: *const c_ch ) } +/// Overrides the generated random per-install device/client id used in patch +/// check requests. This is for applications that need to bind patch delivery +/// to their own stable account/device identifier. The updater persists this +/// value in state.json after a successful call. +#[no_mangle] +pub extern "C" fn shorebird_set_device_id_override(c_device_id: *const c_char) -> bool { + log_on_error( + || { + let device_id = to_rust(c_device_id)?; + updater::set_client_id_override(&device_id)?; + Ok(true) + }, + "setting device id override", + false, + ) +} + /// Synchronously download an update on the first non-null channel of: /// 1. `c_channel` /// 2. The channel specified in shorebird.yaml diff --git a/library/src/cache/updater_state.rs b/library/src/cache/updater_state.rs index ab8fb1d..48f882d 100644 --- a/library/src/cache/updater_state.rs +++ b/library/src/cache/updater_state.rs @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf}; -use anyhow::Result; +use anyhow::{ensure, Result}; #[cfg(test)] use anyhow::{bail, Context}; use serde::{Deserialize, Serialize}; @@ -100,6 +100,23 @@ impl UpdaterState { pub fn client_id(&self) -> String { self.serialized_state.client_id.clone() } + + pub fn set_client_id_override(&mut self, client_id: &str) -> Result<()> { + ensure!( + !client_id.is_empty(), + "Device id override must not be empty." + ); + ensure!( + client_id.len() <= 256, + "Device id override must be 256 bytes or fewer." + ); + ensure!( + !client_id.chars().any(char::is_control), + "Device id override must not contain control characters." + ); + self.serialized_state.client_id = client_id.to_string(); + self.save() + } } impl UpdaterState { @@ -529,6 +546,24 @@ mod tests { assert_eq!(next.client_id(), original_client_id); } + #[test] + fn client_id_override_persists_across_release_changes() { + let tmp = TempDir::new().unwrap(); + let mut original = load(&tmp, "1.0.0+1"); + original + .set_client_id_override("developer-device-id") + .unwrap(); + let next = load(&tmp, "1.0.0+2"); + assert_eq!(next.client_id(), "developer-device-id"); + } + + #[test] + fn client_id_override_rejects_empty_value() { + let tmp = TempDir::new().unwrap(); + let mut state = load(&tmp, "1.0.0+1"); + assert!(state.set_client_id_override("").is_err()); + } + #[test] fn corrupt_state_file_creates_new_state() { let tmp = TempDir::new().unwrap(); diff --git a/library/src/updater.rs b/library/src/updater.rs index 7b27625..fb3aead 100644 --- a/library/src/updater.rs +++ b/library/src/updater.rs @@ -271,6 +271,13 @@ pub fn should_auto_update() -> anyhow::Result { with_config(|config| Ok(config.auto_update)) } +/// Overrides the generated per-install device/client id used for patch checks +/// and server-side device targeting. The value is persisted in updater state +/// and survives release-version cache resets. +pub fn set_client_id_override(client_id: &str) -> anyhow::Result<()> { + with_mut_state(|state| state.set_client_id_override(client_id)) +} + /// Synchronously checks for an update on the first non-null channel of: /// 1. `c_channel` /// 2. The channel specified in shorebird.yaml diff --git a/shorebird_code_push/README.md b/shorebird_code_push/README.md index d26b60b..338d68d 100644 --- a/shorebird_code_push/README.md +++ b/shorebird_code_push/README.md @@ -120,6 +120,22 @@ updater.checkForUpdate(track: UpdateTrack('my-custom-track')); tracks. See [#3484](https://github.com/shorebirdtech/shorebird/issues/3484) for details. +### Device id override + +The updater generates a random per-install `client_id` on first startup and +persists it locally. Self-hosted update servers that encrypt or target patches +per app/account device can override that id before checking for updates: + +```dart +final updater = ShorebirdUpdater(); +await updater.setDeviceIdOverride('stable-app-device-id'); +await updater.checkForUpdate(); +``` + +Do not put secrets in this value. It is sent to the update server as +`client_id`; encryption keys should be derived from server-side or +app-provided key material. + ## Join us on Discord! We have an active [Discord server](https://discord.gg/shorebird) where you can diff --git a/shorebird_code_push/lib/src/generated/updater_bindings.g.dart b/shorebird_code_push/lib/src/generated/updater_bindings.g.dart index efba27f..55efb79 100644 --- a/shorebird_code_push/lib/src/generated/updater_bindings.g.dart +++ b/shorebird_code_push/lib/src/generated/updater_bindings.g.dart @@ -9,183 +9,136 @@ import 'dart:ffi' as ffi; class UpdaterBindings { /// Holds the symbol lookup function. final ffi.Pointer Function(String symbolName) - _lookup; + _lookup; /// The symbols are looked up in [dynamicLibrary]. UpdaterBindings(ffi.DynamicLibrary dynamicLibrary) - : _lookup = dynamicLibrary.lookup; + : _lookup = dynamicLibrary.lookup; /// The symbols are looked up with [lookup]. UpdaterBindings.fromLookup( - ffi.Pointer Function(String symbolName) - lookup) - : _lookup = lookup; + ffi.Pointer Function(String symbolName) lookup, + ) : _lookup = lookup; ffi.Pointer> signal( int arg0, ffi.Pointer> arg1, ) { - return _signal( - arg0, - arg1, - ); + return _signal(arg0, arg1); } - late final _signalPtr = _lookup< - ffi.NativeFunction< + late final _signalPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer> Function( - ffi.Int, - ffi.Pointer< - ffi.NativeFunction>)>>('signal'); - late final _signal = _signalPtr.asFunction< - ffi.Pointer> Function( - int, ffi.Pointer>)>(); + ffi.Int, + ffi.Pointer>, + ) + > + >('signal'); + late final _signal = _signalPtr + .asFunction< + ffi.Pointer> Function( + int, + ffi.Pointer>, + ) + >(); - int getpriority( - int arg0, - int arg1, - ) { - return _getpriority( - arg0, - arg1, - ); + int getpriority(int arg0, int arg1) { + return _getpriority(arg0, arg1); } late final _getpriorityPtr = _lookup>( - 'getpriority'); - late final _getpriority = - _getpriorityPtr.asFunction(); + 'getpriority', + ); + late final _getpriority = _getpriorityPtr + .asFunction(); - int getiopolicy_np( - int arg0, - int arg1, - ) { - return _getiopolicy_np( - arg0, - arg1, - ); + int getiopolicy_np(int arg0, int arg1) { + return _getiopolicy_np(arg0, arg1); } late final _getiopolicy_npPtr = _lookup>( - 'getiopolicy_np'); - late final _getiopolicy_np = - _getiopolicy_npPtr.asFunction(); + 'getiopolicy_np', + ); + late final _getiopolicy_np = _getiopolicy_npPtr + .asFunction(); - int getrlimit( - int arg0, - ffi.Pointer arg1, - ) { - return _getrlimit( - arg0, - arg1, - ); + int getrlimit(int arg0, ffi.Pointer arg1) { + return _getrlimit(arg0, arg1); } - late final _getrlimitPtr = _lookup< - ffi.NativeFunction)>>( - 'getrlimit'); - late final _getrlimit = - _getrlimitPtr.asFunction)>(); + late final _getrlimitPtr = + _lookup< + ffi.NativeFunction)> + >('getrlimit'); + late final _getrlimit = _getrlimitPtr + .asFunction)>(); - int getrusage( - int arg0, - ffi.Pointer arg1, - ) { - return _getrusage( - arg0, - arg1, - ); + int getrusage(int arg0, ffi.Pointer arg1) { + return _getrusage(arg0, arg1); } - late final _getrusagePtr = _lookup< - ffi.NativeFunction)>>( - 'getrusage'); - late final _getrusage = - _getrusagePtr.asFunction)>(); + late final _getrusagePtr = + _lookup< + ffi.NativeFunction)> + >('getrusage'); + late final _getrusage = _getrusagePtr + .asFunction)>(); - int setpriority( - int arg0, - int arg1, - int arg2, - ) { - return _setpriority( - arg0, - arg1, - arg2, - ); + int setpriority(int arg0, int arg1, int arg2) { + return _setpriority(arg0, arg1, arg2); } late final _setpriorityPtr = _lookup>( - 'setpriority'); - late final _setpriority = - _setpriorityPtr.asFunction(); + 'setpriority', + ); + late final _setpriority = _setpriorityPtr + .asFunction(); - int setiopolicy_np( - int arg0, - int arg1, - int arg2, - ) { - return _setiopolicy_np( - arg0, - arg1, - arg2, - ); + int setiopolicy_np(int arg0, int arg1, int arg2) { + return _setiopolicy_np(arg0, arg1, arg2); } late final _setiopolicy_npPtr = _lookup>( - 'setiopolicy_np'); - late final _setiopolicy_np = - _setiopolicy_npPtr.asFunction(); + 'setiopolicy_np', + ); + late final _setiopolicy_np = _setiopolicy_npPtr + .asFunction(); - int setrlimit( - int arg0, - ffi.Pointer arg1, - ) { - return _setrlimit( - arg0, - arg1, - ); + int setrlimit(int arg0, ffi.Pointer arg1) { + return _setrlimit(arg0, arg1); } - late final _setrlimitPtr = _lookup< - ffi.NativeFunction)>>( - 'setrlimit'); - late final _setrlimit = - _setrlimitPtr.asFunction)>(); + late final _setrlimitPtr = + _lookup< + ffi.NativeFunction)> + >('setrlimit'); + late final _setrlimit = _setrlimitPtr + .asFunction)>(); - int wait( - ffi.Pointer arg0, - ) { - return _wait( - arg0, - ); + int wait(ffi.Pointer arg0) { + return _wait(arg0); } late final _waitPtr = _lookup)>>('wait'); late final _wait = _waitPtr.asFunction)>(); - int waitpid( - int arg0, - ffi.Pointer arg1, - int arg2, - ) { - return _waitpid( - arg0, - arg1, - arg2, - ); + int waitpid(int arg0, ffi.Pointer arg1, int arg2) { + return _waitpid(arg0, arg1, arg2); } - late final _waitpidPtr = _lookup< - ffi.NativeFunction< - pid_t Function(pid_t, ffi.Pointer, ffi.Int)>>('waitpid'); - late final _waitpid = - _waitpidPtr.asFunction, int)>(); + late final _waitpidPtr = + _lookup< + ffi.NativeFunction, ffi.Int)> + >('waitpid'); + late final _waitpid = _waitpidPtr + .asFunction, int)>(); int waitid( idtype_t arg0, @@ -193,39 +146,37 @@ class UpdaterBindings { ffi.Pointer arg2, int arg3, ) { - return _waitid( - arg0.value, - arg1, - arg2, - arg3, - ); + return _waitid(arg0.value, arg1, arg2, arg3); } - late final _waitidPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.UnsignedInt, id_t, ffi.Pointer, - ffi.Int)>>('waitid'); + late final _waitidPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.UnsignedInt, + id_t, + ffi.Pointer, + ffi.Int, + ) + > + >('waitid'); late final _waitid = _waitidPtr .asFunction, int)>(); - int wait3( - ffi.Pointer arg0, - int arg1, - ffi.Pointer arg2, - ) { - return _wait3( - arg0, - arg1, - arg2, - ); + int wait3(ffi.Pointer arg0, int arg1, ffi.Pointer arg2) { + return _wait3(arg0, arg1, arg2); } - late final _wait3Ptr = _lookup< - ffi.NativeFunction< - pid_t Function( - ffi.Pointer, ffi.Int, ffi.Pointer)>>('wait3'); - late final _wait3 = _wait3Ptr.asFunction< - int Function(ffi.Pointer, int, ffi.Pointer)>(); + late final _wait3Ptr = + _lookup< + ffi.NativeFunction< + pid_t Function(ffi.Pointer, ffi.Int, ffi.Pointer) + > + >('wait3'); + late final _wait3 = _wait3Ptr + .asFunction< + int Function(ffi.Pointer, int, ffi.Pointer) + >(); int wait4( int arg0, @@ -233,92 +184,80 @@ class UpdaterBindings { int arg2, ffi.Pointer arg3, ) { - return _wait4( - arg0, - arg1, - arg2, - arg3, - ); + return _wait4(arg0, arg1, arg2, arg3); } - late final _wait4Ptr = _lookup< - ffi.NativeFunction< - pid_t Function(pid_t, ffi.Pointer, ffi.Int, - ffi.Pointer)>>('wait4'); - late final _wait4 = _wait4Ptr.asFunction< - int Function(int, ffi.Pointer, int, ffi.Pointer)>(); + late final _wait4Ptr = + _lookup< + ffi.NativeFunction< + pid_t Function( + pid_t, + ffi.Pointer, + ffi.Int, + ffi.Pointer, + ) + > + >('wait4'); + late final _wait4 = _wait4Ptr + .asFunction< + int Function(int, ffi.Pointer, int, ffi.Pointer) + >(); - ffi.Pointer alloca( - int __size, - ) { - return _alloca( - __size, - ); + ffi.Pointer alloca(int __size) { + return _alloca(__size); } late final _allocaPtr = _lookup Function(ffi.Size)>>( - 'alloca'); - late final _alloca = - _allocaPtr.asFunction Function(int)>(); + 'alloca', + ); + late final _alloca = _allocaPtr + .asFunction Function(int)>(); - late final ffi.Pointer ___mb_cur_max = - _lookup('__mb_cur_max'); + late final ffi.Pointer ___mb_cur_max = _lookup( + '__mb_cur_max', + ); int get __mb_cur_max => ___mb_cur_max.value; set __mb_cur_max(int value) => ___mb_cur_max.value = value; - ffi.Pointer malloc_type_malloc( - int size, - int type_id, - ) { - return _malloc_type_malloc( - size, - type_id, - ); + ffi.Pointer malloc_type_malloc(int size, int type_id) { + return _malloc_type_malloc(size, type_id); } - late final _malloc_type_mallocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Size, malloc_type_id_t)>>('malloc_type_malloc'); + late final _malloc_type_mallocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, malloc_type_id_t) + > + >('malloc_type_malloc'); late final _malloc_type_malloc = _malloc_type_mallocPtr .asFunction Function(int, int)>(); - ffi.Pointer malloc_type_calloc( - int count, - int size, - int type_id, - ) { - return _malloc_type_calloc( - count, - size, - type_id, - ); + ffi.Pointer malloc_type_calloc(int count, int size, int type_id) { + return _malloc_type_calloc(count, size, type_id); } - late final _malloc_type_callocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Size, ffi.Size, malloc_type_id_t)>>('malloc_type_calloc'); + late final _malloc_type_callocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size, malloc_type_id_t) + > + >('malloc_type_calloc'); late final _malloc_type_calloc = _malloc_type_callocPtr .asFunction Function(int, int, int)>(); - void malloc_type_free( - ffi.Pointer ptr, - int type_id, - ) { - return _malloc_type_free( - ptr, - type_id, - ); + void malloc_type_free(ffi.Pointer ptr, int type_id) { + return _malloc_type_free(ptr, type_id); } - late final _malloc_type_freePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, malloc_type_id_t)>>('malloc_type_free'); + late final _malloc_type_freePtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, malloc_type_id_t) + > + >('malloc_type_free'); late final _malloc_type_free = _malloc_type_freePtr .asFunction, int)>(); @@ -327,34 +266,34 @@ class UpdaterBindings { int size, int type_id, ) { - return _malloc_type_realloc( - ptr, - size, - type_id, - ); + return _malloc_type_realloc(ptr, size, type_id); } - late final _malloc_type_reallocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Size, - malloc_type_id_t)>>('malloc_type_realloc'); - late final _malloc_type_realloc = _malloc_type_reallocPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, int, int)>(); - - ffi.Pointer malloc_type_valloc( - int size, - int type_id, - ) { - return _malloc_type_valloc( - size, - type_id, - ); - } - - late final _malloc_type_vallocPtr = _lookup< - ffi.NativeFunction< + late final _malloc_type_reallocPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Size, malloc_type_id_t)>>('malloc_type_valloc'); + ffi.Pointer, + ffi.Size, + malloc_type_id_t, + ) + > + >('malloc_type_realloc'); + late final _malloc_type_realloc = _malloc_type_reallocPtr + .asFunction< + ffi.Pointer Function(ffi.Pointer, int, int) + >(); + + ffi.Pointer malloc_type_valloc(int size, int type_id) { + return _malloc_type_valloc(size, type_id); + } + + late final _malloc_type_vallocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, malloc_type_id_t) + > + >('malloc_type_valloc'); late final _malloc_type_valloc = _malloc_type_vallocPtr .asFunction Function(int, int)>(); @@ -363,17 +302,15 @@ class UpdaterBindings { int size, int type_id, ) { - return _malloc_type_aligned_alloc( - alignment, - size, - type_id, - ); + return _malloc_type_aligned_alloc(alignment, size, type_id); } - late final _malloc_type_aligned_allocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Size, ffi.Size, - malloc_type_id_t)>>('malloc_type_aligned_alloc'); + late final _malloc_type_aligned_allocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size, malloc_type_id_t) + > + >('malloc_type_aligned_alloc'); late final _malloc_type_aligned_alloc = _malloc_type_aligned_allocPtr .asFunction Function(int, int, int)>(); @@ -383,40 +320,47 @@ class UpdaterBindings { int size, int type_id, ) { - return _malloc_type_posix_memalign( - memptr, - alignment, - size, - type_id, - ); + return _malloc_type_posix_memalign(memptr, alignment, size, type_id); } - late final _malloc_type_posix_memalignPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer>, ffi.Size, - ffi.Size, malloc_type_id_t)>>('malloc_type_posix_memalign'); - late final _malloc_type_posix_memalign = - _malloc_type_posix_memalignPtr.asFunction< - int Function(ffi.Pointer>, int, int, int)>(); + late final _malloc_type_posix_memalignPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Size, + ffi.Size, + malloc_type_id_t, + ) + > + >('malloc_type_posix_memalign'); + late final _malloc_type_posix_memalign = _malloc_type_posix_memalignPtr + .asFunction< + int Function(ffi.Pointer>, int, int, int) + >(); ffi.Pointer malloc_type_zone_malloc( ffi.Pointer zone, int size, int type_id, ) { - return _malloc_type_zone_malloc( - zone, - size, - type_id, - ); + return _malloc_type_zone_malloc(zone, size, type_id); } - late final _malloc_type_zone_mallocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Size, - malloc_type_id_t)>>('malloc_type_zone_malloc'); - late final _malloc_type_zone_malloc = _malloc_type_zone_mallocPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, int, int)>(); + late final _malloc_type_zone_mallocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Size, + malloc_type_id_t, + ) + > + >('malloc_type_zone_malloc'); + late final _malloc_type_zone_malloc = _malloc_type_zone_mallocPtr + .asFunction< + ffi.Pointer Function(ffi.Pointer, int, int) + >(); ffi.Pointer malloc_type_zone_calloc( ffi.Pointer zone, @@ -424,40 +368,52 @@ class UpdaterBindings { int size, int type_id, ) { - return _malloc_type_zone_calloc( - zone, - count, - size, - type_id, - ); + return _malloc_type_zone_calloc(zone, count, size, type_id); } - late final _malloc_type_zone_callocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Size, - ffi.Size, malloc_type_id_t)>>('malloc_type_zone_calloc'); - late final _malloc_type_zone_calloc = _malloc_type_zone_callocPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, int, int, int)>(); + late final _malloc_type_zone_callocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + malloc_type_id_t, + ) + > + >('malloc_type_zone_calloc'); + late final _malloc_type_zone_calloc = _malloc_type_zone_callocPtr + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + int, + int, + int, + ) + >(); void malloc_type_zone_free( ffi.Pointer zone, ffi.Pointer ptr, int type_id, ) { - return _malloc_type_zone_free( - zone, - ptr, - type_id, - ); + return _malloc_type_zone_free(zone, ptr, type_id); } - late final _malloc_type_zone_freePtr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, ffi.Pointer, - malloc_type_id_t)>>('malloc_type_zone_free'); - late final _malloc_type_zone_free = _malloc_type_zone_freePtr.asFunction< - void Function(ffi.Pointer, ffi.Pointer, int)>(); + late final _malloc_type_zone_freePtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Pointer, + malloc_type_id_t, + ) + > + >('malloc_type_zone_free'); + late final _malloc_type_zone_free = _malloc_type_zone_freePtr + .asFunction< + void Function(ffi.Pointer, ffi.Pointer, int) + >(); ffi.Pointer malloc_type_zone_realloc( ffi.Pointer zone, @@ -465,44 +421,52 @@ class UpdaterBindings { int size, int type_id, ) { - return _malloc_type_zone_realloc( - zone, - ptr, - size, - type_id, - ); + return _malloc_type_zone_realloc(zone, ptr, size, type_id); } - late final _malloc_type_zone_reallocPtr = _lookup< - ffi.NativeFunction< + late final _malloc_type_zone_reallocPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - malloc_type_id_t)>>('malloc_type_zone_realloc'); - late final _malloc_type_zone_realloc = - _malloc_type_zone_reallocPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer, int, int)>(); + ffi.Pointer, + ffi.Pointer, + ffi.Size, + malloc_type_id_t, + ) + > + >('malloc_type_zone_realloc'); + late final _malloc_type_zone_realloc = _malloc_type_zone_reallocPtr + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + int, + ) + >(); ffi.Pointer malloc_type_zone_valloc( ffi.Pointer zone, int size, int type_id, ) { - return _malloc_type_zone_valloc( - zone, - size, - type_id, - ); + return _malloc_type_zone_valloc(zone, size, type_id); } - late final _malloc_type_zone_vallocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Size, - malloc_type_id_t)>>('malloc_type_zone_valloc'); - late final _malloc_type_zone_valloc = _malloc_type_zone_vallocPtr.asFunction< - ffi.Pointer Function(ffi.Pointer, int, int)>(); + late final _malloc_type_zone_vallocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Size, + malloc_type_id_t, + ) + > + >('malloc_type_zone_valloc'); + late final _malloc_type_zone_valloc = _malloc_type_zone_vallocPtr + .asFunction< + ffi.Pointer Function(ffi.Pointer, int, int) + >(); ffi.Pointer malloc_type_zone_memalign( ffi.Pointer zone, @@ -510,147 +474,129 @@ class UpdaterBindings { int size, int type_id, ) { - return _malloc_type_zone_memalign( - zone, - alignment, - size, - type_id, - ); + return _malloc_type_zone_memalign(zone, alignment, size, type_id); } - late final _malloc_type_zone_memalignPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, ffi.Size, - ffi.Size, malloc_type_id_t)>>('malloc_type_zone_memalign'); - late final _malloc_type_zone_memalign = - _malloc_type_zone_memalignPtr.asFunction< + late final _malloc_type_zone_memalignPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, int, int, int)>(); + ffi.Pointer, + ffi.Size, + ffi.Size, + malloc_type_id_t, + ) + > + >('malloc_type_zone_memalign'); + late final _malloc_type_zone_memalign = _malloc_type_zone_memalignPtr + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + int, + int, + int, + ) + >(); - ffi.Pointer malloc( - int __size, - ) { - return _malloc( - __size, - ); + ffi.Pointer malloc(int __size) { + return _malloc(__size); } late final _mallocPtr = _lookup Function(ffi.Size)>>( - 'malloc'); - late final _malloc = - _mallocPtr.asFunction Function(int)>(); + 'malloc', + ); + late final _malloc = _mallocPtr + .asFunction Function(int)>(); - ffi.Pointer calloc( - int __count, - int __size, - ) { - return _calloc( - __count, - __size, - ); + ffi.Pointer calloc(int __count, int __size) { + return _calloc(__count, __size); } - late final _callocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Size, ffi.Size)>>('calloc'); - late final _calloc = - _callocPtr.asFunction Function(int, int)>(); + late final _callocPtr = + _lookup< + ffi.NativeFunction Function(ffi.Size, ffi.Size)> + >('calloc'); + late final _calloc = _callocPtr + .asFunction Function(int, int)>(); - void free( - ffi.Pointer arg0, - ) { - return _free( - arg0, - ); + void free(ffi.Pointer arg0) { + return _free(arg0); } late final _freePtr = _lookup)>>( - 'free'); - late final _free = - _freePtr.asFunction)>(); + 'free', + ); + late final _free = _freePtr + .asFunction)>(); - ffi.Pointer realloc( - ffi.Pointer __ptr, - int __size, - ) { - return _realloc( - __ptr, - __size, - ); + ffi.Pointer realloc(ffi.Pointer __ptr, int __size) { + return _realloc(__ptr, __size); } - late final _reallocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Size)>>('realloc'); + late final _reallocPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size) + > + >('realloc'); late final _realloc = _reallocPtr .asFunction Function(ffi.Pointer, int)>(); - ffi.Pointer reallocf( - ffi.Pointer __ptr, - int __size, - ) { - return _reallocf( - __ptr, - __size, - ); + ffi.Pointer reallocf(ffi.Pointer __ptr, int __size) { + return _reallocf(__ptr, __size); } - late final _reallocfPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Size)>>('reallocf'); + late final _reallocfPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size) + > + >('reallocf'); late final _reallocf = _reallocfPtr .asFunction Function(ffi.Pointer, int)>(); - ffi.Pointer valloc( - int __size, - ) { - return _valloc( - __size, - ); + ffi.Pointer valloc(int __size) { + return _valloc(__size); } late final _vallocPtr = _lookup Function(ffi.Size)>>( - 'valloc'); - late final _valloc = - _vallocPtr.asFunction Function(int)>(); + 'valloc', + ); + late final _valloc = _vallocPtr + .asFunction Function(int)>(); - ffi.Pointer aligned_alloc( - int __alignment, - int __size, - ) { - return _aligned_alloc( - __alignment, - __size, - ); + ffi.Pointer aligned_alloc(int __alignment, int __size) { + return _aligned_alloc(__alignment, __size); } - late final _aligned_allocPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Size, ffi.Size)>>('aligned_alloc'); - late final _aligned_alloc = - _aligned_allocPtr.asFunction Function(int, int)>(); + late final _aligned_allocPtr = + _lookup< + ffi.NativeFunction Function(ffi.Size, ffi.Size)> + >('aligned_alloc'); + late final _aligned_alloc = _aligned_allocPtr + .asFunction Function(int, int)>(); int posix_memalign( ffi.Pointer> __memptr, int __alignment, int __size, ) { - return _posix_memalign( - __memptr, - __alignment, - __size, - ); + return _posix_memalign(__memptr, __alignment, __size); } - late final _posix_memalignPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer>, ffi.Size, - ffi.Size)>>('posix_memalign'); + late final _posix_memalignPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Size, + ffi.Size, + ) + > + >('posix_memalign'); late final _posix_memalign = _posix_memalignPtr .asFunction>, int, int)>(); @@ -658,106 +604,91 @@ class UpdaterBindings { return _abort(); } - late final _abortPtr = - _lookup>('abort'); + late final _abortPtr = _lookup>( + 'abort', + ); late final _abort = _abortPtr.asFunction(); - int abs( - int arg0, - ) { - return _abs( - arg0, - ); + int abs(int arg0) { + return _abs(arg0); } - late final _absPtr = - _lookup>('abs'); + late final _absPtr = _lookup>( + 'abs', + ); late final _abs = _absPtr.asFunction(); - int atexit( - ffi.Pointer> arg0, - ) { - return _atexit( - arg0, - ); + int atexit(ffi.Pointer> arg0) { + return _atexit(arg0); } - late final _atexitPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer>)>>('atexit'); - late final _atexit = _atexitPtr.asFunction< - int Function(ffi.Pointer>)>(); + late final _atexitPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>) + > + >('atexit'); + late final _atexit = _atexitPtr + .asFunction< + int Function(ffi.Pointer>) + >(); - int at_quick_exit( - ffi.Pointer> arg0, - ) { - return _at_quick_exit( - arg0, - ); + int at_quick_exit(ffi.Pointer> arg0) { + return _at_quick_exit(arg0); } - late final _at_quick_exitPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer>)>>( - 'at_quick_exit'); - late final _at_quick_exit = _at_quick_exitPtr.asFunction< - int Function(ffi.Pointer>)>(); + late final _at_quick_exitPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>) + > + >('at_quick_exit'); + late final _at_quick_exit = _at_quick_exitPtr + .asFunction< + int Function(ffi.Pointer>) + >(); - double atof( - ffi.Pointer arg0, - ) { - return _atof( - arg0, - ); + double atof(ffi.Pointer arg0) { + return _atof(arg0); } late final _atofPtr = _lookup)>>( - 'atof'); - late final _atof = - _atofPtr.asFunction)>(); + 'atof', + ); + late final _atof = _atofPtr + .asFunction)>(); - int atoi( - ffi.Pointer arg0, - ) { - return _atoi( - arg0, - ); + int atoi(ffi.Pointer arg0) { + return _atoi(arg0); } late final _atoiPtr = _lookup)>>( - 'atoi'); + 'atoi', + ); late final _atoi = _atoiPtr.asFunction)>(); - int atol( - ffi.Pointer arg0, - ) { - return _atol( - arg0, - ); + int atol(ffi.Pointer arg0) { + return _atol(arg0); } late final _atolPtr = _lookup)>>( - 'atol'); + 'atol', + ); late final _atol = _atolPtr.asFunction)>(); - int atoll( - ffi.Pointer arg0, - ) { - return _atoll( - arg0, - ); + int atoll(ffi.Pointer arg0) { + return _atoll(arg0); } late final _atollPtr = _lookup)>>( - 'atoll'); - late final _atoll = - _atollPtr.asFunction)>(); + 'atoll', + ); + late final _atoll = _atollPtr + .asFunction)>(); ffi.Pointer bsearch( ffi.Pointer __key, @@ -765,231 +696,208 @@ class UpdaterBindings { int __nel, int __width, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer)>> - __compar, + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + > + __compar, ) { - return _bsearch( - __key, - __base, - __nel, - __width, - __compar, - ); + return _bsearch(__key, __base, __nel, __width, __compar); } - late final _bsearchPtr = _lookup< - ffi.NativeFunction< + late final _bsearchPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>)>>('bsearch'); - late final _bsearch = _bsearchPtr.asFunction< - ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + > + >('bsearch'); + late final _bsearch = _bsearchPtr + .asFunction< + ffi.Pointer Function( ffi.Pointer, ffi.Pointer, int, int, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer, ffi.Pointer)>>)>(); + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + >(); - div_t div( - int arg0, - int arg1, - ) { - return _div( - arg0, - arg1, - ); + div_t div(int arg0, int arg1) { + return _div(arg0, arg1); } late final _divPtr = _lookup>('div'); late final _div = _divPtr.asFunction(); - void exit( - int arg0, - ) { - return _exit( - arg0, - ); + void exit(int arg0) { + return _exit(arg0); } - late final _exitPtr = - _lookup>('exit'); + late final _exitPtr = _lookup>( + 'exit', + ); late final _exit = _exitPtr.asFunction(); - ffi.Pointer getenv( - ffi.Pointer arg0, - ) { - return _getenv( - arg0, - ); + ffi.Pointer getenv(ffi.Pointer arg0) { + return _getenv(arg0); } - late final _getenvPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('getenv'); + late final _getenvPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer) + > + >('getenv'); late final _getenv = _getenvPtr .asFunction Function(ffi.Pointer)>(); - int labs( - int arg0, - ) { - return _labs( - arg0, - ); + int labs(int arg0) { + return _labs(arg0); } late final _labsPtr = _lookup>('labs'); late final _labs = _labsPtr.asFunction(); - ldiv_t ldiv( - int arg0, - int arg1, - ) { - return _ldiv( - arg0, - arg1, - ); + ldiv_t ldiv(int arg0, int arg1) { + return _ldiv(arg0, arg1); } late final _ldivPtr = _lookup>('ldiv'); late final _ldiv = _ldivPtr.asFunction(); - int llabs( - int arg0, - ) { - return _llabs( - arg0, - ); + int llabs(int arg0) { + return _llabs(arg0); } late final _llabsPtr = _lookup>('llabs'); late final _llabs = _llabsPtr.asFunction(); - lldiv_t lldiv( - int arg0, - int arg1, - ) { - return _lldiv( - arg0, - arg1, - ); + lldiv_t lldiv(int arg0, int arg1) { + return _lldiv(arg0, arg1); } late final _lldivPtr = _lookup>( - 'lldiv'); + 'lldiv', + ); late final _lldiv = _lldivPtr.asFunction(); - int mblen( - ffi.Pointer __s, - int __n, - ) { - return _mblen( - __s, - __n, - ); + int mblen(ffi.Pointer __s, int __n) { + return _mblen(__s, __n); } - late final _mblenPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Size)>>('mblen'); - late final _mblen = - _mblenPtr.asFunction, int)>(); + late final _mblenPtr = + _lookup< + ffi.NativeFunction, ffi.Size)> + >('mblen'); + late final _mblen = _mblenPtr + .asFunction, int)>(); int mbstowcs( ffi.Pointer arg0, ffi.Pointer arg1, int __n, ) { - return _mbstowcs( - arg0, - arg1, - __n, - ); + return _mbstowcs(arg0, arg1, __n); } - late final _mbstowcsPtr = _lookup< - ffi.NativeFunction< - ffi.Size Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('mbstowcs'); - late final _mbstowcs = _mbstowcsPtr.asFunction< - int Function(ffi.Pointer, ffi.Pointer, int)>(); + late final _mbstowcsPtr = + _lookup< + ffi.NativeFunction< + ffi.Size Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ) + > + >('mbstowcs'); + late final _mbstowcs = _mbstowcsPtr + .asFunction< + int Function(ffi.Pointer, ffi.Pointer, int) + >(); - int mbtowc( - ffi.Pointer arg0, - ffi.Pointer arg1, - int __n, - ) { - return _mbtowc( - arg0, - arg1, - __n, - ); + int mbtowc(ffi.Pointer arg0, ffi.Pointer arg1, int __n) { + return _mbtowc(arg0, arg1, __n); } - late final _mbtowcPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('mbtowc'); - late final _mbtowc = _mbtowcPtr.asFunction< - int Function(ffi.Pointer, ffi.Pointer, int)>(); + late final _mbtowcPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ) + > + >('mbtowc'); + late final _mbtowc = _mbtowcPtr + .asFunction< + int Function(ffi.Pointer, ffi.Pointer, int) + >(); void qsort( ffi.Pointer __base, int __nel, int __width, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer)>> - __compar, + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + > + __compar, ) { - return _qsort( - __base, - __nel, - __width, - __compar, - ); + return _qsort(__base, __nel, __width, __compar); } - late final _qsortPtr = _lookup< - ffi.NativeFunction< + late final _qsortPtr = + _lookup< + ffi.NativeFunction< ffi.Void Function( - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>)>>('qsort'); - late final _qsort = _qsortPtr.asFunction< - void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + > + >('qsort'); + late final _qsort = _qsortPtr + .asFunction< + void Function( ffi.Pointer, int, int, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer, ffi.Pointer)>>)>(); + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + >(); - void quick_exit( - int arg0, - ) { - return _quick_exit( - arg0, - ); + void quick_exit(int arg0) { + return _quick_exit(arg0); } late final _quick_exitPtr = @@ -1003,12 +911,8 @@ class UpdaterBindings { late final _randPtr = _lookup>('rand'); late final _rand = _randPtr.asFunction(); - void srand( - int arg0, - ) { - return _srand( - arg0, - ); + void srand(int arg0) { + return _srand(arg0); } late final _srandPtr = @@ -1019,198 +923,228 @@ class UpdaterBindings { ffi.Pointer arg0, ffi.Pointer> arg1, ) { - return _strtod( - arg0, - arg1, - ); + return _strtod(arg0, arg1); } - late final _strtodPtr = _lookup< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer, - ffi.Pointer>)>>('strtod'); - late final _strtod = _strtodPtr.asFunction< - double Function( - ffi.Pointer, ffi.Pointer>)>(); + late final _strtodPtr = + _lookup< + ffi.NativeFunction< + ffi.Double Function( + ffi.Pointer, + ffi.Pointer>, + ) + > + >('strtod'); + late final _strtod = _strtodPtr + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer>, + ) + >(); double strtof( ffi.Pointer arg0, ffi.Pointer> arg1, ) { - return _strtof( - arg0, - arg1, - ); + return _strtof(arg0, arg1); } - late final _strtofPtr = _lookup< - ffi.NativeFunction< - ffi.Float Function(ffi.Pointer, - ffi.Pointer>)>>('strtof'); - late final _strtof = _strtofPtr.asFunction< - double Function( - ffi.Pointer, ffi.Pointer>)>(); + late final _strtofPtr = + _lookup< + ffi.NativeFunction< + ffi.Float Function( + ffi.Pointer, + ffi.Pointer>, + ) + > + >('strtof'); + late final _strtof = _strtofPtr + .asFunction< + double Function( + ffi.Pointer, + ffi.Pointer>, + ) + >(); int strtol( ffi.Pointer __str, ffi.Pointer> __endptr, int __base, ) { - return _strtol( - __str, - __endptr, - __base, - ); + return _strtol(__str, __endptr, __base); } - late final _strtolPtr = _lookup< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer, - ffi.Pointer>, ffi.Int)>>('strtol'); - late final _strtol = _strtolPtr.asFunction< - int Function( - ffi.Pointer, ffi.Pointer>, int)>(); + late final _strtolPtr = + _lookup< + ffi.NativeFunction< + ffi.Long Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + ) + > + >('strtol'); + late final _strtol = _strtolPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer>, + int, + ) + >(); int strtoll( ffi.Pointer __str, ffi.Pointer> __endptr, int __base, ) { - return _strtoll( - __str, - __endptr, - __base, - ); + return _strtoll(__str, __endptr, __base); } - late final _strtollPtr = _lookup< - ffi.NativeFunction< - ffi.LongLong Function(ffi.Pointer, - ffi.Pointer>, ffi.Int)>>('strtoll'); - late final _strtoll = _strtollPtr.asFunction< - int Function( - ffi.Pointer, ffi.Pointer>, int)>(); + late final _strtollPtr = + _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + ) + > + >('strtoll'); + late final _strtoll = _strtollPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer>, + int, + ) + >(); int strtoul( ffi.Pointer __str, ffi.Pointer> __endptr, int __base, ) { - return _strtoul( - __str, - __endptr, - __base, - ); + return _strtoul(__str, __endptr, __base); } - late final _strtoulPtr = _lookup< - ffi.NativeFunction< - ffi.UnsignedLong Function(ffi.Pointer, - ffi.Pointer>, ffi.Int)>>('strtoul'); - late final _strtoul = _strtoulPtr.asFunction< - int Function( - ffi.Pointer, ffi.Pointer>, int)>(); + late final _strtoulPtr = + _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + ) + > + >('strtoul'); + late final _strtoul = _strtoulPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer>, + int, + ) + >(); int strtoull( ffi.Pointer __str, ffi.Pointer> __endptr, int __base, ) { - return _strtoull( - __str, - __endptr, - __base, - ); + return _strtoull(__str, __endptr, __base); } - late final _strtoullPtr = _lookup< - ffi.NativeFunction< - ffi.UnsignedLongLong Function(ffi.Pointer, - ffi.Pointer>, ffi.Int)>>('strtoull'); - late final _strtoull = _strtoullPtr.asFunction< - int Function( - ffi.Pointer, ffi.Pointer>, int)>(); + late final _strtoullPtr = + _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + ) + > + >('strtoull'); + late final _strtoull = _strtoullPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer>, + int, + ) + >(); - int system( - ffi.Pointer arg0, - ) { - return _system( - arg0, - ); + int system(ffi.Pointer arg0) { + return _system(arg0); } late final _systemPtr = _lookup)>>( - 'system'); - late final _system = - _systemPtr.asFunction)>(); + 'system', + ); + late final _system = _systemPtr + .asFunction)>(); int wcstombs( ffi.Pointer arg0, ffi.Pointer arg1, int __n, ) { - return _wcstombs( - arg0, - arg1, - __n, - ); + return _wcstombs(arg0, arg1, __n); } - late final _wcstombsPtr = _lookup< - ffi.NativeFunction< - ffi.Size Function(ffi.Pointer, ffi.Pointer, - ffi.Size)>>('wcstombs'); - late final _wcstombs = _wcstombsPtr.asFunction< - int Function(ffi.Pointer, ffi.Pointer, int)>(); + late final _wcstombsPtr = + _lookup< + ffi.NativeFunction< + ffi.Size Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ) + > + >('wcstombs'); + late final _wcstombs = _wcstombsPtr + .asFunction< + int Function(ffi.Pointer, ffi.Pointer, int) + >(); - int wctomb( - ffi.Pointer arg0, - int arg1, - ) { - return _wctomb( - arg0, - arg1, - ); + int wctomb(ffi.Pointer arg0, int arg1) { + return _wctomb(arg0, arg1); } - late final _wctombPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.WChar)>>('wctomb'); - late final _wctomb = - _wctombPtr.asFunction, int)>(); + late final _wctombPtr = + _lookup< + ffi.NativeFunction, ffi.WChar)> + >('wctomb'); + late final _wctomb = _wctombPtr + .asFunction, int)>(); - void _Exit( - int arg0, - ) { - return __Exit( - arg0, - ); + void _Exit(int arg0) { + return __Exit(arg0); } late final __ExitPtr = _lookup>('_Exit'); late final __Exit = __ExitPtr.asFunction(); - int a64l( - ffi.Pointer arg0, - ) { - return _a64l( - arg0, - ); + int a64l(ffi.Pointer arg0) { + return _a64l(arg0); } late final _a64lPtr = _lookup)>>( - 'a64l'); + 'a64l', + ); late final _a64l = _a64lPtr.asFunction)>(); double drand48() { return _drand48(); } - late final _drand48Ptr = - _lookup>('drand48'); + late final _drand48Ptr = _lookup>( + 'drand48', + ); late final _drand48 = _drand48Ptr.asFunction(); ffi.Pointer ecvt( @@ -1219,35 +1153,40 @@ class UpdaterBindings { ffi.Pointer arg2, ffi.Pointer arg3, ) { - return _ecvt( - arg0, - arg1, - arg2, - arg3, - ); + return _ecvt(arg0, arg1, arg2, arg3); } - late final _ecvtPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Double, ffi.Int, - ffi.Pointer, ffi.Pointer)>>('ecvt'); - late final _ecvt = _ecvtPtr.asFunction< - ffi.Pointer Function( - double, int, ffi.Pointer, ffi.Pointer)>(); + late final _ecvtPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Double, + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ) + > + >('ecvt'); + late final _ecvt = _ecvtPtr + .asFunction< + ffi.Pointer Function( + double, + int, + ffi.Pointer, + ffi.Pointer, + ) + >(); - double erand48( - ffi.Pointer arg0, - ) { - return _erand48( - arg0, - ); + double erand48(ffi.Pointer arg0) { + return _erand48(arg0); } - late final _erand48Ptr = _lookup< - ffi.NativeFunction< - ffi.Double Function(ffi.Pointer)>>('erand48'); - late final _erand48 = - _erand48Ptr.asFunction)>(); + late final _erand48Ptr = + _lookup< + ffi.NativeFunction)> + >('erand48'); + late final _erand48 = _erand48Ptr + .asFunction)>(); ffi.Pointer fcvt( double arg0, @@ -1255,71 +1194,82 @@ class UpdaterBindings { ffi.Pointer arg2, ffi.Pointer arg3, ) { - return _fcvt( - arg0, - arg1, - arg2, - arg3, - ); + return _fcvt(arg0, arg1, arg2, arg3); } - late final _fcvtPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Double, ffi.Int, - ffi.Pointer, ffi.Pointer)>>('fcvt'); - late final _fcvt = _fcvtPtr.asFunction< - ffi.Pointer Function( - double, int, ffi.Pointer, ffi.Pointer)>(); + late final _fcvtPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Double, + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ) + > + >('fcvt'); + late final _fcvt = _fcvtPtr + .asFunction< + ffi.Pointer Function( + double, + int, + ffi.Pointer, + ffi.Pointer, + ) + >(); ffi.Pointer gcvt( double arg0, int arg1, ffi.Pointer arg2, ) { - return _gcvt( - arg0, - arg1, - arg2, - ); + return _gcvt(arg0, arg1, arg2); } - late final _gcvtPtr = _lookup< - ffi.NativeFunction< + late final _gcvtPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Double, ffi.Int, ffi.Pointer)>>('gcvt'); - late final _gcvt = _gcvtPtr.asFunction< - ffi.Pointer Function(double, int, ffi.Pointer)>(); + ffi.Double, + ffi.Int, + ffi.Pointer, + ) + > + >('gcvt'); + late final _gcvt = _gcvtPtr + .asFunction< + ffi.Pointer Function(double, int, ffi.Pointer) + >(); int getsubopt( ffi.Pointer> arg0, ffi.Pointer> arg1, ffi.Pointer> arg2, ) { - return _getsubopt( - arg0, - arg1, - arg2, - ); + return _getsubopt(arg0, arg1, arg2); } - late final _getsuboptPtr = _lookup< - ffi.NativeFunction< + late final _getsuboptPtr = + _lookup< + ffi.NativeFunction< ffi.Int Function( - ffi.Pointer>, - ffi.Pointer>, - ffi.Pointer>)>>('getsubopt'); - late final _getsubopt = _getsuboptPtr.asFunction< - int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer>, + ) + > + >('getsubopt'); + late final _getsubopt = _getsuboptPtr + .asFunction< + int Function( ffi.Pointer>, ffi.Pointer>, - ffi.Pointer>)>(); + ffi.Pointer>, + ) + >(); - int grantpt( - int arg0, - ) { - return _grantpt( - arg0, - ); + int grantpt(int arg0) { + return _grantpt(arg0); } late final _grantptPtr = @@ -1331,331 +1281,296 @@ class UpdaterBindings { ffi.Pointer arg1, int __size, ) { - return _initstate( - arg0, - arg1, - __size, - ); + return _initstate(arg0, arg1, __size); } - late final _initstatePtr = _lookup< - ffi.NativeFunction< + late final _initstatePtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.UnsignedInt, ffi.Pointer, ffi.Size)>>('initstate'); - late final _initstate = _initstatePtr.asFunction< - ffi.Pointer Function(int, ffi.Pointer, int)>(); + ffi.UnsignedInt, + ffi.Pointer, + ffi.Size, + ) + > + >('initstate'); + late final _initstate = _initstatePtr + .asFunction< + ffi.Pointer Function(int, ffi.Pointer, int) + >(); - int jrand48( - ffi.Pointer arg0, - ) { - return _jrand48( - arg0, - ); + int jrand48(ffi.Pointer arg0) { + return _jrand48(arg0); } - late final _jrand48Ptr = _lookup< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer)>>('jrand48'); - late final _jrand48 = - _jrand48Ptr.asFunction)>(); + late final _jrand48Ptr = + _lookup< + ffi.NativeFunction)> + >('jrand48'); + late final _jrand48 = _jrand48Ptr + .asFunction)>(); - ffi.Pointer l64a( - int arg0, - ) { - return _l64a( - arg0, - ); + ffi.Pointer l64a(int arg0) { + return _l64a(arg0); } late final _l64aPtr = _lookup Function(ffi.Long)>>( - 'l64a'); + 'l64a', + ); late final _l64a = _l64aPtr.asFunction Function(int)>(); - void lcong48( - ffi.Pointer arg0, - ) { - return _lcong48( - arg0, - ); + void lcong48(ffi.Pointer arg0) { + return _lcong48(arg0); } - late final _lcong48Ptr = _lookup< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer)>>('lcong48'); - late final _lcong48 = - _lcong48Ptr.asFunction)>(); + late final _lcong48Ptr = + _lookup< + ffi.NativeFunction)> + >('lcong48'); + late final _lcong48 = _lcong48Ptr + .asFunction)>(); int lrand48() { return _lrand48(); } - late final _lrand48Ptr = - _lookup>('lrand48'); + late final _lrand48Ptr = _lookup>( + 'lrand48', + ); late final _lrand48 = _lrand48Ptr.asFunction(); - ffi.Pointer mktemp( - ffi.Pointer arg0, - ) { - return _mktemp( - arg0, - ); + ffi.Pointer mktemp(ffi.Pointer arg0) { + return _mktemp(arg0); } - late final _mktempPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('mktemp'); + late final _mktempPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer) + > + >('mktemp'); late final _mktemp = _mktempPtr .asFunction Function(ffi.Pointer)>(); - int mkstemp( - ffi.Pointer arg0, - ) { - return _mkstemp( - arg0, - ); + int mkstemp(ffi.Pointer arg0) { + return _mkstemp(arg0); } late final _mkstempPtr = _lookup)>>( - 'mkstemp'); - late final _mkstemp = - _mkstempPtr.asFunction)>(); + 'mkstemp', + ); + late final _mkstemp = _mkstempPtr + .asFunction)>(); int mrand48() { return _mrand48(); } - late final _mrand48Ptr = - _lookup>('mrand48'); + late final _mrand48Ptr = _lookup>( + 'mrand48', + ); late final _mrand48 = _mrand48Ptr.asFunction(); - int nrand48( - ffi.Pointer arg0, - ) { - return _nrand48( - arg0, - ); + int nrand48(ffi.Pointer arg0) { + return _nrand48(arg0); } - late final _nrand48Ptr = _lookup< - ffi.NativeFunction< - ffi.Long Function(ffi.Pointer)>>('nrand48'); - late final _nrand48 = - _nrand48Ptr.asFunction)>(); + late final _nrand48Ptr = + _lookup< + ffi.NativeFunction)> + >('nrand48'); + late final _nrand48 = _nrand48Ptr + .asFunction)>(); - int posix_openpt( - int arg0, - ) { - return _posix_openpt( - arg0, - ); + int posix_openpt(int arg0) { + return _posix_openpt(arg0); } late final _posix_openptPtr = _lookup>('posix_openpt'); late final _posix_openpt = _posix_openptPtr.asFunction(); - ffi.Pointer ptsname( - int arg0, - ) { - return _ptsname( - arg0, - ); + ffi.Pointer ptsname(int arg0) { + return _ptsname(arg0); } late final _ptsnamePtr = _lookup Function(ffi.Int)>>( - 'ptsname'); - late final _ptsname = - _ptsnamePtr.asFunction Function(int)>(); + 'ptsname', + ); + late final _ptsname = _ptsnamePtr + .asFunction Function(int)>(); - int ptsname_r( - int fildes, - ffi.Pointer buffer, - int buflen, - ) { - return _ptsname_r( - fildes, - buffer, - buflen, - ); + int ptsname_r(int fildes, ffi.Pointer buffer, int buflen) { + return _ptsname_r(fildes, buffer, buflen); } - late final _ptsname_rPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function( - ffi.Int, ffi.Pointer, ffi.Size)>>('ptsname_r'); - late final _ptsname_r = - _ptsname_rPtr.asFunction, int)>(); + late final _ptsname_rPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Int, ffi.Pointer, ffi.Size) + > + >('ptsname_r'); + late final _ptsname_r = _ptsname_rPtr + .asFunction, int)>(); - int putenv( - ffi.Pointer arg0, - ) { - return _putenv( - arg0, - ); + int putenv(ffi.Pointer arg0) { + return _putenv(arg0); } late final _putenvPtr = _lookup)>>( - 'putenv'); - late final _putenv = - _putenvPtr.asFunction)>(); + 'putenv', + ); + late final _putenv = _putenvPtr + .asFunction)>(); int random() { return _random(); } - late final _randomPtr = - _lookup>('random'); + late final _randomPtr = _lookup>( + 'random', + ); late final _random = _randomPtr.asFunction(); - int rand_r( - ffi.Pointer arg0, - ) { - return _rand_r( - arg0, - ); + int rand_r(ffi.Pointer arg0) { + return _rand_r(arg0); } - late final _rand_rPtr = _lookup< - ffi.NativeFunction)>>( - 'rand_r'); - late final _rand_r = - _rand_rPtr.asFunction)>(); + late final _rand_rPtr = + _lookup< + ffi.NativeFunction)> + >('rand_r'); + late final _rand_r = _rand_rPtr + .asFunction)>(); ffi.Pointer realpath( ffi.Pointer arg0, ffi.Pointer arg1, ) { - return _realpath( - arg0, - arg1, - ); + return _realpath(arg0, arg1); } - late final _realpathPtr = _lookup< - ffi.NativeFunction< + late final _realpathPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>>('realpath'); - late final _realpath = _realpathPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer, + ffi.Pointer, + ) + > + >('realpath'); + late final _realpath = _realpathPtr + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); - ffi.Pointer seed48( - ffi.Pointer arg0, - ) { - return _seed48( - arg0, - ); + ffi.Pointer seed48(ffi.Pointer arg0) { + return _seed48(arg0); } - late final _seed48Ptr = _lookup< - ffi.NativeFunction< + late final _seed48Ptr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer)>>('seed48'); - late final _seed48 = _seed48Ptr.asFunction< - ffi.Pointer Function( - ffi.Pointer)>(); + ffi.Pointer, + ) + > + >('seed48'); + late final _seed48 = _seed48Ptr + .asFunction< + ffi.Pointer Function(ffi.Pointer) + >(); int setenv( ffi.Pointer __name, ffi.Pointer __value, int __overwrite, ) { - return _setenv( - __name, - __value, - __overwrite, - ); + return _setenv(__name, __value, __overwrite); } - late final _setenvPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Int)>>('setenv'); - late final _setenv = _setenvPtr.asFunction< - int Function(ffi.Pointer, ffi.Pointer, int)>(); + late final _setenvPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int, + ) + > + >('setenv'); + late final _setenv = _setenvPtr + .asFunction< + int Function(ffi.Pointer, ffi.Pointer, int) + >(); - void setkey( - ffi.Pointer arg0, - ) { - return _setkey( - arg0, - ); + void setkey(ffi.Pointer arg0) { + return _setkey(arg0); } late final _setkeyPtr = _lookup)>>( - 'setkey'); - late final _setkey = - _setkeyPtr.asFunction)>(); + 'setkey', + ); + late final _setkey = _setkeyPtr + .asFunction)>(); - ffi.Pointer setstate( - ffi.Pointer arg0, - ) { - return _setstate( - arg0, - ); + ffi.Pointer setstate(ffi.Pointer arg0) { + return _setstate(arg0); } - late final _setstatePtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer)>>('setstate'); + late final _setstatePtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer) + > + >('setstate'); late final _setstate = _setstatePtr .asFunction Function(ffi.Pointer)>(); - void srand48( - int arg0, - ) { - return _srand48( - arg0, - ); + void srand48(int arg0) { + return _srand48(arg0); } late final _srand48Ptr = _lookup>('srand48'); late final _srand48 = _srand48Ptr.asFunction(); - void srandom( - int arg0, - ) { - return _srandom( - arg0, - ); + void srandom(int arg0) { + return _srandom(arg0); } late final _srandomPtr = _lookup>( - 'srandom'); + 'srandom', + ); late final _srandom = _srandomPtr.asFunction(); - int unlockpt( - int arg0, - ) { - return _unlockpt( - arg0, - ); + int unlockpt(int arg0) { + return _unlockpt(arg0); } late final _unlockptPtr = _lookup>('unlockpt'); late final _unlockpt = _unlockptPtr.asFunction(); - int unsetenv( - ffi.Pointer arg0, - ) { - return _unsetenv( - arg0, - ); + int unsetenv(ffi.Pointer arg0) { + return _unsetenv(arg0); } late final _unsetenvPtr = _lookup)>>( - 'unsetenv'); - late final _unsetenv = - _unsetenvPtr.asFunction)>(); + 'unsetenv', + ); + late final _unsetenv = _unsetenvPtr + .asFunction)>(); int arc4random() { return _arc4random(); @@ -1665,37 +1580,27 @@ class UpdaterBindings { _lookup>('arc4random'); late final _arc4random = _arc4randomPtr.asFunction(); - void arc4random_addrandom( - ffi.Pointer arg0, - int __datlen, - ) { - return _arc4random_addrandom( - arg0, - __datlen, - ); + void arc4random_addrandom(ffi.Pointer arg0, int __datlen) { + return _arc4random_addrandom(arg0, __datlen); } - late final _arc4random_addrandomPtr = _lookup< - ffi.NativeFunction< - ffi.Void Function( - ffi.Pointer, ffi.Int)>>('arc4random_addrandom'); + late final _arc4random_addrandomPtr = + _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Int) + > + >('arc4random_addrandom'); late final _arc4random_addrandom = _arc4random_addrandomPtr .asFunction, int)>(); - void arc4random_buf( - ffi.Pointer __buf, - int __nbytes, - ) { - return _arc4random_buf( - __buf, - __nbytes, - ); + void arc4random_buf(ffi.Pointer __buf, int __nbytes) { + return _arc4random_buf(__buf, __nbytes); } - late final _arc4random_bufPtr = _lookup< - ffi - .NativeFunction, ffi.Size)>>( - 'arc4random_buf'); + late final _arc4random_bufPtr = + _lookup< + ffi.NativeFunction, ffi.Size)> + >('arc4random_buf'); late final _arc4random_buf = _arc4random_bufPtr .asFunction, int)>(); @@ -1705,49 +1610,54 @@ class UpdaterBindings { late final _arc4random_stirPtr = _lookup>('arc4random_stir'); - late final _arc4random_stir = - _arc4random_stirPtr.asFunction(); + late final _arc4random_stir = _arc4random_stirPtr + .asFunction(); - int arc4random_uniform( - int __upper_bound, - ) { - return _arc4random_uniform( - __upper_bound, - ); + int arc4random_uniform(int __upper_bound) { + return _arc4random_uniform(__upper_bound); } late final _arc4random_uniformPtr = _lookup>( - 'arc4random_uniform'); - late final _arc4random_uniform = - _arc4random_uniformPtr.asFunction(); + 'arc4random_uniform', + ); + late final _arc4random_uniform = _arc4random_uniformPtr + .asFunction(); ffi.Pointer cgetcap( ffi.Pointer arg0, ffi.Pointer arg1, int arg2, ) { - return _cgetcap( - arg0, - arg1, - arg2, - ); + return _cgetcap(arg0, arg1, arg2); } - late final _cgetcapPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function(ffi.Pointer, - ffi.Pointer, ffi.Int)>>('cgetcap'); - late final _cgetcap = _cgetcapPtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer, int)>(); + late final _cgetcapPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Int, + ) + > + >('cgetcap'); + late final _cgetcap = _cgetcapPtr + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + ) + >(); int cgetclose() { return _cgetclose(); } - late final _cgetclosePtr = - _lookup>('cgetclose'); + late final _cgetclosePtr = _lookup>( + 'cgetclose', + ); late final _cgetclose = _cgetclosePtr.asFunction(); int cgetent( @@ -1755,55 +1665,62 @@ class UpdaterBindings { ffi.Pointer> arg1, ffi.Pointer arg2, ) { - return _cgetent( - arg0, - arg1, - arg2, - ); + return _cgetent(arg0, arg1, arg2); } - late final _cgetentPtr = _lookup< - ffi.NativeFunction< + late final _cgetentPtr = + _lookup< + ffi.NativeFunction< ffi.Int Function( - ffi.Pointer>, - ffi.Pointer>, - ffi.Pointer)>>('cgetent'); - late final _cgetent = _cgetentPtr.asFunction< - int Function(ffi.Pointer>, - ffi.Pointer>, ffi.Pointer)>(); + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer, + ) + > + >('cgetent'); + late final _cgetent = _cgetentPtr + .asFunction< + int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer, + ) + >(); int cgetfirst( ffi.Pointer> arg0, ffi.Pointer> arg1, ) { - return _cgetfirst( - arg0, - arg1, - ); + return _cgetfirst(arg0, arg1); } - late final _cgetfirstPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer>, - ffi.Pointer>)>>('cgetfirst'); - late final _cgetfirst = _cgetfirstPtr.asFunction< - int Function(ffi.Pointer>, - ffi.Pointer>)>(); - - int cgetmatch( - ffi.Pointer arg0, - ffi.Pointer arg1, - ) { - return _cgetmatch( - arg0, - arg1, - ); - } - - late final _cgetmatchPtr = _lookup< - ffi.NativeFunction< + late final _cgetfirstPtr = + _lookup< + ffi.NativeFunction< ffi.Int Function( - ffi.Pointer, ffi.Pointer)>>('cgetmatch'); + ffi.Pointer>, + ffi.Pointer>, + ) + > + >('cgetfirst'); + late final _cgetfirst = _cgetfirstPtr + .asFunction< + int Function( + ffi.Pointer>, + ffi.Pointer>, + ) + >(); + + int cgetmatch(ffi.Pointer arg0, ffi.Pointer arg1) { + return _cgetmatch(arg0, arg1); + } + + late final _cgetmatchPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >('cgetmatch'); late final _cgetmatch = _cgetmatchPtr .asFunction, ffi.Pointer)>(); @@ -1811,123 +1728,136 @@ class UpdaterBindings { ffi.Pointer> arg0, ffi.Pointer> arg1, ) { - return _cgetnext( - arg0, - arg1, - ); + return _cgetnext(arg0, arg1); } - late final _cgetnextPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer>, - ffi.Pointer>)>>('cgetnext'); - late final _cgetnext = _cgetnextPtr.asFunction< - int Function(ffi.Pointer>, - ffi.Pointer>)>(); + late final _cgetnextPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Pointer>, + ) + > + >('cgetnext'); + late final _cgetnext = _cgetnextPtr + .asFunction< + int Function( + ffi.Pointer>, + ffi.Pointer>, + ) + >(); int cgetnum( ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer arg2, ) { - return _cgetnum( - arg0, - arg1, - arg2, - ); + return _cgetnum(arg0, arg1, arg2); } - late final _cgetnumPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>('cgetnum'); - late final _cgetnum = _cgetnumPtr.asFunction< - int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>(); + late final _cgetnumPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >('cgetnum'); + late final _cgetnum = _cgetnumPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + >(); - int cgetset( - ffi.Pointer arg0, - ) { - return _cgetset( - arg0, - ); + int cgetset(ffi.Pointer arg0) { + return _cgetset(arg0); } late final _cgetsetPtr = _lookup)>>( - 'cgetset'); - late final _cgetset = - _cgetsetPtr.asFunction)>(); + 'cgetset', + ); + late final _cgetset = _cgetsetPtr + .asFunction)>(); int cgetstr( ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, ) { - return _cgetstr( - arg0, - arg1, - arg2, - ); + return _cgetstr(arg0, arg1, arg2); } - late final _cgetstrPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>>('cgetstr'); - late final _cgetstr = _cgetstrPtr.asFunction< - int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>(); + late final _cgetstrPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ) + > + >('cgetstr'); + late final _cgetstr = _cgetstrPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ) + >(); int cgetustr( ffi.Pointer arg0, ffi.Pointer arg1, ffi.Pointer> arg2, ) { - return _cgetustr( - arg0, - arg1, - arg2, - ); + return _cgetustr(arg0, arg1, arg2); } - late final _cgetustrPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>>('cgetustr'); - late final _cgetustr = _cgetustrPtr.asFunction< - int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer>)>(); + late final _cgetustrPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ) + > + >('cgetustr'); + late final _cgetustr = _cgetustrPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer>, + ) + >(); - int daemon( - int arg0, - int arg1, - ) { - return _daemon( - arg0, - arg1, - ); + int daemon(int arg0, int arg1) { + return _daemon(arg0, arg1); } late final _daemonPtr = _lookup>('daemon'); late final _daemon = _daemonPtr.asFunction(); - ffi.Pointer devname( - int arg0, - int arg1, - ) { - return _devname( - arg0, - arg1, - ); + ffi.Pointer devname(int arg0, int arg1) { + return _devname(arg0, arg1); } - late final _devnamePtr = _lookup< - ffi.NativeFunction Function(dev_t, mode_t)>>( - 'devname'); - late final _devname = - _devnamePtr.asFunction Function(int, int)>(); + late final _devnamePtr = + _lookup< + ffi.NativeFunction Function(dev_t, mode_t)> + >('devname'); + late final _devname = _devnamePtr + .asFunction Function(int, int)>(); ffi.Pointer devname_r( int arg0, @@ -1935,54 +1865,59 @@ class UpdaterBindings { ffi.Pointer buf, int len, ) { - return _devname_r( - arg0, - arg1, - buf, - len, - ); + return _devname_r(arg0, arg1, buf, len); } - late final _devname_rPtr = _lookup< - ffi.NativeFunction< + late final _devname_rPtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - dev_t, mode_t, ffi.Pointer, ffi.Int)>>('devname_r'); - late final _devname_r = _devname_rPtr.asFunction< - ffi.Pointer Function(int, int, ffi.Pointer, int)>(); + dev_t, + mode_t, + ffi.Pointer, + ffi.Int, + ) + > + >('devname_r'); + late final _devname_r = _devname_rPtr + .asFunction< + ffi.Pointer Function(int, int, ffi.Pointer, int) + >(); ffi.Pointer getbsize( ffi.Pointer arg0, ffi.Pointer arg1, ) { - return _getbsize( - arg0, - arg1, - ); + return _getbsize(arg0, arg1); } - late final _getbsizePtr = _lookup< - ffi.NativeFunction< + late final _getbsizePtr = + _lookup< + ffi.NativeFunction< ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>>('getbsize'); - late final _getbsize = _getbsizePtr.asFunction< - ffi.Pointer Function( - ffi.Pointer, ffi.Pointer)>(); + ffi.Pointer, + ffi.Pointer, + ) + > + >('getbsize'); + late final _getbsize = _getbsizePtr + .asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ) + >(); - int getloadavg( - ffi.Pointer arg0, - int __nelem, - ) { - return _getloadavg( - arg0, - __nelem, - ); + int getloadavg(ffi.Pointer arg0, int __nelem) { + return _getloadavg(arg0, __nelem); } - late final _getloadavgPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Int)>>('getloadavg'); - late final _getloadavg = - _getloadavgPtr.asFunction, int)>(); + late final _getloadavgPtr = + _lookup< + ffi.NativeFunction, ffi.Int)> + >('getloadavg'); + late final _getloadavg = _getloadavgPtr + .asFunction, int)>(); ffi.Pointer getprogname() { return _getprogname(); @@ -1990,134 +1925,150 @@ class UpdaterBindings { late final _getprognamePtr = _lookup Function()>>( - 'getprogname'); - late final _getprogname = - _getprognamePtr.asFunction Function()>(); + 'getprogname', + ); + late final _getprogname = _getprognamePtr + .asFunction Function()>(); - void setprogname( - ffi.Pointer arg0, - ) { - return _setprogname( - arg0, - ); + void setprogname(ffi.Pointer arg0) { + return _setprogname(arg0); } late final _setprognamePtr = _lookup)>>( - 'setprogname'); - late final _setprogname = - _setprognamePtr.asFunction)>(); + 'setprogname', + ); + late final _setprogname = _setprognamePtr + .asFunction)>(); int heapsort( ffi.Pointer __base, int __nel, int __width, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer)>> - __compar, + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + > + __compar, ) { - return _heapsort( - __base, - __nel, - __width, - __compar, - ); + return _heapsort(__base, __nel, __width, __compar); } - late final _heapsortPtr = _lookup< - ffi.NativeFunction< + late final _heapsortPtr = + _lookup< + ffi.NativeFunction< ffi.Int Function( - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>)>>('heapsort'); - late final _heapsort = _heapsortPtr.asFunction< - int Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + > + >('heapsort'); + late final _heapsort = _heapsortPtr + .asFunction< + int Function( ffi.Pointer, int, int, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer, ffi.Pointer)>>)>(); + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + >(); int mergesort( ffi.Pointer __base, int __nel, int __width, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer)>> - __compar, + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + > + __compar, ) { - return _mergesort( - __base, - __nel, - __width, - __compar, - ); + return _mergesort(__base, __nel, __width, __compar); } - late final _mergesortPtr = _lookup< - ffi.NativeFunction< + late final _mergesortPtr = + _lookup< + ffi.NativeFunction< ffi.Int Function( - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>)>>('mergesort'); - late final _mergesort = _mergesortPtr.asFunction< - int Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + > + >('mergesort'); + late final _mergesort = _mergesortPtr + .asFunction< + int Function( ffi.Pointer, int, int, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer, ffi.Pointer)>>)>(); + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + >(); void psort( ffi.Pointer __base, int __nel, int __width, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer)>> - __compar, + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + > + __compar, ) { - return _psort( - __base, - __nel, - __width, - __compar, - ); + return _psort(__base, __nel, __width, __compar); } - late final _psortPtr = _lookup< - ffi.NativeFunction< + late final _psortPtr = + _lookup< + ffi.NativeFunction< ffi.Void Function( - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, - ffi.Pointer)>>)>>('psort'); - late final _psort = _psortPtr.asFunction< - void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + > + >('psort'); + late final _psort = _psortPtr + .asFunction< + void Function( ffi.Pointer, int, int, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer, ffi.Pointer)>>)>(); + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer) + > + >, + ) + >(); void psort_r( ffi.Pointer __base, @@ -2125,43 +2076,57 @@ class UpdaterBindings { int __width, ffi.Pointer arg3, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>> - __compar, + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + > + __compar, ) { - return _psort_r( - __base, - __nel, - __width, - arg3, - __compar, - ); + return _psort_r(__base, __nel, __width, arg3, __compar); } - late final _psort_rPtr = _lookup< - ffi.NativeFunction< + late final _psort_rPtr = + _lookup< + ffi.NativeFunction< ffi.Void Function( - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>)>>('psort_r'); - late final _psort_r = _psort_rPtr.asFunction< - void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >, + ) + > + >('psort_r'); + late final _psort_r = _psort_rPtr + .asFunction< + void Function( ffi.Pointer, int, int, ffi.Pointer, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>)>(); + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >, + ) + >(); void qsort_r( ffi.Pointer __base, @@ -2169,43 +2134,57 @@ class UpdaterBindings { int __width, ffi.Pointer arg3, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>> - __compar, + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + > + __compar, ) { - return _qsort_r( - __base, - __nel, - __width, - arg3, - __compar, - ); + return _qsort_r(__base, __nel, __width, arg3, __compar); } - late final _qsort_rPtr = _lookup< - ffi.NativeFunction< + late final _qsort_rPtr = + _lookup< + ffi.NativeFunction< ffi.Void Function( - ffi.Pointer, - ffi.Size, - ffi.Size, - ffi.Pointer, - ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function( - ffi.Pointer, - ffi.Pointer, - ffi.Pointer)>>)>>('qsort_r'); - late final _qsort_r = _qsort_rPtr.asFunction< - void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >, + ) + > + >('qsort_r'); + late final _qsort_r = _qsort_rPtr + .asFunction< + void Function( ffi.Pointer, int, int, ffi.Pointer, ffi.Pointer< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>)>(); + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer, + ) + > + >, + ) + >(); int radixsort( ffi.Pointer> __base, @@ -2213,35 +2192,40 @@ class UpdaterBindings { ffi.Pointer __table, int __endbyte, ) { - return _radixsort( - __base, - __nel, - __table, - __endbyte, - ); + return _radixsort(__base, __nel, __table, __endbyte); } - late final _radixsortPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer>, ffi.Int, - ffi.Pointer, ffi.UnsignedInt)>>('radixsort'); - late final _radixsort = _radixsortPtr.asFunction< - int Function(ffi.Pointer>, int, - ffi.Pointer, int)>(); + late final _radixsortPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Int, + ffi.Pointer, + ffi.UnsignedInt, + ) + > + >('radixsort'); + late final _radixsort = _radixsortPtr + .asFunction< + int Function( + ffi.Pointer>, + int, + ffi.Pointer, + int, + ) + >(); - int rpmatch( - ffi.Pointer arg0, - ) { - return _rpmatch( - arg0, - ); + int rpmatch(ffi.Pointer arg0) { + return _rpmatch(arg0); } late final _rpmatchPtr = _lookup)>>( - 'rpmatch'); - late final _rpmatch = - _rpmatchPtr.asFunction)>(); + 'rpmatch', + ); + late final _rpmatch = _rpmatchPtr + .asFunction)>(); int sradixsort( ffi.Pointer> __base, @@ -2249,36 +2233,46 @@ class UpdaterBindings { ffi.Pointer __table, int __endbyte, ) { - return _sradixsort( - __base, - __nel, - __table, - __endbyte, - ); + return _sradixsort(__base, __nel, __table, __endbyte); } - late final _sradixsortPtr = _lookup< - ffi.NativeFunction< - ffi.Int Function(ffi.Pointer>, ffi.Int, - ffi.Pointer, ffi.UnsignedInt)>>('sradixsort'); - late final _sradixsort = _sradixsortPtr.asFunction< - int Function(ffi.Pointer>, int, - ffi.Pointer, int)>(); + late final _sradixsortPtr = + _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Int, + ffi.Pointer, + ffi.UnsignedInt, + ) + > + >('sradixsort'); + late final _sradixsort = _sradixsortPtr + .asFunction< + int Function( + ffi.Pointer>, + int, + ffi.Pointer, + int, + ) + >(); void sranddev() { return _sranddev(); } - late final _sranddevPtr = - _lookup>('sranddev'); + late final _sranddevPtr = _lookup>( + 'sranddev', + ); late final _sranddev = _sranddevPtr.asFunction(); void srandomdev() { return _srandomdev(); } - late final _srandomdevPtr = - _lookup>('srandomdev'); + late final _srandomdevPtr = _lookup>( + 'srandomdev', + ); late final _srandomdev = _srandomdevPtr.asFunction(); int strtonum( @@ -2287,61 +2281,83 @@ class UpdaterBindings { int __maxval, ffi.Pointer> __errstrp, ) { - return _strtonum( - __numstr, - __minval, - __maxval, - __errstrp, - ); + return _strtonum(__numstr, __minval, __maxval, __errstrp); } - late final _strtonumPtr = _lookup< - ffi.NativeFunction< - ffi.LongLong Function(ffi.Pointer, ffi.LongLong, - ffi.LongLong, ffi.Pointer>)>>('strtonum'); - late final _strtonum = _strtonumPtr.asFunction< - int Function(ffi.Pointer, int, int, - ffi.Pointer>)>(); + late final _strtonumPtr = + _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, + ffi.LongLong, + ffi.LongLong, + ffi.Pointer>, + ) + > + >('strtonum'); + late final _strtonum = _strtonumPtr + .asFunction< + int Function( + ffi.Pointer, + int, + int, + ffi.Pointer>, + ) + >(); int strtoq( ffi.Pointer __str, ffi.Pointer> __endptr, int __base, ) { - return _strtoq( - __str, - __endptr, - __base, - ); + return _strtoq(__str, __endptr, __base); } - late final _strtoqPtr = _lookup< - ffi.NativeFunction< - ffi.LongLong Function(ffi.Pointer, - ffi.Pointer>, ffi.Int)>>('strtoq'); - late final _strtoq = _strtoqPtr.asFunction< - int Function( - ffi.Pointer, ffi.Pointer>, int)>(); + late final _strtoqPtr = + _lookup< + ffi.NativeFunction< + ffi.LongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + ) + > + >('strtoq'); + late final _strtoq = _strtoqPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer>, + int, + ) + >(); int strtouq( ffi.Pointer __str, ffi.Pointer> __endptr, int __base, ) { - return _strtouq( - __str, - __endptr, - __base, - ); + return _strtouq(__str, __endptr, __base); } - late final _strtouqPtr = _lookup< - ffi.NativeFunction< - ffi.UnsignedLongLong Function(ffi.Pointer, - ffi.Pointer>, ffi.Int)>>('strtouq'); - late final _strtouq = _strtouqPtr.asFunction< - int Function( - ffi.Pointer, ffi.Pointer>, int)>(); + late final _strtouqPtr = + _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function( + ffi.Pointer, + ffi.Pointer>, + ffi.Int, + ) + > + >('strtouq'); + late final _strtouq = _strtouqPtr + .asFunction< + int Function( + ffi.Pointer, + ffi.Pointer>, + int, + ) + >(); late final ffi.Pointer> _suboptarg = _lookup>('suboptarg'); @@ -2361,7 +2377,8 @@ class UpdaterBindings { late final _shorebird_current_boot_patch_numberPtr = _lookup>( - 'shorebird_current_boot_patch_number'); + 'shorebird_current_boot_patch_number', + ); late final _shorebird_current_boot_patch_number = _shorebird_current_boot_patch_numberPtr.asFunction(); @@ -2373,7 +2390,8 @@ class UpdaterBindings { late final _shorebird_next_boot_patch_numberPtr = _lookup>( - 'shorebird_next_boot_patch_number'); + 'shorebird_next_boot_patch_number', + ); late final _shorebird_next_boot_patch_number = _shorebird_next_boot_patch_numberPtr.asFunction(); @@ -2386,18 +2404,33 @@ class UpdaterBindings { bool shorebird_check_for_downloadable_update( ffi.Pointer c_channel, ) { - return _shorebird_check_for_downloadable_update( - c_channel, - ); + return _shorebird_check_for_downloadable_update(c_channel); } late final _shorebird_check_for_downloadable_updatePtr = _lookup)>>( - 'shorebird_check_for_downloadable_update'); + 'shorebird_check_for_downloadable_update', + ); late final _shorebird_check_for_downloadable_update = _shorebird_check_for_downloadable_updatePtr .asFunction)>(); + /// Overrides the generated random per-install device/client id used in patch + /// check requests. This is for applications that need to bind patch delivery + /// to their own stable account/device identifier. The updater persists this + /// value in state.json after a successful call. + bool shorebird_set_device_id_override(ffi.Pointer c_device_id) { + return _shorebird_set_device_id_override(c_device_id); + } + + late final _shorebird_set_device_id_overridePtr = + _lookup)>>( + 'shorebird_set_device_id_override', + ); + late final _shorebird_set_device_id_override = + _shorebird_set_device_id_overridePtr + .asFunction)>(); + /// Synchronously download an update on the first non-null channel of: /// 1. `c_channel` /// 2. The channel specified in shorebird.yaml @@ -2407,15 +2440,15 @@ class UpdaterBindings { ffi.Pointer shorebird_update_with_result( ffi.Pointer c_channel, ) { - return _shorebird_update_with_result( - c_channel, - ); + return _shorebird_update_with_result(c_channel); } - late final _shorebird_update_with_resultPtr = _lookup< - ffi.NativeFunction< - ffi.Pointer Function( - ffi.Pointer)>>('shorebird_update_with_result'); + late final _shorebird_update_with_resultPtr = + _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer) + > + >('shorebird_update_with_result'); late final _shorebird_update_with_result = _shorebird_update_with_resultPtr .asFunction Function(ffi.Pointer)>(); @@ -2427,17 +2460,14 @@ class UpdaterBindings { /// /// `result` must be a valid pointer returned by `shorebird_update_with_result`, /// or null (in which case this is a no-op). - void shorebird_free_update_result( - ffi.Pointer result, - ) { - return _shorebird_free_update_result( - result, - ); + void shorebird_free_update_result(ffi.Pointer result) { + return _shorebird_free_update_result(result); } late final _shorebird_free_update_resultPtr = _lookup)>>( - 'shorebird_free_update_result'); + 'shorebird_free_update_result', + ); late final _shorebird_free_update_result = _shorebird_free_update_resultPtr .asFunction)>(); } @@ -2548,9 +2578,10 @@ typedef __darwin_uid_t = __uint32_t; typedef __darwin_useconds_t = __uint32_t; final class __darwin_pthread_handler_rec extends ffi.Struct { - external ffi - .Pointer)>> - __routine; + external ffi.Pointer< + ffi.NativeFunction)> + > + __routine; external ffi.Pointer __arg; @@ -2661,11 +2692,11 @@ enum idtype_t { const idtype_t(this.value); static idtype_t fromValue(int value) => switch (value) { - 0 => P_ALL, - 1 => P_PID, - 2 => P_PGID, - _ => throw ArgumentError('Unknown value for idtype_t: $value'), - }; + 0 => P_ALL, + 1 => P_PID, + 2 => P_PGID, + _ => throw ArgumentError('Unknown value for idtype_t: $value'), + }; } typedef pid_t = __darwin_pid_t; @@ -2929,7 +2960,7 @@ final class sigevent extends ffi.Struct { external sigval sigev_value; external ffi.Pointer> - sigev_notify_function; + sigev_notify_function; external ffi.Pointer sigev_notify_attributes; } @@ -2968,22 +2999,31 @@ typedef siginfo_t = __siginfo; final class __sigaction_u extends ffi.Union { external ffi.Pointer> - __sa_handler; + __sa_handler; external ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function( - ffi.Int, ffi.Pointer<__siginfo>, ffi.Pointer)>> - __sa_sigaction; + ffi.NativeFunction< + ffi.Void Function(ffi.Int, ffi.Pointer<__siginfo>, ffi.Pointer) + > + > + __sa_sigaction; } final class __sigaction extends ffi.Struct { external __sigaction_u __sigaction_u$1; external ffi.Pointer< - ffi.NativeFunction< - ffi.Void Function(ffi.Pointer, ffi.Int, ffi.Int, - ffi.Pointer, ffi.Pointer)>> sa_tramp; + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Int, + ffi.Int, + ffi.Pointer, + ffi.Pointer, + ) + > + > + sa_tramp; @sigset_t() external int sa_mask; @@ -3008,7 +3048,7 @@ typedef sig_t = ffi.Pointer>; final class sigvec extends ffi.Struct { external ffi.Pointer> - sv_handler; + sv_handler; @ffi.Int() external int sv_mask; diff --git a/shorebird_code_push/lib/src/shorebird_updater.dart b/shorebird_code_push/lib/src/shorebird_updater.dart index dd46b2f..7a4b734 100644 --- a/shorebird_code_push/lib/src/shorebird_updater.dart +++ b/shorebird_code_push/lib/src/shorebird_updater.dart @@ -127,6 +127,16 @@ abstract class ShorebirdUpdater { /// Throws a [ReadPatchException] if the read is unsuccessful. Future readNextPatch(); + /// Overrides the generated random per-install device id used in patch + /// checks. Call this before [checkForUpdate] or [update] if your server + /// needs patch delivery bound to an app/account-specific identifier. + /// + /// The updater persists the override in its local state after a successful + /// call. The value should be stable for this installation/account and must + /// not contain sensitive secrets; it is sent to the update server as + /// `client_id`. + Future setDeviceIdOverride(String deviceId); + /// Checks for an available patch on [track] (or [UpdateTrack.stable] if no /// track is specified) and returns the [UpdateStatus]. /// This method should be used to determine the update status before calling diff --git a/shorebird_code_push/lib/src/shorebird_updater_io.dart b/shorebird_code_push/lib/src/shorebird_updater_io.dart index 52e03fa..359511d 100644 --- a/shorebird_code_push/lib/src/shorebird_updater_io.dart +++ b/shorebird_code_push/lib/src/shorebird_updater_io.dart @@ -9,12 +9,9 @@ import 'package:shorebird_code_push/src/shorebird_updater.dart'; import 'package:shorebird_code_push/src/updater.dart'; @visibleForTesting - /// Type definition for [Isolate.run]. -typedef IsolateRun = Future Function( - FutureOr Function(), { - String? debugName, -}); +typedef IsolateRun = + Future Function(FutureOr Function(), {String? debugName}); /// {@template shorebird_updater_io} /// The Shorebird IO Updater. @@ -22,8 +19,8 @@ typedef IsolateRun = Future Function( class ShorebirdUpdaterImpl implements ShorebirdUpdater { /// {@macro shorebird_updater_io} ShorebirdUpdaterImpl({Updater? updater, IsolateRun? run}) - : _updater = updater ?? const Updater(), - _run = run ?? Isolate.run { + : _updater = updater ?? const Updater(), + _run = run ?? Isolate.run { try { // If the Shorebird Engine is not available, this will throw an exception. // FIXME: Run this in an isolate or refactor the updater to avoid risking @@ -55,18 +52,25 @@ class ShorebirdUpdaterImpl implements ShorebirdUpdater { @override Future readNextPatch() => _readPatch(_updater.nextPatchNumber); + @override + Future setDeviceIdOverride(String deviceId) async { + if (!_isAvailable) return; + final didSet = await _run(() => _updater.setDeviceIdOverride(deviceId)); + if (!didSet) { + throw StateError('Unable to set Shorebird device id override.'); + } + } + Future _readPatch(int Function() fn) async { if (!_isAvailable) return null; - return _run( - () { - try { - final patchNumber = fn(); - return patchNumber > 0 ? Patch(number: patchNumber) : null; - } catch (error) { - throw ReadPatchException(message: '$error'); - } - }, - ); + return _run(() { + try { + final patchNumber = fn(); + return patchNumber > 0 ? Patch(number: patchNumber) : null; + } catch (error) { + throw ReadPatchException(message: '$error'); + } + }); } @override @@ -74,8 +78,9 @@ class ShorebirdUpdaterImpl implements ShorebirdUpdater { if (!_isAvailable) return UpdateStatus.unavailable; // First, check to see whether an update is available for download. - final isUpdateAvailable = - await _run(() => _updater.checkForDownloadableUpdate(track: track)); + final isUpdateAvailable = await _run( + () => _updater.checkForDownloadableUpdate(track: track), + ); if (isUpdateAvailable) return UpdateStatus.outdated; // If no new update is available for download, see if a new patch exists diff --git a/shorebird_code_push/lib/src/shorebird_updater_web.dart b/shorebird_code_push/lib/src/shorebird_updater_web.dart index 509e3b2..cdb2313 100644 --- a/shorebird_code_push/lib/src/shorebird_updater_web.dart +++ b/shorebird_code_push/lib/src/shorebird_updater_web.dart @@ -18,6 +18,9 @@ class ShorebirdUpdaterImpl implements ShorebirdUpdater { @override Future readNextPatch() async => null; + @override + Future setDeviceIdOverride(String deviceId) async {} + @override Future checkForUpdate({UpdateTrack? track}) async => UpdateStatus.unavailable; diff --git a/shorebird_code_push/lib/src/updater.dart b/shorebird_code_push/lib/src/updater.dart index 7857394..2d534b0 100644 --- a/shorebird_code_push/lib/src/updater.dart +++ b/shorebird_code_push/lib/src/updater.dart @@ -16,8 +16,9 @@ class Updater { /// The ffi bindings to the Updater library. @visibleForTesting - static UpdaterBindings bindings = - UpdaterBindings(ffi.DynamicLibrary.process()); + static UpdaterBindings bindings = UpdaterBindings( + ffi.DynamicLibrary.process(), + ); /// The currently active patch number. int currentPatchNumber() => bindings.shorebird_current_boot_patch_number(); @@ -32,6 +33,18 @@ class Updater { track == null ? ffi.nullptr : track.name.toNativeUtf8().cast(), ); + /// Overrides the generated per-install device id sent in patch checks. + bool setDeviceIdOverride(String deviceId) { + final nativeDeviceId = deviceId.toNativeUtf8(); + try { + return bindings.shorebird_set_device_id_override( + nativeDeviceId.cast(), + ); + } finally { + malloc.free(nativeDeviceId); + } + } + /// Downloads the latest patch, if available and returns an [UpdateResult] /// to indicate whether the update was successful. Pointer update({UpdateTrack? track}) => diff --git a/shorebird_code_push/test/src/shorebird_updater_io_test.dart b/shorebird_code_push/test/src/shorebird_updater_io_test.dart index 45462f0..ea2139c 100644 --- a/shorebird_code_push/test/src/shorebird_updater_io_test.dart +++ b/shorebird_code_push/test/src/shorebird_updater_io_test.dart @@ -118,11 +118,7 @@ void main() { await expectLater( shorebirdUpdater.readNextPatch(), completion( - isA().having( - (p) => p.number, - 'number', - nextPatchNumber, - ), + isA().having((p) => p.number, 'number', nextPatchNumber), ), ); }); @@ -151,11 +147,7 @@ void main() { await expectLater( shorebirdUpdater.readNextPatch(), completion( - isA().having( - (p) => p.number, - 'number', - nextPatchNumber, - ), + isA().having((p) => p.number, 'number', nextPatchNumber), ), ); }); @@ -186,11 +178,7 @@ void main() { await expectLater( shorebirdUpdater.readNextPatch(), completion( - isA().having( - (p) => p.number, - 'number', - nextPatchNumber, - ), + isA().having((p) => p.number, 'number', nextPatchNumber), ), ); }); @@ -221,6 +209,61 @@ void main() { }); }); + group('setDeviceIdOverride', () { + group('when updater is unavailable', () { + setUp(() { + when(updater.currentPatchNumber).thenThrow(Exception('oops')); + }); + + test( + 'does nothing', + overridePrint((_) async { + shorebirdUpdater = ShorebirdUpdaterImpl(updater: updater, run: run); + await expectLater( + shorebirdUpdater.setDeviceIdOverride('developer-device-id'), + completes, + ); + verifyNever(() => updater.setDeviceIdOverride(any())); + }), + ); + }); + + group('when updater accepts the override', () { + setUp(() { + when(updater.currentPatchNumber).thenReturn(0); + when( + () => updater.setDeviceIdOverride('developer-device-id'), + ).thenReturn(true); + shorebirdUpdater = ShorebirdUpdaterImpl(updater: updater, run: run); + }); + + test('forwards the device id to the updater', () async { + await expectLater( + shorebirdUpdater.setDeviceIdOverride('developer-device-id'), + completes, + ); + verify( + () => updater.setDeviceIdOverride('developer-device-id'), + ).called(1); + }); + }); + + group('when updater rejects the override', () { + setUp(() { + when(updater.currentPatchNumber).thenReturn(0); + when(() => updater.setDeviceIdOverride('')).thenReturn(false); + shorebirdUpdater = ShorebirdUpdaterImpl(updater: updater, run: run); + }); + + test('throws a StateError', () async { + await expectLater( + shorebirdUpdater.setDeviceIdOverride(''), + throwsA(isA()), + ); + }); + }); + }); + group('checkForUpdate', () { group('when updater is unavailable', () { setUp(() { @@ -304,7 +347,7 @@ void main() { group('when current patch has been rolled back', () { setUp(() { - // The app is currently running patch 1, but checkForDownloadableUpdate + // The app is running patch 1, but checkForDownloadableUpdate // triggered a rollback which set next_boot_patch to None (0). when(updater.currentPatchNumber).thenReturn(1); when(updater.nextPatchNumber).thenReturn(0); @@ -331,15 +374,18 @@ void main() { shorebirdUpdater = ShorebirdUpdaterImpl(updater: updater, run: run); }); - test('forwards the provided track to the underlying updater call', - () async { - await expectLater( - shorebirdUpdater.checkForUpdate(track: track), - completion(equals(UpdateStatus.outdated)), - ); - verify(() => updater.checkForDownloadableUpdate(track: track)) - .called(1); - }); + test( + 'forwards the provided track to the underlying updater call', + () async { + await expectLater( + shorebirdUpdater.checkForUpdate(track: track), + completion(equals(UpdateStatus.outdated)), + ); + verify( + () => updater.checkForDownloadableUpdate(track: track), + ).called(1); + }, + ); }); }); @@ -401,15 +447,17 @@ void main() { shorebirdUpdater = ShorebirdUpdaterImpl(updater: updater, run: run); }); - test('propagates the exception and does not call freeUpdateResult', - () async { - await expectLater( - shorebirdUpdater.update(), - throwsA(isA()), - ); - verify(() => updater.update()).called(1); - verifyNever(() => updater.freeUpdateResult(any())); - }); + test( + 'propagates the exception and does not call freeUpdateResult', + () async { + await expectLater( + shorebirdUpdater.update(), + throwsA(isA()), + ); + verify(() => updater.update()).called(1); + verifyNever(() => updater.freeUpdateResult(any())); + }, + ); }); group('when no update is available', () { @@ -483,11 +531,7 @@ void main() { shorebirdUpdater.update, throwsA( isA() - .having( - (e) => e.message, - 'message', - 'oops', - ) + .having((e) => e.message, 'message', 'oops') .having( (e) => e.reason, 'reason', @@ -627,15 +671,14 @@ void main() { shorebirdUpdater = ShorebirdUpdaterImpl(updater: updater, run: run); }); - test('forwards the provided track to the underlying updater call', - () async { - await expectLater( - shorebirdUpdater.update(track: track), - completes, - ); - verify(() => updater.update(track: track)).called(1); - verify(() => updater.freeUpdateResult(any())).called(1); - }); + test( + 'forwards the provided track to the underlying updater call', + () async { + await expectLater(shorebirdUpdater.update(track: track), completes); + verify(() => updater.update(track: track)).called(1); + verify(() => updater.freeUpdateResult(any())).called(1); + }, + ); }); }); }); diff --git a/shorebird_code_push/test/src/shorebird_updater_web_test.dart b/shorebird_code_push/test/src/shorebird_updater_web_test.dart index bc7270a..c5b054a 100644 --- a/shorebird_code_push/test/src/shorebird_updater_web_test.dart +++ b/shorebird_code_push/test/src/shorebird_updater_web_test.dart @@ -65,6 +65,18 @@ void main() { ); }); + group('setDeviceIdOverride', () { + test( + 'does nothing', + overridePrint((_) async { + await expectLater( + shorebirdUpdater.setDeviceIdOverride('developer-device-id'), + completes, + ); + }), + ); + }); + group('update', () { test( 'does nothing', diff --git a/shorebird_code_push/test/src/updater_test.dart b/shorebird_code_push/test/src/updater_test.dart index 6228159..5e9e492 100644 --- a/shorebird_code_push/test/src/updater_test.dart +++ b/shorebird_code_push/test/src/updater_test.dart @@ -40,56 +40,59 @@ void main() { }); group('checkForDownloadableUpdate', () { - test('forwards the result of shorebird_check_for_downloadable_update', - () { - when( - () => updaterBindings.shorebird_check_for_downloadable_update( - nullptr, - ), - ).thenReturn(true); - expect(updater.checkForDownloadableUpdate(), isTrue); + test( + 'forwards the result of shorebird_check_for_downloadable_update', + () { + when( + () => updaterBindings.shorebird_check_for_downloadable_update( + nullptr, + ), + ).thenReturn(true); + expect(updater.checkForDownloadableUpdate(), isTrue); - when( - () => updaterBindings.shorebird_check_for_downloadable_update( - nullptr, - ), - ).thenReturn(false); - expect(updater.checkForDownloadableUpdate(), isFalse); - }); + when( + () => updaterBindings.shorebird_check_for_downloadable_update( + nullptr, + ), + ).thenReturn(false); + expect(updater.checkForDownloadableUpdate(), isFalse); + }, + ); group('when a track is provided', () { setUp(() { when( - () => updaterBindings.shorebird_check_for_downloadable_update( - any(), - ), + () => + updaterBindings.shorebird_check_for_downloadable_update(any()), ).thenReturn(true); }); - test('forwards the result of shorebird_check_for_downloadable_update', - () { - expect( - updater.checkForDownloadableUpdate(track: UpdateTrack.beta), - isTrue, - ); + test( + 'forwards the result of shorebird_check_for_downloadable_update', + () { + expect( + updater.checkForDownloadableUpdate(track: UpdateTrack.beta), + isTrue, + ); - expect( - updater.checkForDownloadableUpdate(track: UpdateTrack.stable), - isTrue, - ); + expect( + updater.checkForDownloadableUpdate(track: UpdateTrack.stable), + isTrue, + ); - final captured = verify( - () => updaterBindings.shorebird_check_for_downloadable_update( - captureAny(), - ), - ).captured; - expect( - captured.map( - (cstr) => (cstr as Pointer).cast().toDartString(), - ), - equals(['beta', 'stable']), - ); - }); + final captured = verify( + () => updaterBindings.shorebird_check_for_downloadable_update( + captureAny(), + ), + ).captured; + expect( + captured.map( + (cstr) => (cstr as Pointer).cast().toDartString(), + ), + equals(['beta', 'stable']), + ); + }, + ); }); }); @@ -103,6 +106,28 @@ void main() { }); }); + group('setDeviceIdOverride', () { + test('forwards the device id to shorebird_set_device_id_override', () { + late String capturedDeviceId; + when( + () => updaterBindings.shorebird_set_device_id_override(any()), + ).thenAnswer((invocation) { + capturedDeviceId = + (invocation.positionalArguments.single as Pointer) + .cast() + .toDartString(); + return true; + }); + + expect(updater.setDeviceIdOverride('developer-device-id'), isTrue); + + verify( + () => updaterBindings.shorebird_set_device_id_override(captureAny()), + ).called(1); + expect(capturedDeviceId, 'developer-device-id'); + }); + }); + group('update', () { test('calls bindings.shorebird_update_with_result', () { when(