Module: vkd3d Branch: master Commit: a55c51a2b7a82e1d019ee834180ea7edd50d9356 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=a55c51a2b7a82e1d019ee834... Author: Joshua Ashton <joshua(a)froggi.es> Date: Mon Nov 8 21:39:27 2021 -0600 vkd3d-shader/hlsl: Avoid hard-coding array sizes in hlsl_type_to_string(). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d-shader/hlsl.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index c71eac3..1eee427 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -854,14 +854,14 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru { struct vkd3d_string_buffer *string; - static const char base_types[HLSL_TYPE_LAST_SCALAR + 1][7] = - { - "float", - "half", - "double", - "int", - "uint", - "bool", + static const char *const base_types[] = + { + [HLSL_TYPE_FLOAT] = "float", + [HLSL_TYPE_HALF] = "half", + [HLSL_TYPE_DOUBLE] = "double", + [HLSL_TYPE_INT] = "int", + [HLSL_TYPE_UINT] = "uint", + [HLSL_TYPE_BOOL] = "bool", }; if (!(string = hlsl_get_string_buffer(ctx))) @@ -915,7 +915,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru case HLSL_CLASS_OBJECT: { - static const char dimensions[5][HLSL_SAMPLER_DIM_MAX + 1] = + static const char *const dimensions[] = { [HLSL_SAMPLER_DIM_1D] = "1D", [HLSL_SAMPLER_DIM_2D] = "2D",