From 4ca00dc38c72f67dc714fbb45b3006afec097c9c Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sat, 19 Oct 2019 13:26:56 +0000
Subject: [PATCH] Compression except of trisurf header is done. Preparing for decompression

---
 src/b64zlib_compression.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/b64zlib_compression.c b/src/b64zlib_compression.c
index 99c1921..5f51a97 100644
--- a/src/b64zlib_compression.c
+++ b/src/b64zlib_compression.c
@@ -78,7 +78,6 @@
 	free(compr);
 
 	ts_uint header[4]={1, data_len, data_len, number_of_compressed_bytes};
-	fprintf(stderr,"Header before encoding: %d, %d, %d, %d\n", header[0],header[1],header[2], header[3]);
 	char *encoded_header=(char *)base64_encode((unsigned char *)header, 4*sizeof(ts_uint), &nbase2);
 	char *return_value=malloc((nbase1+nbase2+1)*sizeof(char));
 	strncpy(return_value,encoded_header,nbase2);
@@ -89,8 +88,13 @@
 	free(encoded_header);
 
 	//test decoding and decompression
-	char *test_data = ts_decompress((unsigned char *)return_value, nbase1+nbase2, data_len);
-	free(test_data);
+	//char *test_data = ts_decompress((unsigned char *)return_value, nbase1+nbase2, data_len);
+	//for(int i=0;i<data_len;i++){
+	//	if(data[i]!=test_data[i]){
+	//		fprintf(stderr,"(DE)COMPRESSION ERROR!\n");
+	//	}
+	//}
+	//free(test_data);
 	return return_value;
 }
 
@@ -100,12 +104,11 @@
 	size_t nbase1=0,nbase2=0;
 	header=(ts_uint *)base64_decode((const char *)compressed_data, encoded_header_len, &nbase2);
 	if(header==NULL) fprintf(stderr, "Error decoding header\n");
-	fprintf(stderr,"Header=%d, %d, %d, %d\n", header[0],header[1], header[2], header[3]);
+	//fprintf(stderr,"Header=%d, %d, %d, %d\n", header[0],header[1], header[2], header[3]);
 	unsigned char *decoded_data=base64_decode((const char *)&compressed_data[encoded_header_len], data_len-encoded_header_len, &nbase1);
 	if(decoded_data==NULL) fprintf(stderr, "Error decoding compressed data\n");
 	unsigned char *return_value=(unsigned char *)malloc(result_len*sizeof(char));
 	uncompress(return_value, (unsigned long *)&result_len, decoded_data, header[3]);
-//	fprintf(stderr,"RESULT_LEN=%d\n",result_len);
 	free(decoded_data);
 	free(header);
 	return (char *)return_value;

--
Gitblit v1.9.3