--- D:/edho/Downloads/ed2k/ed2k.org.c Minggu Okt 18 04:50:01 2009 +++ D:/edho/Downloads/ed2k/ed2k.c Minggu Nop 1 14:54:54 2009 @@ -28,11 +28,17 @@ #include #include #include +#include #include #include /* #define OFF_CONV "%ld" /* off_t is long (Linux) */ /* #define OFF_CONF "%lld" /* off_t is long long (FreeBSD) */ +#if defined(__linux__) || defined(__WIN32__) +# define OFF_CONV "%ld" +#else +# define OFF_CONV "%lld" +#endif #ifndef OFF_CONV # warning "You should define OFF_CONV (see the file)" @@ -45,6 +51,9 @@ #define BLOCKSIZE 4096 #define EDK_BLOCK 2375 +#define u_int32_t uint32_t +#define rindex(a,b) strrchr((a),(b)) + typedef unsigned char md4_t[16]; typedef struct { @@ -86,16 +95,16 @@ } -static __inline__ char hdigit(q) { +static __inline__ char hdigit(unsigned char q) { return ((q >= 10) ? 'W' : '0') + q; } -char *digest_str(void *digest) { +char *digest_str(unsigned char *digest) { static char internal_str[sizeof(md4_t)*2 + 1]; char *str = internal_str; int dsize = sizeof(md4_t); while (dsize--) { - unsigned char d = *((unsigned char *)digest)++; + unsigned char d = *(digest)++; *(str++) = hdigit(d >> 4 ); *(str++) = hdigit(d & 0xf); }