I'm new to osx and I have some problems.I tried to makefile but come up with:
error: unknown type name 'u_char'; did you mean 'char'?
I referred to C PCAP library unknown types error ,add -D_BSD_SOURCE
CFLAGS to my makefile, but it doesn't help.What am I missing?
EDIT:
This is the code which produces the error:
char *computePwd(const u_char *md5) {
static char buf[16];
unsigned char tmp[40];
int tmpl=0;
tmpl = strlen(userName);
strcpy((char*)tmp, userName);
memcpy(tmp + tmpl, md5, 16);
tmpl += 16;
memcpy(buf, ComputeHash(tmp, tmpl), 16);
memset(tmp, 0, 16);
strcpy((char*)tmp, password);
int i;
for (i=0; i<16; ++i)
buf[i] ^= tmp[i];
return buf;
}
Add -Du_char="unsigned char"
to CFLAGS
or just fix the source. Using u_char
as lazy shorthand for unsigned char
was a common practice in legacy BSD codebases where the system headers historically exposed such a typedef. It should not be used in modern code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With