@@ -7,34 +7,34 @@ import 'dart:io';
7
7
8
8
// Note that kernel32.dll is the correct name in both 32-bit and 64-bit.
9
9
final DynamicLibrary stdlib = Platform .isWindows
10
- ? DynamicLibrary .open (" kernel32.dll" )
10
+ ? DynamicLibrary .open (' kernel32.dll' )
11
11
: DynamicLibrary .process ();
12
12
13
13
typedef PosixMallocNative = Pointer Function (IntPtr );
14
14
typedef PosixMalloc = Pointer Function (int );
15
15
final PosixMalloc posixMalloc =
16
- stdlib.lookupFunction <PosixMallocNative , PosixMalloc >(" malloc" );
16
+ stdlib.lookupFunction <PosixMallocNative , PosixMalloc >(' malloc' );
17
17
18
18
typedef PosixFreeNative = Void Function (Pointer );
19
19
typedef PosixFree = void Function (Pointer );
20
20
final PosixFree posixFree =
21
- stdlib.lookupFunction <PosixFreeNative , PosixFree >(" free" );
21
+ stdlib.lookupFunction <PosixFreeNative , PosixFree >(' free' );
22
22
23
23
typedef WinGetProcessHeapFn = Pointer Function ();
24
24
final WinGetProcessHeapFn winGetProcessHeap = stdlib
25
- .lookupFunction <WinGetProcessHeapFn , WinGetProcessHeapFn >(" GetProcessHeap" );
25
+ .lookupFunction <WinGetProcessHeapFn , WinGetProcessHeapFn >(' GetProcessHeap' );
26
26
final Pointer processHeap = winGetProcessHeap ();
27
27
28
28
typedef WinHeapAllocNative = Pointer Function (Pointer , Uint32 , IntPtr );
29
29
typedef WinHeapAlloc = Pointer Function (Pointer , int , int );
30
30
final WinHeapAlloc winHeapAlloc =
31
- stdlib.lookupFunction <WinHeapAllocNative , WinHeapAlloc >(" HeapAlloc" );
31
+ stdlib.lookupFunction <WinHeapAllocNative , WinHeapAlloc >(' HeapAlloc' );
32
32
33
33
typedef WinHeapFreeNative = Int32 Function (
34
34
Pointer heap, Uint32 flags, Pointer memory);
35
35
typedef WinHeapFree = int Function (Pointer heap, int flags, Pointer memory);
36
36
final WinHeapFree winHeapFree =
37
- stdlib.lookupFunction <WinHeapFreeNative , WinHeapFree >(" HeapFree" );
37
+ stdlib.lookupFunction <WinHeapFreeNative , WinHeapFree >(' HeapFree' );
38
38
39
39
/// Allocates memory on the native heap.
40
40
///
@@ -52,7 +52,7 @@ Pointer<T> allocate<T extends NativeType>({int count = 1}) {
52
52
result = posixMalloc (totalSize).cast ();
53
53
}
54
54
if (result.address == 0 ) {
55
- throw ArgumentError (" Could not allocate $totalSize bytes." );
55
+ throw ArgumentError (' Could not allocate $totalSize bytes.' );
56
56
}
57
57
return result;
58
58
}
@@ -70,7 +70,7 @@ Pointer<T> allocate<T extends NativeType>({int count = 1}) {
70
70
void free (Pointer pointer) {
71
71
if (Platform .isWindows) {
72
72
if (winHeapFree (processHeap, /*flags=*/ 0 , pointer) == 0 ) {
73
- throw ArgumentError (" Could not free $pointer ." );
73
+ throw ArgumentError (' Could not free $pointer .' );
74
74
}
75
75
} else {
76
76
posixFree (pointer);
0 commit comments