aboutsummaryrefslogtreecommitdiffstats
path: root/src/blind-crop.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2017-04-09 23:46:17 +0200
committerMattias Andrée <maandree@kth.se>2017-04-09 23:46:17 +0200
commitdac6950d9e556d5521ad7913d27a6cf83e2a90a1 (patch)
treebb6a65d973337a0504117888d5534967cc51f479 /src/blind-crop.c
parentClean up (diff)
downloadblind-dac6950d9e556d5521ad7913d27a6cf83e2a90a1.tar.gz
blind-dac6950d9e556d5521ad7913d27a6cf83e2a90a1.tar.bz2
blind-dac6950d9e556d5521ad7913d27a6cf83e2a90a1.tar.xz
Clean up
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/blind-crop.c')
-rw-r--r--src/blind-crop.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/blind-crop.c b/src/blind-crop.c
index fa76762..1ad9a19 100644
--- a/src/blind-crop.c
+++ b/src/blind-crop.c
@@ -41,9 +41,7 @@ main(int argc, char *argv[])
left = etozu_arg("the left position", argv[2], 0, SIZE_MAX);
top = etozu_arg("the top position", argv[3], 0, SIZE_MAX);
- stream.file = "<stdin>";
- stream.fd = STDIN_FILENO;
- einit_stream(&stream);
+ eopen_stream(&stream, NULL);
if (left > SIZE_MAX - width || left + width > stream.width ||
top > SIZE_MAX - height || top + height > stream.height)
eprintf("crop area extends beyond original image\n");
@@ -72,10 +70,8 @@ main(int argc, char *argv[])
off = (orown - left % orown) % orown;
yoff = (height - top % height) % height;
}
- bottom_start = top + height;
- bottom = stream.height - bottom_start;
- right_start = left + orown;
- right = irown - right_start;
+ bottom = stream.height - (bottom_start = top + height);
+ right = irown - (right_start = left + orown);
while (eread_frame(&stream, buf, n)) {
if (tile) {