diff --git a/src/config.h b/src/config.h index 922503a3..1ac025cd 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "1.2.0-master" -#define BUILD 949 +#define BUILD 951 #define HOSTID "mailarchiver" diff --git a/src/decoder.c b/src/decoder.c index 8f1a4286..1c26932e 100644 --- a/src/decoder.c +++ b/src/decoder.c @@ -67,6 +67,35 @@ static int compmi(const void *m1, const void *m2){ } +inline void utf8_encode_char(unsigned char c, unsigned char *buf, int buflen, int *len){ + int count=0; + + memset(buf, 0, buflen); + + /* + * Code point 1st byte 2nd byte 3rd byte 4th byte + * ---------- -------- -------- -------- -------- + * U+0000..U+007F 00..7F + * U+0080..U+07FF C2..DF 80..BF + * U+0800..U+0FFF E0 A0..BF 80..BF + */ + + if(c <= 0x7F){ + *(buf+count) = c; + count++; + } + + else { + *(buf+count) = ( 0xC0 | (c >> 6) ); + count++; + *(buf+count) = ( 0x80 | (c & 0x3F) ); + count++; + } + + *len = count; +} + + void sanitiseBase64(char *s){ char *p1; @@ -287,35 +316,6 @@ void decodeURL(char *p){ } -inline void utf8_encode_char(unsigned char c, unsigned char *buf, int buflen, int *len){ - int count=0; - - memset(buf, 0, buflen); - - /* - * Code point 1st byte 2nd byte 3rd byte 4th byte - * ---------- -------- -------- -------- -------- - * U+0000..U+007F 00..7F - * U+0080..U+07FF C2..DF 80..BF - * U+0800..U+0FFF E0 A0..BF 80..BF - */ - - if(c <= 0x7F){ - *(buf+count) = c; - count++; - } - - else { - *(buf+count) = ( 0xC0 | (c >> 6) ); - count++; - *(buf+count) = ( 0x80 | (c & 0x3F) ); - count++; - } - - *len = count; -} - - int utf8_encode(char *inbuf, int inbuflen, char *outbuf, int outbuflen, char *encoding){ iconv_t cd; size_t inbytesleft, outbytesleft; diff --git a/src/decoder.h b/src/decoder.h index 85558486..132d332c 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -13,7 +13,6 @@ int decode_base64_to_buffer(char *p, int plen, unsigned char *b, int blen); void decodeQP(char *p); void decodeHTML(char *p, int utf8); void decodeURL(char *p); -inline void utf8_encode_char(unsigned char c, unsigned char *buf, int buflen, int *len); int utf8_encode(char *inbuf, int inbuflen, char *outbuf, int outbuflen, char *encoding); #endif /* _DECODER_H */ diff --git a/src/hash.c b/src/hash.c index fbc65156..5fe19cc6 100644 --- a/src/hash.c +++ b/src/hash.c @@ -9,6 +9,11 @@ #include +inline int hash(unsigned int key){ + return key % MAXHASH; +} + + void inithash(struct node *xhash[]){ int i; @@ -148,11 +153,6 @@ int is_substr_in_hash(struct node *xhash[], char *s){ } -inline int hash(unsigned int key){ - return key % MAXHASH; -} - - unsigned int DJBHash(char* str, unsigned int len){ unsigned int hash = 5381; unsigned int i = 0; diff --git a/src/hash.h b/src/hash.h index 040c5d6c..317d26b1 100644 --- a/src/hash.h +++ b/src/hash.h @@ -15,7 +15,6 @@ struct node *makenewnode(char *s); int addnode(struct node *xhash[], char *s); struct node *findnode(struct node *xhash[], char *s); int is_substr_in_hash(struct node *xhash[], char *s); -inline int hash(unsigned int key); unsigned int DJBHash(char* str, unsigned int len); #endif /* _HASH_H */