aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-12-04 10:31:19 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-12-04 10:32:32 +0100
commitbac9cd24fc82f096e0988f5176fbf39e278a0ea2 (patch)
tree3f802b63dbde490a94904adfeb23cbe9ba42c1ac /tools
parent7cb2879c039372965a1a8bccaa5ee74fc448b38c (diff)
downloadfiv-bac9cd24fc82f096e0988f5176fbf39e278a0ea2.tar.gz
fiv-bac9cd24fc82f096e0988f5176fbf39e278a0ea2.tar.xz
fiv-bac9cd24fc82f096e0988f5176fbf39e278a0ea2.zip
jpeginfo: clean up
No more -Wunused-function warnings.
Diffstat (limited to 'tools')
-rw-r--r--tools/jpeginfo.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/tools/jpeginfo.c b/tools/jpeginfo.c
index aa9c46f..3a84880 100644
--- a/tools/jpeginfo.c
+++ b/tools/jpeginfo.c
@@ -258,11 +258,11 @@ tiffer_rational(const struct tiffer *self, const struct tiffer_entry *entry,
*denominator = (int32_t) self->un->u32(entry->p + 4);
return true;
default:
- if (!tiffer_integer(self, entry, numerator))
- return false;
-
- *denominator = 1;
- return true;
+ if (tiffer_integer(self, entry, numerator)) {
+ *denominator = 1;
+ return true;
+ }
+ return false;
}
}
@@ -275,14 +275,7 @@ tiffer_real(
// Somewhat excessively lenient, intended for display.
switch (entry->type) {
- int64_t integer;
- case RATIONAL:
- *out = self->un->u32(entry->p) / (double) self->un->u32(entry->p + 4);
- return true;
- case SRATIONAL:
- *out = (int32_t) self->un->u32(entry->p) /
- (double) (int32_t) self->un->u32(entry->p + 4);
- return true;
+ int64_t numerator, denominator;
case FLOAT:
*out = *(float *) entry->p;
return true;
@@ -290,11 +283,11 @@ tiffer_real(
*out = *(double *) entry->p;
return true;
default:
- if (!tiffer_integer(self, entry, &integer))
- return false;
-
- *out = integer;
- return true;
+ if (tiffer_rational(self, entry, &numerator, &denominator)) {
+ *out = (double) numerator / denominator;
+ return true;
+ }
+ return false;
}
}