Polish API unsigned char* vs. void* #174

Open
opened 2017-03-22 15:38:33 -05:00 by karel-m · 2 comments
karel-m commented 2017-03-22 15:38:33 -05:00 (Migrated from github.com)

The discussion started in #171

instead of:

int fnc(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
{
   /* some code */
}

use rather:

int fnc(const void *inptr, unsigned long inlen, void *outptr, unsigned long *outlen)
{
   const unsigned char *in = inptr
   unsigned char *out = outptr;
   /* some code */
}
The discussion started in #171 instead of: ```C int fnc(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen) { /* some code */ } ``` use rather: ```C int fnc(const void *inptr, unsigned long inlen, void *outptr, unsigned long *outlen) { const unsigned char *in = inptr unsigned char *out = outptr; /* some code */ } ```
rofl0r commented 2017-03-22 18:43:14 -05:00 (Migrated from github.com)

also: in C the proper type for sizes is size_t, not unsigned long. (usually it's the same, but some odd platforms like windows have a 32bit long on 64bit).

also: in C the proper type for sizes is size_t, not unsigned long. (usually it's the same, but some odd platforms like windows have a 32bit long on 64bit).
sjaeckel commented 2017-03-22 18:46:39 -05:00 (Migrated from github.com)

@rofl0r ty :-)

@rofl0r ty :-)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libtom/libtomcrypt#174
No description provided.