diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-05-28 10:11:29 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-05-28 10:13:04 +0200 |
commit | a71069272599888742c70f832898094744ddb6dc (patch) | |
tree | c41b8fded11b71338960644a29105fa5a3dd69d1 /tiffer.h | |
parent | 859736e5be7746ef90535754e37a3a8ec87dfd5e (diff) | |
download | fiv-a71069272599888742c70f832898094744ddb6dc.tar.gz fiv-a71069272599888742c70f832898094744ddb6dc.tar.xz fiv-a71069272599888742c70f832898094744ddb6dc.zip |
Clean up namespace pollution
Diffstat (limited to 'tiffer.h')
-rw-r--r-- | tiffer.h | 63 |
1 files changed, 34 insertions, 29 deletions
@@ -170,31 +170,36 @@ tiffer_subifd( } enum tiffer_type { - BYTE = 1, ASCII, SHORT, LONG, RATIONAL, - SBYTE, UNDEFINED, SSHORT, SLONG, SRATIONAL, FLOAT, DOUBLE, - IFD // This last type from TIFF Technical Note 1 isn't really used much. + TIFFER_BYTE = 1, TIFFER_ASCII, TIFFER_SHORT, TIFFER_LONG, + TIFFER_RATIONAL, + TIFFER_SBYTE, TIFFER_UNDEFINED, TIFFER_SSHORT, TIFFER_SLONG, + TIFFER_SRATIONAL, + TIFFER_FLOAT, + TIFFER_DOUBLE, + // This last type from TIFF Technical Note 1 isn't really used much. + TIFFER_IFD, }; static size_t tiffer_value_size(enum tiffer_type type) { switch (type) { - case BYTE: - case SBYTE: - case ASCII: - case UNDEFINED: + case TIFFER_BYTE: + case TIFFER_SBYTE: + case TIFFER_ASCII: + case TIFFER_UNDEFINED: return 1; - case SHORT: - case SSHORT: + case TIFFER_SHORT: + case TIFFER_SSHORT: return 2; - case LONG: - case SLONG: - case FLOAT: - case IFD: + case TIFFER_LONG: + case TIFFER_SLONG: + case TIFFER_FLOAT: + case TIFFER_IFD: return 4; - case RATIONAL: - case SRATIONAL: - case DOUBLE: + case TIFFER_RATIONAL: + case TIFFER_SRATIONAL: + case TIFFER_DOUBLE: return 8; default: return 0; @@ -232,25 +237,25 @@ tiffer_integer( // TIFF 6.0 only directly suggests that a reader is should accept // any of BYTE/SHORT/LONG for unsigned integers. switch (entry->type) { - case BYTE: - case ASCII: - case UNDEFINED: + case TIFFER_BYTE: + case TIFFER_ASCII: + case TIFFER_UNDEFINED: *out = *entry->p; return true; - case SBYTE: + case TIFFER_SBYTE: *out = (int8_t) *entry->p; return true; - case SHORT: + case TIFFER_SHORT: *out = self->un->u16(entry->p); return true; - case SSHORT: + case TIFFER_SSHORT: *out = (int16_t) self->un->u16(entry->p); return true; - case LONG: - case IFD: + case TIFFER_LONG: + case TIFFER_IFD: *out = self->un->u32(entry->p); return true; - case SLONG: + case TIFFER_SLONG: *out = (int32_t) self->un->u32(entry->p); return true; default: @@ -267,11 +272,11 @@ tiffer_rational(const struct tiffer *self, const struct tiffer_entry *entry, // Somewhat excessively lenient, intended for display. switch (entry->type) { - case RATIONAL: + case TIFFER_RATIONAL: *numerator = self->un->u32(entry->p); *denominator = self->un->u32(entry->p + 4); return true; - case SRATIONAL: + case TIFFER_SRATIONAL: *numerator = (int32_t) self->un->u32(entry->p); *denominator = (int32_t) self->un->u32(entry->p + 4); return true; @@ -295,10 +300,10 @@ tiffer_real( // Assuming the host architecture uses IEEE 754. switch (entry->type) { int64_t numerator, denominator; - case FLOAT: + case TIFFER_FLOAT: *out = *(float *) entry->p; return true; - case DOUBLE: + case TIFFER_DOUBLE: *out = *(double *) entry->p; return true; default: |