[PATCH v2 0/1] MR1614: wined3d: Use unsigned int for "refcount" variables.
-- v2: wined3d: Use unsigned int for "refcount" variables. https://gitlab.winehq.org/wine/wine/-/merge_requests/1614
From: Zebediah Figura <zfigura(a)codeweavers.com> --- dlls/wined3d/buffer.c | 4 ++-- dlls/wined3d/cs.c | 4 ++-- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/directx.c | 4 ++-- dlls/wined3d/palette.c | 4 ++-- dlls/wined3d/query.c | 4 ++-- dlls/wined3d/sampler.c | 4 ++-- dlls/wined3d/shader.c | 4 ++-- dlls/wined3d/state.c | 12 ++++++------ dlls/wined3d/stateblock.c | 4 ++-- dlls/wined3d/swapchain.c | 4 ++-- dlls/wined3d/texture.c | 5 ++--- dlls/wined3d/vertexdeclaration.c | 4 ++-- dlls/wined3d/view.c | 12 ++++++------ 14 files changed, 36 insertions(+), 37 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 7d0e3a54a7c..504d58b6dfe 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -494,7 +494,7 @@ static inline unsigned int fixup_transformed_pos(struct wined3d_vec4 *p) ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) { - ULONG refcount = InterlockedIncrement(&buffer->resource.ref); + unsigned int refcount = InterlockedIncrement(&buffer->resource.ref); TRACE("%p increasing refcount to %u.\n", buffer, refcount); @@ -766,7 +766,7 @@ void wined3d_buffer_cleanup(struct wined3d_buffer *buffer) ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) { - ULONG refcount = InterlockedDecrement(&buffer->resource.ref); + unsigned int refcount = InterlockedDecrement(&buffer->resource.ref); TRACE("%p decreasing refcount to %u.\n", buffer, refcount); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index bda5a377ff6..9dc1dffe575 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -4406,7 +4406,7 @@ static void wined3d_command_list_destroy_object(void *object) ULONG CDECL wined3d_command_list_incref(struct wined3d_command_list *list) { - ULONG refcount = InterlockedIncrement(&list->refcount); + unsigned int refcount = InterlockedIncrement(&list->refcount); TRACE("%p increasing refcount to %u.\n", list, refcount); @@ -4415,7 +4415,7 @@ ULONG CDECL wined3d_command_list_incref(struct wined3d_command_list *list) ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list) { - ULONG refcount = InterlockedDecrement(&list->refcount); + unsigned int refcount = InterlockedDecrement(&list->refcount); struct wined3d_device *device = list->device; const struct wined3d_cs_packet *packet; SIZE_T i, offset; diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7a37a27b0cd..4a8f1be56c2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -163,7 +163,7 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context ULONG CDECL wined3d_device_incref(struct wined3d_device *device) { - ULONG refcount = InterlockedIncrement(&device->ref); + unsigned int refcount = InterlockedIncrement(&device->ref); TRACE("%p increasing refcount to %u.\n", device, refcount); @@ -253,7 +253,7 @@ void wined3d_device_cleanup(struct wined3d_device *device) ULONG CDECL wined3d_device_decref(struct wined3d_device *device) { - ULONG refcount = InterlockedDecrement(&device->ref); + unsigned int refcount = InterlockedDecrement(&device->ref); TRACE("%p decreasing refcount to %u.\n", device, refcount); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 4273c6ebe16..a6e9e57269a 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -187,7 +187,7 @@ void wined3d_adapter_cleanup(struct wined3d_adapter *adapter) ULONG CDECL wined3d_incref(struct wined3d *wined3d) { - ULONG refcount = InterlockedIncrement(&wined3d->ref); + unsigned int refcount = InterlockedIncrement(&wined3d->ref); TRACE("%p increasing refcount to %u.\n", wined3d, refcount); @@ -196,7 +196,7 @@ ULONG CDECL wined3d_incref(struct wined3d *wined3d) ULONG CDECL wined3d_decref(struct wined3d *wined3d) { - ULONG refcount = InterlockedDecrement(&wined3d->ref); + unsigned int refcount = InterlockedDecrement(&wined3d->ref); TRACE("%p decreasing refcount to %u.\n", wined3d, refcount); diff --git a/dlls/wined3d/palette.c b/dlls/wined3d/palette.c index 9c56d9e3022..d15938f3962 100644 --- a/dlls/wined3d/palette.c +++ b/dlls/wined3d/palette.c @@ -25,7 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); ULONG CDECL wined3d_palette_incref(struct wined3d_palette *palette) { - ULONG refcount = InterlockedIncrement(&palette->ref); + unsigned int refcount = InterlockedIncrement(&palette->ref); TRACE("%p increasing refcount to %u.\n", palette, refcount); @@ -41,7 +41,7 @@ static void wined3d_palette_destroy_object(void *object) ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette) { - ULONG refcount = InterlockedDecrement(&palette->ref); + unsigned int refcount = InterlockedDecrement(&palette->ref); TRACE("%p decreasing refcount to %u.\n", palette, refcount); diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 0f3d7eb2bb8..be739704922 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -410,7 +410,7 @@ HRESULT wined3d_fence_create(struct wined3d_device *device, struct wined3d_fence ULONG CDECL wined3d_query_incref(struct wined3d_query *query) { - ULONG refcount = InterlockedIncrement(&query->ref); + unsigned int refcount = InterlockedIncrement(&query->ref); TRACE("%p increasing refcount to %u.\n", query, refcount); @@ -429,7 +429,7 @@ static void wined3d_query_destroy_object(void *object) ULONG CDECL wined3d_query_decref(struct wined3d_query *query) { - ULONG refcount = InterlockedDecrement(&query->ref); + unsigned int refcount = InterlockedDecrement(&query->ref); TRACE("%p decreasing refcount to %u.\n", query, refcount); diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c index 50302612056..c003770c74b 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c @@ -23,7 +23,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler) { - ULONG refcount = InterlockedIncrement(&sampler->refcount); + unsigned int refcount = InterlockedIncrement(&sampler->refcount); TRACE("%p increasing refcount to %u.\n", sampler, refcount); @@ -32,7 +32,7 @@ ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler) ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler) { - ULONG refcount = wined3d_atomic_decrement_mutex_lock(&sampler->refcount); + unsigned int refcount = wined3d_atomic_decrement_mutex_lock(&sampler->refcount); TRACE("%p decreasing refcount to %u.\n", sampler, refcount); diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 108f873f725..20fbd9bcd67 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -3402,7 +3402,7 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, struct wined3d ULONG CDECL wined3d_shader_incref(struct wined3d_shader *shader) { - ULONG refcount = InterlockedIncrement(&shader->ref); + unsigned int refcount = InterlockedIncrement(&shader->ref); TRACE("%p increasing refcount to %u.\n", shader, refcount); @@ -3431,7 +3431,7 @@ static void wined3d_shader_destroy_object(void *object) ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) { - ULONG refcount = InterlockedDecrement(&shader->ref); + unsigned int refcount = InterlockedDecrement(&shader->ref); TRACE("%p decreasing refcount to %u.\n", shader, refcount); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 97e1e6b10ab..5e5462c5652 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -33,7 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); ULONG CDECL wined3d_blend_state_incref(struct wined3d_blend_state *state) { - ULONG refcount = InterlockedIncrement(&state->refcount); + unsigned int refcount = InterlockedIncrement(&state->refcount); TRACE("%p increasing refcount to %u.\n", state, refcount); @@ -49,7 +49,7 @@ static void wined3d_blend_state_destroy_object(void *object) ULONG CDECL wined3d_blend_state_decref(struct wined3d_blend_state *state) { - ULONG refcount = wined3d_atomic_decrement_mutex_lock(&state->refcount); + unsigned int refcount = wined3d_atomic_decrement_mutex_lock(&state->refcount); struct wined3d_device *device = state->device; TRACE("%p decreasing refcount to %u.\n", state, refcount); @@ -108,7 +108,7 @@ HRESULT CDECL wined3d_blend_state_create(struct wined3d_device *device, ULONG CDECL wined3d_depth_stencil_state_incref(struct wined3d_depth_stencil_state *state) { - ULONG refcount = InterlockedIncrement(&state->refcount); + unsigned int refcount = InterlockedIncrement(&state->refcount); TRACE("%p increasing refcount to %u.\n", state, refcount); @@ -124,7 +124,7 @@ static void wined3d_depth_stencil_state_destroy_object(void *object) ULONG CDECL wined3d_depth_stencil_state_decref(struct wined3d_depth_stencil_state *state) { - ULONG refcount = wined3d_atomic_decrement_mutex_lock(&state->refcount); + unsigned int refcount = wined3d_atomic_decrement_mutex_lock(&state->refcount); struct wined3d_device *device = state->device; TRACE("%p decreasing refcount to %u.\n", state, refcount); @@ -195,7 +195,7 @@ HRESULT CDECL wined3d_depth_stencil_state_create(struct wined3d_device *device, ULONG CDECL wined3d_rasterizer_state_incref(struct wined3d_rasterizer_state *state) { - ULONG refcount = InterlockedIncrement(&state->refcount); + unsigned int refcount = InterlockedIncrement(&state->refcount); TRACE("%p increasing refcount to %u.\n", state, refcount); @@ -211,7 +211,7 @@ static void wined3d_rasterizer_state_destroy_object(void *object) ULONG CDECL wined3d_rasterizer_state_decref(struct wined3d_rasterizer_state *state) { - ULONG refcount = wined3d_atomic_decrement_mutex_lock(&state->refcount); + unsigned int refcount = wined3d_atomic_decrement_mutex_lock(&state->refcount); struct wined3d_device *device = state->device; TRACE("%p decreasing refcount to %u.\n", state, refcount); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index f0acca461c9..ab2b41f1c61 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -360,7 +360,7 @@ static void stateblock_init_lights(struct list *dst_map, const struct list *src_ ULONG CDECL wined3d_stateblock_incref(struct wined3d_stateblock *stateblock) { - ULONG refcount = InterlockedIncrement(&stateblock->ref); + unsigned int refcount = InterlockedIncrement(&stateblock->ref); TRACE("%p increasing refcount to %u.\n", stateblock, refcount); @@ -577,7 +577,7 @@ void state_cleanup(struct wined3d_state *state) ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock) { - ULONG refcount = InterlockedDecrement(&stateblock->ref); + unsigned int refcount = InterlockedDecrement(&stateblock->ref); TRACE("%p decreasing refcount to %u\n", stateblock, refcount); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 1712cda2373..0ce0b31bf41 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -149,7 +149,7 @@ void wined3d_swapchain_vk_cleanup(struct wined3d_swapchain_vk *swapchain_vk) ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain) { - ULONG refcount = InterlockedIncrement(&swapchain->ref); + unsigned int refcount = InterlockedIncrement(&swapchain->ref); TRACE("%p increasing refcount to %u.\n", swapchain, refcount); @@ -158,7 +158,7 @@ ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain) ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain) { - ULONG refcount = InterlockedDecrement(&swapchain->ref); + unsigned int refcount = InterlockedDecrement(&swapchain->ref); TRACE("%p decreasing refcount to %u.\n", swapchain, refcount); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index ae188ba4290..6f2b2f02623 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1509,7 +1509,7 @@ void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl *texture_gl ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) { - ULONG refcount; + unsigned int refcount; TRACE("texture %p, swapchain %p.\n", texture, texture->swapchain); @@ -1602,8 +1602,7 @@ static void wined3d_texture_cleanup_sync(struct wined3d_texture *texture) ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) { - unsigned int i, sub_resource_count; - ULONG refcount; + unsigned int i, sub_resource_count, refcount; TRACE("texture %p, swapchain %p.\n", texture, texture->swapchain); diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index 67a6417534c..cd57853dab2 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -41,7 +41,7 @@ static void dump_wined3d_vertex_element(const struct wined3d_vertex_element *ele ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration) { - ULONG refcount = InterlockedIncrement(&declaration->ref); + unsigned int refcount = InterlockedIncrement(&declaration->ref); TRACE("%p increasing refcount to %u.\n", declaration, refcount); @@ -60,7 +60,7 @@ static void wined3d_vertex_declaration_destroy_object(void *object) ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration) { - ULONG refcount = InterlockedDecrement(&declaration->ref); + unsigned int refcount = InterlockedDecrement(&declaration->ref); TRACE("%p decreasing refcount to %u.\n", declaration, refcount); diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 65d7bd67ada..0a502bf78b3 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -362,7 +362,7 @@ static void wined3d_view_load_location(struct wined3d_resource *resource, ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view) { - ULONG refcount = InterlockedIncrement(&view->refcount); + unsigned int refcount = InterlockedIncrement(&view->refcount); TRACE("%p increasing refcount to %u.\n", view, refcount); @@ -379,7 +379,7 @@ void wined3d_rendertarget_view_cleanup(struct wined3d_rendertarget_view *view) ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view) { - ULONG refcount = InterlockedDecrement(&view->refcount); + unsigned int refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); @@ -953,7 +953,7 @@ HRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_ ULONG CDECL wined3d_shader_resource_view_incref(struct wined3d_shader_resource_view *view) { - ULONG refcount = InterlockedIncrement(&view->refcount); + unsigned int refcount = InterlockedIncrement(&view->refcount); TRACE("%p increasing refcount to %u.\n", view, refcount); @@ -970,7 +970,7 @@ void wined3d_shader_resource_view_cleanup(struct wined3d_shader_resource_view *v ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view) { - ULONG refcount = InterlockedDecrement(&view->refcount); + unsigned int refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); @@ -1478,7 +1478,7 @@ void wined3d_shader_resource_view_vk_generate_mipmap(struct wined3d_shader_resou ULONG CDECL wined3d_unordered_access_view_incref(struct wined3d_unordered_access_view *view) { - ULONG refcount = InterlockedIncrement(&view->refcount); + unsigned int refcount = InterlockedIncrement(&view->refcount); TRACE("%p increasing refcount to %u.\n", view, refcount); @@ -1495,7 +1495,7 @@ void wined3d_unordered_access_view_cleanup(struct wined3d_unordered_access_view ULONG CDECL wined3d_unordered_access_view_decref(struct wined3d_unordered_access_view *view) { - ULONG refcount = InterlockedDecrement(&view->refcount); + unsigned int refcount = InterlockedDecrement(&view->refcount); TRACE("%p decreasing refcount to %u.\n", view, refcount); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1614
On Wed Nov 30 17:07:36 2022 +0000, Zebediah Figura wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/1614/diffs?diff_id=21873&start_sha=5c3216732e8385c2e0fdb8cd7080547565780dfe#fea89800f28cc4579e68530fcd73ab33aad84ed4_35_35) Thanks, I did a simple find-and-replace for "ULONG refcount = Interlocked", which caused me to miss a few. I've pushed an updated version
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1614#note_18091
This merge request was approved by Jan Sikorski. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1614
do you wish also to change the HESULT:s to non long types? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1614#note_18095
participants (4)
-
eric pouech (@epo) -
Jan Sikorski (@jsikorski) -
Zebediah Figura -
Zebediah Figura (@zfigura)