sdlUtf8strlcpy function

int sdlUtf8strlcpy(
  1. Pointer<NativeType> arg0,
  2. String? src,
  3. int dstBytes
)
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes)

Implementation

int sdlUtf8strlcpy(Pointer<NativeType> arg0, String? src, int dstBytes) {
  final sdlUtf8strlcpyLookupFunction = libSdl2.lookupFunction<
      Uint32 Function(
          Pointer<NativeType> arg0, Pointer<Utf8> src, Uint32 dstBytes),
      int Function(Pointer<NativeType> arg0, Pointer<Utf8> src,
          int dstBytes)>('SDL_utf8strlcpy');
  final srcPointer = src != null ? src.toNativeUtf8() : nullptr;
  final result = sdlUtf8strlcpyLookupFunction(arg0, srcPointer, dstBytes);
  calloc.free(srcPointer);
  return result;
}