Re: dpnet: Implement IDirectPlay8Address GetComponentByIndex (try 5)
-----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 SIGNATURE----- Version: GnuPG v2
iQIcBAEBAgAGBQJUxS4iAAoJEN0/YqbEcdMwvFkP/RF6kH1o1C4fQgfa/J+4j6zV kwp3M7rqU5VTasKYV+G0pdAQ+wvBzHpMPSqLRD/HfBWGf3dAPCk94C9d659enkJN Qhy7hhO6aazsXKq7iWVAgQrGJy59oBoL14Vg+44hUJIeu7qWv3uuqihVgKUqiG2K Bl235p9cM/WYLGXFEF4d1UFHBKZb0bhRudwuzRbuN8r3RLwpEhrKbbKg8yXOPjLq Vejc4d219iib3ZpbT13pq0j/+a+ox+R62+O9S5wGbu/G8IGxVPTgsY20mpFyPsHX DoedE56wfSSe5Psb78NVmC32bWY8nmUzJA9YBb26a0KPO9QZNVnJkkYkOKIFr6P/ ouVLfWbO4QV2dOPRbYnh+40XCIbPeatGMq9vE7TDZPtxLBkRTEl1GudZ5usFwCK7 XgTPjb+BIu37UCbt0hpWA4IH8UeyYue08DnGCWkMkGS6ClH9KCG2xVqL8F1gr8Bw W5iKcVVHFZzHS6D947nN17Fl6Rg4+oLui0zkgtveU/AY/ew8xptHt4rW6It3QU5t HkNce4St+2w1LErIuYRITrvQV6lrndDDgvvlPcK1P1zt2D1a9gpqnsPgKM/tZLu+ fO8P8Yjl81KZHlAVWMUutiDzlelUOJvaXnVNX5VVkyOajHDI569MKy4qOETSdiim gwulxslghTkPCsAa+LpB =iY0u -----END PGP SIGNATURE-----
-----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.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUxj5kAAoJEN0/YqbEcdMw7csP/AgCDVd5m1CiudhhY2TbdzqO y6RUMLy52zYX187dW5WniPDQeJbShi+cpFNv9w2neVd8VXx+7JyOPN9cn7aKDU/1 GecG0P9mvvtXCO4qRM2OYUWXYjKZGRCJGDTVETqef4fb4sfcq38v2dbDcCGwrob/ bQLL5b1myTmlWuuM1S4dFv92pglPqUK8N5zq8TybxW3Mko50kCfwxX1V8Tg0SvbT vu1gCJLVh2nIA2fWuC+HwwwZcbYhAwX1Bs9PLN/OOmTghji7W6PR60zJnNOP0+kG RtDm8W1vA+R9CZ4OfMBGD8elvWQSqMwUNfHcj8ZrG+1pZOu5gTfuCUBUj3KNJq2b ZP6VKoQLd+Xudw2qQiZzcXdNLKV6ARjMR/k0Fs2/cppWfBIXMWH/8szdUHCsnUqY Qvb6MFTc7jTRBOkyyaCP0VqnuClnE4sWBisq5cICnYYuYBKWXjUfqGZPIaOIyssl iIRTytxMjEooqU8UxXCWZeXNMrDBqbNm4Xct8vZsIQ5dPPziy2wpFntS9CI1IFOM /IZNo4S0FADAQ8QKdtG1bkgOvzrYuDK2c6vdFKh+xzqKBZjzq+XIyK2P87pMkgph Df8wvWEUVg9xfZTQIktwsx5K5wxBCfrERFcEj8xgaSXoEt/DPpXM8SfTpy2xoPAp L1kIkVxwVn2WCNguDpqZ =8Zzu -----END PGP SIGNATURE-----
participants (1)
-
Stefan Dösinger