mIRC Home    About    Download    Register    News    Help

Print Thread
#46633 02/09/03 09:03 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
OP Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
does the lN parameter for $decompress do anything? Try this

/write some.txt blah blah blah
//echo -a $compress(some.txt,l1)
Now view the file (it's compressed)
//echo -a $decompress(some.txt,l6)
Now view the file (it's decompressed)

//echo -a $compress(some.txt,l6)
Now view the file (it's compressed)
//echo -a $decompress(some.txt,l1)
Now view the file (it's decompressed)

It seems, regardless of what value I specify for lN in $decompress, it is able to decompress the data. So if this option does nothing, why does it exist? Assuming mIRC is using zlib, you don't specify a compression level to decompress, that information is stored in the actual compressed data.

Also, whatever algorithm mIRC uses, it isn't very good. A good compression algorithm has the "never grows" option. For example, if I want to compress a file that contains just the letter "a" (which obviously can't get any smaller), no real compression is done, because that would actually cause the file to get larger. mIRC doesn't do this, it will let the file get bigger and bigger. For example, do (using the same file above)
//echo -a $compress(some.txt,l6)
Do that 5 times, and after each time look at the file, notice how each time the file gets bigger and bigger; a good compression algorithm would not let that happen.

Lastly, I know I should probably post this on the feature suggestion forum, but it seems stupid to create another post. I suggest an expansion for $compress/$decompress:
$compress(file|&binvar,file|&binvar,lNb)
$decompress(file|&binvar, file|&binvar,b)

The reason is, most of the time, when you are doing a file compression, you don't want to actually overwrite the file. Like if I use a file zipper on some.txt, it creates some.zip, it doesn't overwrite some.txt with compressed data. Same for decompression, if I decompress some.zip, it doesn't overwrite some.zip with the txt info, it creates some.txt. It would seem to be that it would be useful if $compress/$decompress supported this directly rather than having to, for example, load the file into a binvar, $compress the binvar, then /bwrite it to another file.

#46634 02/09/03 09:19 PM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Agreed, it would appear the most confusion about $compress/$decompress stems from the lack of a target file. The second source of confusion is it's $identifier form, people seem to expect the compressed data returned to them in a variable. (Yes, I know the help file is quite clear on this.)

An optional target file would be a novel idea.
Use as a /command would also be nice, if the user is uninterested in success/fail.
Simply halt on fail when used in /command form.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard