Avoid premature dropping of objects in pdf_dict_put

When inserting a new value into a dictionary, if replacing an existing
entry, ensure we keep the new value before dropping the old one.

This is important in the case where (for example) the existing value
is "[ object ]" and the new value is "object". If we drop the array
and that loses the only reference to object, we can find that we have
lost the value we are adding.
Ensure that BDC operators get both params.

Currently, when parsing, each time we encounter a name, we throw away
the last name we had. BDC operators are called with:

 /Name <object> BDC

If the <object> is a name, we lose the original /Name.

To fix this, parsing a name when we already have a name will cause
the name to be stored as an object.

This has various knock on effects throughout the code to read from
csi->obj rather than csi->name.

Also, ensure that when cleaning, we collect a list of the object
names in our new resources dictionary.
Don't drop objects if they have been modified.

This avoids leaks when pdf_clear_xref etc are used.