diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-05-01 16:24:15 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-05-01 16:24:15 +0200 |
commit | a30ba67504ffd12c4db499adbb5ce47a7d1f6036 (patch) | |
tree | 9ae1a7e3849dda6bbb5c578232f6f2fa5b2e7e7e /xicc/extractttag.c | |
parent | 89e99e8a827859729729dfc92d74be4a8f96f1a4 (diff) | |
parent | 094535c010320967639e8e86f974d878e80baa72 (diff) |
New release 1.7.0
Diffstat (limited to 'xicc/extractttag.c')
-rw-r--r-- | xicc/extractttag.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/xicc/extractttag.c b/xicc/extractttag.c index 79b4085..2c26bda 100644 --- a/xicc/extractttag.c +++ b/xicc/extractttag.c @@ -1,6 +1,7 @@ /* * Extract a CGATS file from an ICC profile tag. + * (Can also extract a tag of unknown format as a binary lump). * * Author: Graeme W. Gill * Date: 2008/5/18 @@ -14,6 +15,9 @@ /* * TTBD: + * + * Should uncompress ZXML type tag using zlib. + * */ @@ -28,6 +32,7 @@ #include "numlib.h" #include "icc.h" #include "xicc.h" +#include "ui.h" #define MXTGNMS 30 @@ -60,6 +65,7 @@ main(int argc, char *argv[]) { icc *icco; icTagSignature sig; icmText *ro; + icmUnknown *uro; icmFile *ifp, *ofp; int verb = 0; int size = 0; @@ -135,11 +141,14 @@ main(int argc, char *argv[]) { sig = str2tag(tag_name); - if ((ro = (icmText *)icco->read_tag(icco, sig)) == NULL) + if ((ro = (icmText *)icco->read_tag_any(icco, sig)) == NULL) { error("%d, %s",icco->errc, icco->err); + } - if (ro->ttype != icSigTextType) { - error("Tag isn't TextType"); + if (ro->ttype == icmSigUnknownType) { + uro = (icmUnknown *)ro; + } else if (ro->ttype != icSigTextType) { + error("Tag isn't TextType or UnknownType"); } if (docal) { @@ -187,8 +196,14 @@ main(int argc, char *argv[]) { error("unable to open output file '%s'",out_name); } - if (ofp->write(ofp, ro->data, 1, ro->size-1) != (ro->size-1)) { - error("writing to file '%s' failed",out_name); + if (ro->ttype == icmSigUnknownType) { + if (ofp->write(ofp, uro->data, 1, uro->size) != (uro->size)) { + error("writing to file '%s' failed",out_name); + } + } else { + if (ofp->write(ofp, ro->data, 1, ro->size-1) != (ro->size-1)) { + error("writing to file '%s' failed",out_name); + } } if (ofp->del(ofp) != 0) { |