• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/mt-daapd/src/

Lines Matching defs:gz

43     GZIP_STREAM *gz = malloc(sizeof(GZIP_STREAM));
45 if(gz) {
46 memset(gz,0x00,sizeof(GZIP_STREAM));
48 gz->in_size = GZIP_CHUNK;
49 gz->in = malloc(gz->in_size);
50 gz->bytes_in = 0;
51 gz->out = NULL;
52 gz->bytes_out = 0;
54 return gz;
57 ssize_t gzip_write(GZIP_STREAM *gz, void *buf, size_t size) {
62 if (gz->in == NULL)
66 while (gz->in_size <= gz->bytes_in + size) {
67 new_size = 2*gz->in_size;
71 free(gz->in);
72 gz->in = NULL;
73 gz->bytes_in = gz->in_size = 0;
76 memcpy(in2, gz->in, gz->in_size);
77 free(gz->in);
78 gz->in = in2;
79 gz->in_size = new_size;
81 memcpy(gz->in + gz->bytes_in, buf, size);
82 gz->bytes_in += size;
86 int gzip_compress(GZIP_STREAM *gz) {
91 if (gz->in == NULL)
94 out_size = (int)(1.05*gz->in_size) + 40;
95 gz->out = malloc(out_size);
96 if (gz->out == NULL) {
98 gz->bytes_out = 0;
107 strm.next_in = gz->in;
108 strm.avail_in = gz->bytes_in;
109 strm.next_out = gz->out;
116 gz->bytes_out = 0;
119 gz->bytes_out = strm.total_out;
122 return gz->bytes_out;
125 int gzip_close(GZIP_STREAM *gz, int fd) {
126 int bytes_written = gz->bytes_out;
127 if (r_write(fd,gz->out,gz->bytes_out) != gz->bytes_out) {
131 if (gz->in != NULL)
132 free(gz->in);
133 if (gz->out != NULL)
134 free(gz->out);
135 free(gz);
341 int daap_serialize(DAAP_BLOCK *root, int fd, GZIP_STREAM *gz) {
345 if (gz == NULL)
348 gzip_write(gz,root->tag,4);
355 if (gz == NULL)
358 gzip_write(gz,&size,4);
362 if (gz == NULL) {
366 gzip_write(gz,root->value,root->size);
370 if (gz == NULL) {
374 gzip_write(gz,root->svalue,root->size);
380 if(daap_serialize(root->children,fd,gz))