Skip to content

Commit

Permalink
fix marshalling for bool ret
Browse files Browse the repository at this point in the history
  • Loading branch information
aloneguid committed Sep 30, 2024
1 parent 522efcb commit b5dfafb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion managed/IronCompress/Iron.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public static bool SupportsNative(Codec c) {
}

public static string GetNativeVersion() {
return Native.iron_version();
IntPtr ptr = Native.iron_version();
string version = Marshal.PtrToStringAnsi(ptr);

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Converting null literal or possible null value to non-nullable type.

Check warning on line 52 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Converting null literal or possible null value to non-nullable type.
return version;

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / Build managed + nuget

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-20.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on ubuntu-22.04

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on windows-2022

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Possible null reference return.

Check warning on line 53 in managed/IronCompress/Iron.cs

View workflow job for this annotation

GitHub Actions / managed test on macos-latest

Possible null reference return.
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion managed/IronCompress/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ internal static extern unsafe bool iron_compress(bool compress,
int compressionLevel);

[DllImport(LibName)]
[return: MarshalAs(UnmanagedType.I1)]
internal static extern bool iron_ping();

[DllImport(LibName)]
[return: MarshalAs(UnmanagedType.I1)]
internal static extern bool iron_is_supported(int codec);

[DllImport(LibName)]
internal static extern string iron_version();
internal static extern IntPtr iron_version();
}
}

0 comments on commit b5dfafb

Please sign in to comment.