msasn1: implement ASN1_CreateModule

Nikolay Sivov bunglehead at gmail.com
Tue Oct 27 15:29:02 CDT 2015


On 27.10.2015 23:10, Austin English wrote:
> This is based on code from the FreeRDP project, used with permission
> of the author, Marc-André Moreau <marcandre.moreau at gmail.com>

Do you plan to reuse more from there? Is it clean license-wise? And more 
importantly, how did FreeRDP project came up with that implementation?

>
> For https://bugs.winehq.org/show_bug.cgi?id=38020
>


> +
> +ASN1module_t WINAPI ASN1_CreateModule(ASN1uint32_t version, ASN1encodingrule_e rule, ASN1uint32_t flags, ASN1uint32_t pdu, const ASN1GenericFun_t encoder[], const ASN1GenericFun_t decoder[], const ASN1FreeFun_t freememory[], const ASN1uint32_t size[], ASN1magic_t modulename)

arg[] notation seems redundant, *arg is cleaner and more common for Wine.

> +    ASN1module_t module = NULL;

No need to init this.

> +    if (!((encoder) && (decoder) && (freememory) && (size)))
> +        return NULL;

...

> +    module = (ASN1module_t) malloc(sizeof(struct tagASN1module_t));
> +    ZeroMemory(module, sizeof(struct tagASN1module_t));

Heap* API please. And you don't need to zero-init it, or use tag* names.

All structures seem to be documented well, what's a reason to reuse 
simple parts like such structure allocations?

Can this be tested by directly calling ASN1_* functions? If yes, simple 
test would be nice to have.



More information about the wine-devel mailing list