diff --git a/include/mujoco/mujoco.h b/include/mujoco/mujoco.h index 6c03bf98..fc04d8eb 100644 --- a/include/mujoco/mujoco.h +++ b/include/mujoco/mujoco.h @@ -1087,7 +1087,7 @@ MJAPI const char* mju_type2Str(int type); MJAPI int mju_str2Type(const char* str); // Construct a warning message given the warning type and info. -MJAPI const char* mju_warningText(int warning, int info); +MJAPI const char* mju_warningText(int warning, size_t info); // Return 1 if nan or abs(x)>mjMAXVAL, 0 otherwise. Used by check functions. MJAPI int mju_isBad(mjtNum x); diff --git a/introspect/functions.py b/introspect/functions.py index 65d92a61..f21d82e5 100644 --- a/introspect/functions.py +++ b/introspect/functions.py @@ -6886,7 +6886,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([ ), FunctionParameterDecl( name='info', - type=ValueType(name='int'), + type=ValueType(name='size_t'), ), ), doc='Construct a warning message given the warning type and info.', diff --git a/src/engine/engine_util_misc.c b/src/engine/engine_util_misc.c index df7c71ec..06f44680 100644 --- a/src/engine/engine_util_misc.c +++ b/src/engine/engine_util_misc.c @@ -947,45 +947,45 @@ int mju_str2Type(const char* str) { // warning text -const char* mju_warningText(int warning, int info) { +const char* mju_warningText(int warning, size_t info) { static char str[1000]; switch (warning) { case mjWARN_INERTIA: - mjSNPRINTF(str, "Inertia matrix is too close to singular at DOF %d. Check model.", info); + mjSNPRINTF(str, "Inertia matrix is too close to singular at DOF %zu. Check model.", info); break; case mjWARN_CONTACTFULL: mjSNPRINTF(str, "Too many contacts. Either the arena memory is full, or nconmax is specified and is " "exceeded. Increase arena memory allocation, or increase/remove nconmax. " - "(ncon = %d)", info); + "(ncon = %zu)", info); break; case mjWARN_CNSTRFULL: mjSNPRINTF(str, "Insufficient arena memory for the number of constraints generated. " - "Increase arena memory allocation above %d bytes.", info); + "Increase arena memory allocation above %zu bytes.", info); break; case mjWARN_VGEOMFULL: - mjSNPRINTF(str, "Pre-allocated visual geom buffer is full. Increase maxgeom above %d.", info); + mjSNPRINTF(str, "Pre-allocated visual geom buffer is full. Increase maxgeom above %zu.", info); break; case mjWARN_BADQPOS: - mjSNPRINTF(str, "Nan, Inf or huge value in QPOS at DOF %d. The simulation is unstable.", info); + mjSNPRINTF(str, "Nan, Inf or huge value in QPOS at DOF %zu. The simulation is unstable.", info); break; case mjWARN_BADQVEL: - mjSNPRINTF(str, "Nan, Inf or huge value in QVEL at DOF %d. The simulation is unstable.", info); + mjSNPRINTF(str, "Nan, Inf or huge value in QVEL at DOF %zu. The simulation is unstable.", info); break; case mjWARN_BADQACC: - mjSNPRINTF(str, "Nan, Inf or huge value in QACC at DOF %d. The simulation is unstable.", info); + mjSNPRINTF(str, "Nan, Inf or huge value in QACC at DOF %zu. The simulation is unstable.", info); break; case mjWARN_BADCTRL: - mjSNPRINTF(str, "Nan, Inf or huge value in CTRL at ACTUATOR %d. The simulation is unstable.", + mjSNPRINTF(str, "Nan, Inf or huge value in CTRL at ACTUATOR %zu. The simulation is unstable.", info); break; diff --git a/src/engine/engine_util_misc.h b/src/engine/engine_util_misc.h index 93f6224c..8a2b58a6 100644 --- a/src/engine/engine_util_misc.h +++ b/src/engine/engine_util_misc.h @@ -22,6 +22,8 @@ extern "C" { #endif +#include + //------------------------------ tendons and actuators --------------------------------------------- // wrap tendons around spheres and cylinders @@ -86,7 +88,7 @@ MJAPI const char* mju_type2Str(int type); MJAPI int mju_str2Type(const char* str); // warning text -MJAPI const char* mju_warningText(int warning, int info); +MJAPI const char* mju_warningText(int warning, size_t info); // return 1 if nan or abs(x)>mjMAXVAL, 0 otherwise MJAPI int mju_isBad(mjtNum x); diff --git a/unity/Runtime/Bindings/MujocoBindings.cs b/unity/Runtime/Bindings/MujocoBindings.cs index d581ea32..9c19b403 100644 --- a/unity/Runtime/Bindings/MujocoBindings.cs +++ b/unity/Runtime/Bindings/MujocoBindings.cs @@ -3502,7 +3502,7 @@ public static unsafe extern int mju_str2Type([MarshalAs(UnmanagedType.LPStr)]str [DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.LPStr)] -public static unsafe extern string mju_warningText(int warning, int info); +public static unsafe extern string mju_warningText(int warning, UIntPtr info); [DllImport("mujoco", CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int mju_isBad(double x);