pub fn validate_int(value: u32, name: &'static str) -> Result<::libc::c_int, IntegerOrSdlError> {
    use self::IntegerOrSdlError::*;
    // Many SDL functions will accept `int` values, even if it doesn't make sense
    // for the values to be negative.
    // In the cases that SDL doesn't check negativity, passing negative values
    // could be unsafe.
    // For example, `SDL_JoystickGetButton` uses the index argument to access an
    // array without checking if it's negative, which could potentially lead to
    // segmentation faults.
    if value >= 1 << 31 {
        Err(IntegerOverflows(name, value))
    } else {
        Ok(value as ::libc::c_int)
    }
}
/// Validates and converts the given u32 to a positive C integer.
Validates and converts the given u32 to a positive C integer.
Validates and converts the given u32 to a positive C integer .
pub fn validate_int(value: u32, name: &'static str) -> Result<::libc::c_int, IntegerOrSdlError> {
    use self::IntegerOrSdlError::*;
    // Many SDL functions will accept `int` values, even if it doesn't make sense
    // for the values to be negative.
    // In the cases that SDL doesn't check negativity, passing negative values
    // could be unsafe.
    // For example, `SDL_JoystickGetButton` uses the index argument to access an
    // array without checking if it's negative, which could potentially lead to
    // segmentation faults.
    if value >= 1 << 31 {
        Err(IntegerOverflows(name, value))
    } else {
        Ok(value as ::libc::c_int)
    }
}
pub fn validate_int ( value : u32 , name : & ' static str ) -> Result < :: libc :: c_int , IntegerOrSdlError > { use self :: IntegerOrSdlError :: * ; // Many SDL functions will accept `int` values, even if it doesn't make sense // for the values to be negative. // In the cases that SDL doesn't check negativity, passing negative values // could be unsafe. // For example, `SDL_JoystickGetButton` uses the index argument to access an // array without checking if it's negative, which could potentially lead to // segmentation faults. if value >= 1 << 31 { Err ( IntegerOverflows ( name , value ) ) } else { Ok ( value as :: libc :: c_int ) } }
Validates and converts the given u32 to a positive C integer.
Validates and converts the given u32 to a positive C integer .
value
u32
name
&'static str
value
u32
name
&'static str