Skip to content

Commit

Permalink
fix: add missing Assert()
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Sep 27, 2021
1 parent 67155d5 commit a7dbfd7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

using pb = global::Google.Protobuf;

namespace Mediapipe {
internal static class Protobuf {
static Protobuf() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class StringPacket : Packet<string> {
}

public byte[] GetByteArray() {
UnsafeNativeMethods.mp_Packet__GetByteString(mpPtr, out var strPtr, out int size);
UnsafeNativeMethods.mp_Packet__GetByteString(mpPtr, out var strPtr, out int size).Assert();
GC.KeepAlive(this);

var bytes = new byte[size];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class Timestamp : MpResourceHandle, IEquatable<Timestamp> {
public Timestamp(IntPtr ptr) : base(ptr) {}

public Timestamp(Int64 value) : base() {
UnsafeNativeMethods.mp_Timestamp__l(value, out var ptr);
UnsafeNativeMethods.mp_Timestamp__l(value, out var ptr).Assert();
this.ptr = ptr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@ internal static partial class UnsafeNativeMethods {
public static extern MpReturnCode google_ShutdownGoogleLogging();

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_FLAGS_logtostderr([MarshalAs(UnmanagedType.I1)] bool value);
public static extern void glog_FLAGS_logtostderr([MarshalAs(UnmanagedType.I1)] bool value);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_FLAGS_stderrthreshold(int threshold);
public static extern void glog_FLAGS_stderrthreshold(int threshold);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_FLAGS_minloglevel(int level);
public static extern void glog_FLAGS_minloglevel(int level);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_FLAGS_log_dir(string dir);
public static extern void glog_FLAGS_log_dir(string dir);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_FLAGS_v(int v);
public static extern void glog_FLAGS_v(int v);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_LOG_INFO__PKc(string str);
public static extern void glog_LOG_INFO__PKc(string str);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_LOG_WARNING__PKc(string str);
public static extern void glog_LOG_WARNING__PKc(string str);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_LOG_ERROR__PKc(string str);
public static extern void glog_LOG_ERROR__PKc(string str);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode glog_LOG_FATAL__PKc(string str);
public static extern void glog_LOG_FATAL__PKc(string str);

[DllImport (MediaPipeLibrary, ExactSpelling = true)]
public static extern MpReturnCode google_FlushLogFiles(Glog.Severity severity);
public static extern void google_FlushLogFiles(Glog.Severity severity);
}
}

0 comments on commit a7dbfd7

Please sign in to comment.