| | |
| | | defstream.opaque = Z_NULL; |
| | | defstream.avail_in = data_len+1; |
| | | defstream.next_in = (unsigned char *)data; |
| | | char *compr=(char *)malloc(data_len*sizeof(char *)); |
| | | fprintf(stderr,"WAS HERE %d\n", data_len); |
| | | *compressed=(char *)malloc(data_len*sizeof(char *)); |
| | | defstream.avail_out = data_len+1; |
| | | defstream.next_out = (unsigned char *)compr; |
| | | defstream.next_out = (unsigned char *)*compressed; |
| | | deflateInit(&defstream, Z_BEST_COMPRESSION); |
| | | deflate(&defstream, Z_FINISH); |
| | | deflateEnd(&defstream); |
| | | *compressed=compr; |
| | | // *compressed=base64_encode((unsigned char *)compr,(size_t)defstream.total_out,&nbase); |
| | | //fwrite(base64, sizeof(unsigned char), nbase, fh); |
| | | // free(compr); |
| | | return defstream.total_out; |
| | | } |
| | | |