Use new function to get buffer size, instead of hard-coding

This commit is contained in:
Jamie Cameron
2021-03-27 12:17:22 -07:00
parent 9feae324d6
commit 11d382cb36
6 changed files with 13 additions and 7 deletions

View File

@@ -3074,7 +3074,8 @@ if (&should_switch_to_mail_user()) {
&open_as_mail_user(SRC, $src) || return 0;
&open_as_mail_user(DST, ">$dst") || return 0;
my $buf;
while(read(SRC, $buf, 32768) > 0) {
my $bs = &get_buffer_size();
while(read(SRC, $buf, $bs) > 0) {
print DST $buf;
}
close(SRC);

View File

@@ -53,13 +53,14 @@ if ($in{'scale'}) {
($jpegin, $jpegout) = &pipeopen("pnmscale $scale 2>/dev/null | cjpeg");
print $jpegin $type;
print $jpegin $size;
while(read($pnmout, $buf, 32768)) {
my $bs = &get_buffer_size();
while(read($pnmout, $buf, $bs)) {
print $jpegin $buf;
}
close($jpegin);
close($pnmout);
print "Content-type: image/jpeg\n\n";
while(read($jpegout, $buf, 32768)) {
while(read($jpegout, $buf, $bs)) {
print $buf;
}
close($jpegout);

View File

@@ -55,7 +55,8 @@ if ($?) {
# Output the ZIP
print "Content-type: application/zip\n\n";
open(ZIP, "<$zip");
while(read(ZIP, $buf, 32768) > 0) {
my $bs = &get_buffer_size();
while(read(ZIP, $buf, $bs) > 0) {
print $buf;
}
close(ZIP);

View File

@@ -53,7 +53,8 @@ if ($ENV{'PATH_INFO'}) {
print "Content-type: application/zip\n\n";
open(FILE, "<$temp");
unlink($temp);
while(read(FILE, $buffer, 32768)) {
my $bs = &get_buffer_size();
while(read(FILE, $buffer, $bs)) {
print("$buffer");
}
close(FILE);

View File

@@ -30,7 +30,8 @@ if ($in{'to'} == 0) {
print "Content-type: application/octet-stream\n\n";
open(TEMP, "<$temp");
my $buf;
while(read(TEMP, $buf, 32768)) {
my $bs = &get_buffer_size();
while(read(TEMP, $buf, $bs)) {
print $buf;
}
close(TEMP);

View File

@@ -28,7 +28,8 @@ if ($in{'to'} == 0) {
print "Content-type: application/x-gzip\n\n";
open(TEMP, "<$temp");
my $buf;
while(read(TEMP, $buf, 32768)) {
my $bs = &get_buffer_size();
while(read(TEMP, $buf, $bs)) {
print $buf;
}
close(TEMP);