Lines Matching refs:complen
33 my_bool _mariadb_compress(unsigned char *packet, size_t *len, size_t *complen)
36 *complen=0;
39 unsigned char *compbuf=_mariadb_compress_alloc(packet,len,complen);
41 return *complen ? 0 : 1;
49 unsigned char *_mariadb_compress_alloc(const unsigned char *packet, size_t *len, size_t *complen)
52 *complen = *len * 120 / 100 + 12;
53 if (!(compbuf = (unsigned char *) malloc(*complen)))
55 if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
61 if (*complen >= *len)
63 *complen=0;
67 swap(size_t,*len,*complen); /* *len is now packet length */
71 my_bool _mariadb_uncompress (unsigned char *packet, size_t *len, size_t *complen)
73 if (*complen) /* If compressed */
75 unsigned char *compbuf = (unsigned char *) malloc (*complen);
78 if (uncompress((Bytef*) compbuf, (uLongf *)complen, (Bytef*) packet, (uLongf)*len) != Z_OK)
83 *len = *complen;
87 else *complen= *len;