-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Provide the same methods as Compress::Raw::Zlib::Deflate but
sub new { bless \(my $self), __PACKAGE__ }
sub deflate { # ($self, $input, $output)
- $_[2] .= $_[1];
+ $_[2] .= ref($_[1]) ? ${$_[1]} : $_[1];
Z_OK;
}
my $self = $_[0]; # $_[1] => input
http_out($self);
my $err;
- for (1..$#_) {
- $err = $self->{gz}->deflate($_[$_], $self->{zbuf});
+ for (delete $self->{obuf}, @_[1..$#_]) {
+ $err = $self->{gz}->deflate($_ // next, $self->{zbuf});
die "gzip->deflate: $err" if $err != Z_OK;
}
undef;
my $zbuf = delete $self->{zbuf};
my $gz = delete $self->{gz};
my $err;
- for (1..$#_) { # it's a bug iff $gz is undef w/ $_[1..]
- $err = $gz->deflate($_[$_], $zbuf);
+ # it's a bug iff $gz is undef w/ $obuf or $_[1..]
+ for (delete $self->{obuf}, @_[1..$#_]) {
+ $err = $gz->deflate($_ // next, $zbuf);
die "gzip->deflate: $err" if $err != Z_OK;
}
$gz // return ''; # not a bug, recursing on DS->write failure
$x =~ s/\r?\n/\n/gs;
$ctx->{-anchors} = {} if $x =~ /^diff --git /sm;
flush_diff($ctx, \$x); # undefs $x
- $ctx->zmore($bdy);
- undef $bdy;
# TODO: should there be another textarea which attempts to
# search for the exact email which was applied to make this
# commit?