On Thu, Aug 5, 2010 at 3:58 PM, Joris Huizer <joris_hui...@yahoo.com> wrote:
> In this patch, you have this code:
>
> +    void *ret = NULL;
> //...
> +    ret = HeapAlloc(GetProcessHeap(), 0, 4 * samples);
> +    for(i = 0;i < 32;i++) {
> //...
> +        memcpy((void*) (((DWORD) ret) + (4 * i)), lr.pBits, 4);
> //...
> +    }
>
> I'm not sure, but I think this will cause 64-bit issues (truncating to a 
> 32-bit value?)
> Even if it doesn't, it seems simpler (more readable) to use a char pointer 
> instead of a void pointer, like
>
> +    char *ret;
> //...
> +    ret = HeapAlloc(GetProcessHeap(), 0, 4 * samples);
> //...
> +        memcpy(ret + (4 * i), lr.pBits, 4);


Or just use a DWORD pointer:

+    DWORD *ret;
//...
+    ret = HeapAlloc(GetProcessHeap(), 0, 4 * samples);
+    for(i = 0;i < 32;i++) {
//...
+        ret[i] = lr.pBits;
//...
+    }


Reply via email to