Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Zlib problem
Zlib problem [message #51464] Thu, 28 March 2019 12:41 Go to next message
Xemuth is currently offline  Xemuth
Messages: 60
Registered: August 2018
Location: France
Member
Hello there,

tried to use Zlib by looking "compression" example stored in reference.

But this one seems to don't work.

can someone confirm me this ?

Version 11873 64Bit GCC C++11 compiled: 03/31/2018 08:33:17
Re: Zlib problem [message #51466 is a reply to message #51464] Thu, 28 March 2019 17:47 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 817
Registered: December 2006
Experienced Contributor
I checked example against latest source code. Everything works fine (except I was unable to compile a Release version Smile )
My output:
Compressed by zlib
Compressed by LZ4
Compressed by Zstd

(I replaced last "Compressed by LZ4" with "Compressed by Zstd". This is a second problem with this example I could find. Smile )
Linux, 64Bit GCC.


Regards,
Novo
Re: Zlib problem [message #51467 is a reply to message #51466] Thu, 28 March 2019 17:50 Go to previous message
Novo is currently offline  Novo
Messages: 817
Registered: December 2006
Experienced Contributor
Below is a fixed version which works in both Release and Debug configurations.

#include <Core/Core.h>
#include <plugin/lz4/lz4.h>
#include <plugin/zstd/zstd.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	StdLogSetup(LOG_FILE|LOG_COUT);

	String cpath = GetHomeDirFile("test");
	
	{
		FileOut out(cpath);
		ZCompressStream z(out);
		z.Put("Compressed by zlib");
	}
	
	{
		FileIn in(cpath);
		ZDecompressStream z(in);
		RLOG(z.GetLine());
	}

	{
		FileOut out(cpath);
		LZ4CompressStream z(out);
		z.Put("Compressed by LZ4");
	}
	
	{
		FileIn in(cpath);
		LZ4DecompressStream z(in);
		RLOG(z.GetLine());
	}

	{
		FileOut out(cpath);
		ZstdCompressStream z(out);
		z.Put("Compressed by Zstd");
	}
	
	{
		FileIn in(cpath);
		ZstdDecompressStream z(in);
		RLOG(z.GetLine());
	}
	
	FileDelete(cpath);
}


Regards,
Novo

[Updated on: Thu, 28 March 2019 17:50]

Report message to a moderator

Previous Topic: [SOLVED] Purpose of HttpRequest::SSLCertificate
Next Topic: DeepCopyOption do_clone inconsistancy?
Goto Forum:
  


Current Time: Thu Jun 20 07:59:26 CEST 2019

Total time taken to generate the page: 0.01314 seconds