Project

General

Profile

Patch: Sort iptc data by record number when encoding

Added by Matthias Baas over 10 years ago

Hi,

I noticed that libexiv2 writes iptc data sets in the same order as they were added to the IptcData object by the application. However, the iptc spec states that records must be in numerical order (Envelope must be before Application2). Personally, I think it would make sense to enforce this requirement in the library instead of relying on the application code to get this right (as it's just one potential bug less in all the applications using libexiv2).

I have attached a small patch for your consideration. The patch modifies IptcParser::encode() which will then sort the iptc data before encoding it.

Cheers,

- Matthias -


Replies (2)

RE: Patch: Sort iptc data by record number when encoding - Added by Andreas Huggel over 10 years ago

Thanks Matthias and sorry for the late reply. I've created bug #775 for this and checked in your patch with r2477 with the only change that it now uses std::stable_sort to preserve the order of the datasets.

Andreas

RE: Patch: Sort iptc data by record number when encoding - Added by Matthias Baas over 10 years ago

No worries, I don't expect you to work fulltime on the library and I wasn't in a hurry either. :)
Thanks for applying the patch!

- Matthias -

    (1-2/2)