14 Jun
2024
14 Jun
'24
7:01 p.m.
Brendan Shanks (@bshanks) commented about dlls/winemac.drv/surface.c:
+} + +static CGDataProviderRef data_provider_create(size_t size, void **bits) +{ + CGDataProviderRef provider; + void *data; + + if (!(data = malloc(size))) return NULL; + + provider = CGDataProviderCreateWithData(data, data, size, data_provider_destroy); + if (!provider) free(data); + else *bits = data; + + return provider; +} + Not a big deal, but you could avoid needing the destroy callback by using a CFMutableData instead of malloc(). Create a CFMutableData, set the length, set *bits to the byte ptr, create the CGDataProvider with the CFMutableData, then release it.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5798#note_73233