mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 20:59:08 -04:00
refactor: use explicit string length when converting from buffer to Dart string
This commit is contained in:
parent
f4e9ae4167
commit
0a758b771a
7 changed files with 22 additions and 22 deletions
|
@ -85,7 +85,7 @@ String format({
|
|||
bool? alwaysUseLongFormat,
|
||||
String? dirtySuffix,
|
||||
}) {
|
||||
final out = calloc<git_buf>(sizeOf<git_buf>());
|
||||
final out = calloc<git_buf>();
|
||||
final opts = calloc<git_describe_format_options>();
|
||||
libgit2.git_describe_format_options_init(
|
||||
opts,
|
||||
|
@ -104,7 +104,7 @@ String format({
|
|||
|
||||
libgit2.git_describe_format(out, describeResultPointer, opts);
|
||||
|
||||
final result = out.ref.ptr.cast<Utf8>().toDartString();
|
||||
final result = out.ref.ptr.cast<Utf8>().toDartString(length: out.ref.size);
|
||||
|
||||
calloc.free(opts);
|
||||
calloc.free(out);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue