mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 18:50:12 +01:00
compile fixes for gcc 5
Change-Id: Ifdf5736620632cb5eabb745b9d3ee1f830478826 Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
parent
78892cdac9
commit
338571d299
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#define VERSION "1.2.0-master"
|
#define VERSION "1.2.0-master"
|
||||||
|
|
||||||
#define BUILD 949
|
#define BUILD 951
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
|
@ -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){
|
void sanitiseBase64(char *s){
|
||||||
char *p1;
|
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){
|
int utf8_encode(char *inbuf, int inbuflen, char *outbuf, int outbuflen, char *encoding){
|
||||||
iconv_t cd;
|
iconv_t cd;
|
||||||
size_t inbytesleft, outbytesleft;
|
size_t inbytesleft, outbytesleft;
|
||||||
|
@ -13,7 +13,6 @@ int decode_base64_to_buffer(char *p, int plen, unsigned char *b, int blen);
|
|||||||
void decodeQP(char *p);
|
void decodeQP(char *p);
|
||||||
void decodeHTML(char *p, int utf8);
|
void decodeHTML(char *p, int utf8);
|
||||||
void decodeURL(char *p);
|
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);
|
int utf8_encode(char *inbuf, int inbuflen, char *outbuf, int outbuflen, char *encoding);
|
||||||
|
|
||||||
#endif /* _DECODER_H */
|
#endif /* _DECODER_H */
|
||||||
|
10
src/hash.c
10
src/hash.c
@ -9,6 +9,11 @@
|
|||||||
#include <piler.h>
|
#include <piler.h>
|
||||||
|
|
||||||
|
|
||||||
|
inline int hash(unsigned int key){
|
||||||
|
return key % MAXHASH;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void inithash(struct node *xhash[]){
|
void inithash(struct node *xhash[]){
|
||||||
int i;
|
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 DJBHash(char* str, unsigned int len){
|
||||||
unsigned int hash = 5381;
|
unsigned int hash = 5381;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
@ -15,7 +15,6 @@ struct node *makenewnode(char *s);
|
|||||||
int addnode(struct node *xhash[], char *s);
|
int addnode(struct node *xhash[], char *s);
|
||||||
struct node *findnode(struct node *xhash[], char *s);
|
struct node *findnode(struct node *xhash[], char *s);
|
||||||
int is_substr_in_hash(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);
|
unsigned int DJBHash(char* str, unsigned int len);
|
||||||
|
|
||||||
#endif /* _HASH_H */
|
#endif /* _HASH_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user