]> git.alsa-project.org Git - alsa-tools.git/commit
hdspmixer: enhance saving of presets
authorJasmin Fazlic <superfassl@gmail.com>
Sun, 7 Feb 2021 14:50:47 +0000 (15:50 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 27 Feb 2021 08:24:08 +0000 (09:24 +0100)
commitc0e69055fade319638a79604bd3ed1f37ff764f4
treed6704d4ebca85e049ea52b8b95b860f6c41b3d19
parent82979c32e4d6cabb826221daeedac8b01789da07
hdspmixer: enhance saving of presets

Changing the version in the file header would make
a preset file not readable by older versions of the
tool. If we just append new data always at the end
of the save procedure we should have no problems
reading them with different versions, as they all
just read to a certain point and ignore the rest
of the file.

This patch implements the logic to save the presets
first to a file called file_name.tmp and appends any
extra data that would come after in a possibly present
file_name file.

Any data written by newer versions would remain in
the preset file and from now on no old version should
remove data written by newer versions.

Also since we write to a temporary file and rename
afterwards an extra feature is gained of not corrupting
the preset should we crash.

Signed-off-by: Jasmin Fazlic <superfassl@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
hdspmixer/src/HDSPMixerWindow.cxx