Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

string convertion issues, UTF-8 and memory leak issues #305

Closed
jeremyVignelles opened this issue Sep 19, 2017 · 0 comments
Closed

string convertion issues, UTF-8 and memory leak issues #305

jeremyVignelles opened this issue Sep 19, 2017 · 0 comments

Comments

@jeremyVignelles
Copy link
Collaborator

These lines seems bogous to me:

#if !NET20
public static string ToStringAnsi(this IntPtr ptr)
#else
public static string ToStringAnsi(IntPtr ptr)
#endif
{
return ptr != IntPtr.Zero ? Marshal.PtrToStringAnsi(ptr) : null;

#if !NET20
public static IntPtr ToHGlobalAnsi(this string source)
#else
public static IntPtr ToHGlobalAnsi(string source)
#endif
{
if (source == null)
return IntPtr.Zero;
return Marshal.StringToHGlobalAnsi(source);

Because:

  • All string inputs in libvlc are expected as UTF-8
  • IntPtr should be Free'd correctly, otherwise, memory will probably leak
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant