[svn:parrot] r46348 - in trunk: src/dynpmc t/dynpmc
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Thu May 6 13:06:40 UTC 2010
Author: fperrad
Date: Thu May 6 13:06:40 2010
New Revision: 46348
URL: https://trac.parrot.org/parrot/changeset/46348
Log:
[gziphandle] fix compress()
Modified:
trunk/src/dynpmc/gziphandle.pmc
trunk/t/dynpmc/gziphandle.t
Modified: trunk/src/dynpmc/gziphandle.pmc
==============================================================================
--- trunk/src/dynpmc/gziphandle.pmc Thu May 6 12:36:48 2010 (r46347)
+++ trunk/src/dynpmc/gziphandle.pmc Thu May 6 13:06:40 2010 (r46348)
@@ -249,16 +249,16 @@
int rc;
char *buf;
STRING *dst = NULL;
- UINTVAL srcLen, bufSize, dstLen;
+ UINTVAL srcLen, dstLen;
char * const src = Parrot_str_to_cstring(INTERP, str);
if (!src)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ILL_INHERIT,
"failed to allocate");
- srcLen = Parrot_str_byte_length(INTERP, str);
- bufSize = 12 + srcLen + srcLen / 1000;
- buf = mem_allocate_n_zeroed_typed(bufSize, char);
+ srcLen = Parrot_str_byte_length(INTERP, str);
+ dstLen = 12 + srcLen + srcLen / 1000;
+ buf = mem_allocate_n_zeroed_typed(dstLen, char);
if (!buf) {
Parrot_str_free_cstring(src);
Modified: trunk/t/dynpmc/gziphandle.t
==============================================================================
--- trunk/t/dynpmc/gziphandle.t Thu May 6 12:36:48 2010 (r46347)
+++ trunk/t/dynpmc/gziphandle.t Thu May 6 13:06:40 2010 (r46348)
@@ -22,7 +22,7 @@
.local pmc config_hash, interp
.local int num_tests
- num_tests = 3
+ num_tests = 5
plan(num_tests)
interp = getinterp
config_hash = interp[.IGLOBALS_CONFIG_HASH]
@@ -32,6 +32,7 @@
$P0 = loadlib 'gziphandle'
test_handle()
test_version()
+ test_basic()
.return()
no_zlib:
@@ -56,6 +57,15 @@
is($I0, 0, 'zlib version')
.end
+.sub 'test_basic'
+ $P0 = new 'GzipHandle'
+ .const string data = "message"
+ $I0 = $P0.'crc32'(0, data)
+ ok($I0, "crc32")
+ $S0 = $P0.'compress'(data)
+ $I0 = length $S0
+ is($I0, 15, "compress")
+.end
# Local Variables:
# mode: pir
More information about the parrot-commits
mailing list