Hi,
HB_BZ2_UNCOMPRESSLEN( <cCompressedData>, [<@nResult>] )
-> <nUnCompressedDataLen> or 0 on error
I guess 0 can be also a valid result, if empty string was compressed.
So, we'll always need to check nResult, to check for error. -1 fits
better to indicate error condition.
Perhaps the problem was HB_SIZE type which is unsigned, but we can solve
it in C level to always check iResult and return -1 to .prg level if
necessary.
I'm unable to test if empty string can be compressed using bzip2,
because a simple test code tries to work as bzip utillity???!!! :-/
I have a feeling that another main() function exists in bzip library, or
something like that...
C:\cawi32\sample\test>cat test198.prg
PROC Main()
LOCAL cI, cJ, nErr
cI := "Hello"
cJ := HB_BZ2_COMPRESS(cI,, @nErr)
? nErr, LEN(cJ), HB_STRTOHEX(cJ)
RETURN
C:\cawi32\sample\test>test198.exe
test198.exe: I won't write compressed data to a terminal.
test198.exe: For help, type: `test198.exe --help'.
C:\cawi32\sample\test>test198.exe --help
bzip2, a block-sorting file compressor. Version 1.0.5, 10-Dec-2007.
usage: test198.exe [flags and input files in any order]
-h --help print this message
-d --decompress force decompression
-z --compress force compression
-k --keep keep (don't delete) input files
-f --force overwrite existing output files
-t --test test compressed file integrity
-c --stdout output to standard out
-q --quiet suppress noncritical error messages
-v --verbose be verbose (a 2nd -v gives more)
-L --license display software version & license
-V --version display software version & license
-s --small use less memory (at most 2500k)
-1 .. -9 set block size to 100k .. 900k
--fast alias for -1
--best alias for -9
If invoked as `bzip2', default action is to compress.
as `bunzip2', default action is to decompress.
as `bzcat', default action is to decompress to stdout.
If no file names are given, bzip2 compresses or decompresses
from standard input to standard output. You can combine
short flags, so `-v -4' means the same as -v4 or -4v, &c.
Regards,
Mindaugas
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour