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.