Hello. I’m at the finish line of #JT4 (Create a blob object) but I get the following error when running the test:
remote: [your_program] Logs from your program will appear here!
remote: [your_program] Initialized git directory
remote: ^[[33m[tester::#JT4] $ echo "pineapple blueberry pear banana grape apple" > mango.txt
remote: [tester::#JT4] $ ./your_program.sh hash-object -w mango.txt
remote: [your_program] Logs from your program will appear here!
remote: [your_program] f742add8b2b3797df807f6ec86072a5e166feaef
remote: [tester::#JT4] Output is a 40-char SHA.
remote: [tester::#JT4] ^[[0mThe file at ".git/objects/f7/42add8b2b3797df807f6ec86072a5e166feaef" is not Zlib-compressed
This is my compression code:
z_stream zstream;
zstream.next_in = (Byte*)uncmpData.data();
zstream.avail_in = uncmpData.size();
// zstream.next_out BELOW
// zstream.avail_out BELOW
zstream.zalloc = Z_NULL;
zstream.zfree = Z_NULL;
deflateInit(&zstream, Z_DEFAULT_COMPRESSION);
const uLong maxSize = deflateBound(&zstream, uncmpData.size());
std::string out;
out.resize(maxSize);
zstream.next_out = (Byte*)out.data();
zstream.avail_out = maxSize;
deflate(&zstream, Z_FINISH);
deflateEnd(&zstream);
// out.resize(out.size() - zstream.total_out);
// out.resize(zstream.total_out);
return out;
I’ve tried with and without the out.resize() options (I saw other people were doing it) without change. Everything else seems to be working fine (I know there is no error control because I didn’t want to overcomplicate it but I’ve debugged and all the deflate* return no errors)
