create new tag
view all tags

Detecting Changes between Incremental Saves

This is required so we can verify that the changes between different signings conform to the permissions.


All changes in the document will take place within objects. Fields can change various different ways within an object. Therefore, we need to compare "parts" of old and new objects to see if they have changed legally or illegally. We only need to keep records at the object level though; i.e. it's enough to know "this object has changed in an illegal way" or "a legal way".

  • Hold a 'change' bitfield per object (either as part of the xref or separately).
  • Have an internal function to set all the change values 0.
  • Have an internal function to OR a change value into a bit.
  • We can 'easily' find all objects that change between 2 xref versions and set bit 1 for those.

So, we now have all the objects changed. Now we just need to figure out which ones are OK, and which aren't.

  • Write code to compare Name Trees and Number Trees. Recursively walk the document to find such trees. If different, compare old/new. If they point to the same object numbers, set bit 2. This makes us cope with pagetrees etc being rewritten into (for example) balanced tree form, without the actual leaves changing. This will cause us to detect cases where pages change object number as being different. I don't think that is a bad thing.
  • For each field in the file, walk the field contents in a similar way to Paul's change-analysis branch. Any fields that are changed illegally, set bit 3. Any fields that are changed legally set bit 4.

Thus any field with only bit 1 set, is a problem. Any field with bit 1 and bit 3 set is an illegal field change. Anything else is fine.

-- Robin Watts - 2019-12-06


Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2019-12-06 - RobinWatts
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 2014 Artifex Software Inc