Also remove the SafeKeyFile wrapper class.
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "cacheimagedata.h"
|
||||
#include <vector>
|
||||
#include <glib/gstdio.h>
|
||||
#include "../rtengine/safekeyfile.h"
|
||||
#include "version.h"
|
||||
#include <locale.h>
|
||||
|
||||
@@ -35,7 +34,8 @@ CacheImageData::CacheImageData ()
|
||||
int CacheImageData::load (const Glib::ustring& fname)
|
||||
{
|
||||
setlocale(LC_NUMERIC, "C"); // to set decimal point to "."
|
||||
rtengine::SafeKeyFile keyFile;
|
||||
|
||||
Glib::KeyFile keyFile;
|
||||
|
||||
try {
|
||||
if (keyFile.load_from_file (fname)) {
|
||||
@@ -194,21 +194,12 @@ int CacheImageData::load (const Glib::ustring& fname)
|
||||
int CacheImageData::save (const Glib::ustring& fname)
|
||||
{
|
||||
|
||||
rtengine::SafeKeyFile keyFile;
|
||||
Glib::ustring keyData;
|
||||
|
||||
if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
|
||||
try {
|
||||
keyFile.load_from_file (fname);
|
||||
} catch (Glib::Error &err) {
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("CacheImageData::save / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str());
|
||||
}
|
||||
} catch (...) {
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("CacheImageData::save / Unknown exception while trying to save \"%s\"!\n", fname.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
Glib::KeyFile keyFile;
|
||||
keyFile.load_from_file (fname);
|
||||
|
||||
keyFile.set_string ("General", "MD5", md5);
|
||||
keyFile.set_string ("General", "Version", VERSION); // Application's version
|
||||
@@ -256,6 +247,22 @@ int CacheImageData::save (const Glib::ustring& fname)
|
||||
keyFile.set_integer ("ExtraRawInfo", "ThumbImageOffset", thumbOffset);
|
||||
}
|
||||
|
||||
keyData = keyFile.to_data ();
|
||||
|
||||
} catch (Glib::Error &err) {
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("CacheImageData::save / Error code %d while reading values from \"%s\":\n%s\n", err.code(), fname.c_str(), err.what().c_str());
|
||||
}
|
||||
} catch (...) {
|
||||
if (options.rtSettings.verbose) {
|
||||
printf("CacheImageData::save / Unknown exception while trying to save \"%s\"!\n", fname.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (keyData.empty ()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
FILE *f = g_fopen (fname.c_str (), "wt");
|
||||
|
||||
if (!f) {
|
||||
@@ -265,7 +272,7 @@ int CacheImageData::save (const Glib::ustring& fname)
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
fprintf (f, "%s", keyFile.to_data().c_str());
|
||||
fprintf (f, "%s", keyData.c_str ());
|
||||
fclose (f);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user