libtomcrypt icon indicating copy to clipboard operation
libtomcrypt copied to clipboard

Polish API `unsigned char*` vs. `void*`

Open karel-m opened this issue 8 years ago • 2 comments
trafficstars

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 */
}

karel-m avatar Mar 22 '17 20:03 karel-m

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).

rofl0r avatar Mar 22 '17 23:03 rofl0r

@rofl0r ty :-)

sjaeckel avatar Mar 22 '17 23:03 sjaeckel