-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
+static void add_component(IDirectPlay8AddressImpl *This, struct component *item) +{
- if(!This->comp_count)
This->components = HeapAlloc(GetProcessHeap(), 0, sizeof(struct component *) * This->comp_count+1 );
You can use your heap_alloc() helper here. The same applies to the HeapFree calls added in the patch.
Other than that I think error handling would be a good idea. You can check for NULL (as well as in the place where you allocate storage for the component in AddComponent) and return from AddComponent with E_OUTOFMEMORY.
The patch has a few formatting issues. Since it looks like dplay & friends will be mostly your reign I'll leave it up to you on how to handle formatting. Do you want me to continue pointing them out? In that case please send me a mail what your intended formatting is. (Obviously it'd be even better if you described your intended formatting to git in the form of a git pre-commit hook containing some regexes ;-) ).
Other than this the patch looks good.
The following is unrelated to this patch, I just noticed it (again?) while reading through it: Am 2015-01-23 um 08:10 schrieb Alistair Leslie-Hughes:
case DPNA_DATATYPE_STRING:
memcpy(pvBuffer, &entry->data.string, entry->size);
break;
Please add a test for a case where AddComponent is called with DPNA_DATATYPE_STRING where (strlen(string) + 1) * sizeof(WCHAR) != dwDataSize.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2015-01-25 um 18:55 schrieb Stefan Dösinger:
Other than that I think error handling would be a good idea. You can check for NULL (as well as in the place where you allocate storage for the component in AddComponent) and return from AddComponent with E_OUTOFMEMORY.
Adding a component >= 0x80000000 should show how native handles out of memory situations here.