diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 065617b4748edcee0bc0b218e9dff4818078e940..2a0e73e73b908224c77fccd0fa93b419dba24825 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -181,18 +181,18 @@ static int check_type(struct expression *expression, } /* Sets the value from the expression argument, checking that it is a - * valid u16, and matches the expected type. Returns STATUS_OK on + * valid u32, and matches the expected type. Returns STATUS_OK on * success; on failure returns STATUS_ERR and sets error message. */ -static int get_u16(struct expression *expression, - u16 *value, char **error) +static int get_u32(struct expression *expression, + u32 *value, char **error) { if (check_type(expression, EXPR_INTEGER, error)) return STATUS_ERR; - if ((expression->value.num > UINT16_MAX) || + if ((expression->value.num > UINT32_MAX) || (expression->value.num < 0)) { asprintf(error, - "Value out of range for 16-bit unsigned integer: %lld", + "Value out of range for 32-bit unsigned integer: %lld", expression->value.num); return STATUS_ERR; } @@ -201,18 +201,18 @@ static int get_u16(struct expression *expression, } /* Sets the value from the expression argument, checking that it is a - * valid u32, and matches the expected type. Returns STATUS_OK on + * valid s32 or u32, and matches the expected type. Returns STATUS_OK on * success; on failure returns STATUS_ERR and sets error message. */ -static int get_u32(struct expression *expression, - u32 *value, char **error) +static int get_s32(struct expression *expression, + s32 *value, char **error) { if (check_type(expression, EXPR_INTEGER, error)) return STATUS_ERR; - if ((expression->value.num > UINT32_MAX) || - (expression->value.num < 0)) { + if ((expression->value.num > UINT_MAX) || + (expression->value.num < INT_MIN)) { asprintf(error, - "Value out of range for 32-bit unsigned integer: %lld", + "Value out of range for 32-bit integer: %lld", expression->value.num); return STATUS_ERR; } @@ -221,18 +221,18 @@ static int get_u32(struct expression *expression, } /* Sets the value from the expression argument, checking that it is a - * valid s32 or u32, and matches the expected type. Returns STATUS_OK on + * valid u16, and matches the expected type. Returns STATUS_OK on * success; on failure returns STATUS_ERR and sets error message. */ -static int get_s32(struct expression *expression, - s32 *value, char **error) +static int get_u16(struct expression *expression, + u16 *value, char **error) { if (check_type(expression, EXPR_INTEGER, error)) return STATUS_ERR; - if ((expression->value.num > UINT_MAX) || - (expression->value.num < INT_MIN)) { + if ((expression->value.num > UINT16_MAX) || + (expression->value.num < 0)) { asprintf(error, - "Value out of range for 32-bit integer: %lld", + "Value out of range for 16-bit unsigned integer: %lld", expression->value.num); return STATUS_ERR; } @@ -249,8 +249,8 @@ static int get_s16(struct expression *expression, { if (check_type(expression, EXPR_INTEGER, error)) return STATUS_ERR; - if ((expression->value.num > USHRT_MAX) || - (expression->value.num < SHRT_MIN)) { + if ((expression->value.num > INT16_MAX) || + (expression->value.num < INT16_MIN)) { asprintf(error, "Value out of range for 16-bit integer: %lld", expression->value.num); @@ -269,8 +269,8 @@ static int get_s8(struct expression *expression, { if (check_type(expression, EXPR_INTEGER, error)) return STATUS_ERR; - if ((expression->value.num > UCHAR_MAX) || - (expression->value.num < SCHAR_MIN)) { + if ((expression->value.num > INT8_MAX) || + (expression->value.num < INT8_MIN)) { asprintf(error, "Value out of range for 8-bit integer: %lld", expression->value.num);