Fix accessing ulong enum option as uint, failing on 64-bit big-endian.
This commit is contained in:
parent
a129a82432
commit
ae134314b8
@ -647,7 +647,7 @@ static int setval(const struct my_option *opts, uchar* *value, char *argument,
|
|||||||
return EXIT_OUT_OF_MEMORY;
|
return EXIT_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
case GET_ENUM:
|
case GET_ENUM:
|
||||||
if (((*(int*)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
|
if (((*(ulong *)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
|
||||||
return EXIT_ARGUMENT_INVALID;
|
return EXIT_ARGUMENT_INVALID;
|
||||||
break;
|
break;
|
||||||
case GET_SET:
|
case GET_SET:
|
||||||
@ -983,7 +983,7 @@ static void init_one_value(const struct my_option *option, uchar* *variable,
|
|||||||
*((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
|
*((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
|
||||||
break;
|
break;
|
||||||
case GET_ENUM:
|
case GET_ENUM:
|
||||||
*((uint*) variable)= (uint) value;
|
*((ulong*) variable)= (uint) value;
|
||||||
break;
|
break;
|
||||||
case GET_UINT:
|
case GET_UINT:
|
||||||
*((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
|
*((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
|
||||||
@ -1221,7 +1221,7 @@ void my_print_variables(const struct my_option *options)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GET_ENUM:
|
case GET_ENUM:
|
||||||
printf("%s\n", get_type(optp->typelib, *(uint*) value));
|
printf("%s\n", get_type(optp->typelib, *(ulong*) value));
|
||||||
break;
|
break;
|
||||||
case GET_STR:
|
case GET_STR:
|
||||||
case GET_STR_ALLOC: /* fall through */
|
case GET_STR_ALLOC: /* fall through */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user