Fix handling of duplicate copy for local copies.

Do not use the imgid into the local-copy cache filename to have a single
original picture for all duplicate. This can save disk spaces.

Delete the local cache copy only when there is no more images (duplicate)
referencing it. Note that we also now properly delete cached XMP for
duplicate.

Note that the old scheme is kept for upward compatibility. So as long as
there is a local copy with the old naming scheme it will be used.
wb_presets: SONY RX100M2 (thanks to Matthew Harrison)
Lens IOP: Fix stack-buffer-overflow in lens_set()

READ of size 8 at 0x7fff4fa3b180 thread T0
    #0 0x7ff30bf19d87 in lens_set /home/lebedevri/darktable/src/iop/lens.c:1649

Also fixes Coverity CID1034336
Merge pull request #704 from darktable-org/fix-dup-local-copy

Fix handling of duplicate copy for local copies.