On Wed, 15 Sept 2021 at 10:19, Matteo Bruni mbruni@codeweavers.com wrote:
static bool vkd3d_string_buffer_resize(struct vkd3d_string_buffer *buffer, int rc) {
- unsigned int new_buffer_size = buffer->buffer_size * 2;
- char *new_buffer;
- unsigned int new_buffer_size = rc >= 0 ? buffer->content_size + rc + 1 : max(buffer->buffer_size * 2, 32);
- new_buffer_size = max(new_buffer_size, 32);
- while (rc > 0 && (unsigned int)rc >= new_buffer_size - buffer->content_size)
new_buffer_size *= 2;
- if (!(new_buffer = vkd3d_realloc(buffer->buffer, new_buffer_size)))
- if (!vkd3d_array_reserve((void **)&buffer->buffer, &buffer->buffer_size, new_buffer_size, 1))
Unfortunately this introduces warnings on 64-bit builds:
libs/vkd3d-shader/vkd3d_shader_main.c:50:56: warning: passing argument 2 of ‘vkd3d_array_reserve’ from incompatible pointer type [-Wincompatible-pointer-types] if (!vkd3d_array_reserve((void **)&buffer->buffer, &buffer->buffer_size, new_buffer_size, 1)) ^~~~~~~~~~~~~~~~~~~~