#1 2016-06-20 01:41:10

DeBritto
Member
Registered: 2016-06-20
Posts: 3

[SOLVED] How to use CompressSynLZO function?

Hi Folks,

I'm trying to use SynLZO unit with Synopse.inc file in order to use the compression functions available.  I gave a look at the code, but I'm a free pascal beginner yet. Could you show me how to call CompressSynLZO function?

I'm trying like this:
CompressSynLZO(string_to_be compressed, True)

But it allways return:
synlzo

It seems that the function was programmed to allways return this...
Can you help me?

Best regards

Last edited by DeBritto (2016-06-22 13:25:10)

Offline

#2 2016-06-20 05:01:14

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: [SOLVED] How to use CompressSynLZO function?

Yes, this function always returns "synlzo".

SynSelfTests.pas is often a good place to have an idea about how to use a function.
Line 8179 (TTestCompression._SynLZO) and further of this file.

You will see that the anistring s is compressed and decompressed !

Offline

#3 2016-06-20 14:24:16

DeBritto
Member
Registered: 2016-06-20
Posts: 3

Re: [SOLVED] How to use CompressSynLZO function?

Hi AOG,
Thank you so much for your reply.
just one more thing. When I try to save the compressed string into a Blob database field (Firebird 2.5 with charset utf8) I receive this message: error - malformed string.
I have no idea of what is happening. Can you help me. My aim is to compress a string to sabe it on a blob field in order to reduce network latency.

Yes, this function always returns "synlzo".
SynSelfTests.pas is often a good place to have an idea about how to use a function.
Line 8179 (TTestCompression._SynLZO) and further of this file.
You will see that the anistring s is compressed and decompressed !

Offline

#4 2016-06-21 08:20:48

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: [SOLVED] How to use CompressSynLZO function?

I am sorry, but I do not know how to help you with this error.
The compressed string is just a string. So, it should work.

However, many problems stem from utf8 / ansi codepage problems.
Perhaps you could try base64 encoding of your string ?

Offline

#5 2016-06-21 16:39:48

DeBritto
Member
Registered: 2016-06-20
Posts: 3

Re: [SOLVED] How to use CompressSynLZO function?

Hi AOG,
Thank you so much. I used base64 encondig of the compressed string before I save that on the Blob field. It's working now! smile Perfect.

Offline

Board footer

Powered by FluxBB