Finally fully remove the safegtk module.

This commit is contained in:
Adam Reichold 2015-12-26 16:22:06 +01:00
parent 1297f4b2ec
commit a2eea7c265
51 changed files with 132 additions and 227 deletions

View File

@ -7,7 +7,7 @@ link_directories ("${PROJECT_SOURCE_DIR}/rtexif" ${EXTRA_LIBDIR} ${GTHREAD_LIBRA
set (CAMCONSTSFILE "camconst.json") set (CAMCONSTSFILE "camconst.json")
set (RTENGINESOURCEFILES safegtk.cc colortemp.cc curves.cc flatcurves.cc diagonalcurves.cc dcraw.cc iccstore.cc color.cc set (RTENGINESOURCEFILES colortemp.cc curves.cc flatcurves.cc diagonalcurves.cc dcraw.cc iccstore.cc color.cc
dfmanager.cc ffmanager.cc gauss.cc rawimage.cc image8.cc image16.cc imagefloat.cc imagedata.cc imageio.cc improcfun.cc init.cc dcrop.cc dfmanager.cc ffmanager.cc gauss.cc rawimage.cc image8.cc image16.cc imagefloat.cc imagedata.cc imageio.cc improcfun.cc init.cc dcrop.cc
loadinitial.cc procparams.cc rawimagesource.cc demosaic_algos.cc shmap.cc simpleprocess.cc refreshmap.cc loadinitial.cc procparams.cc rawimagesource.cc demosaic_algos.cc shmap.cc simpleprocess.cc refreshmap.cc
fast_demo.cc amaze_demosaic_RT.cc CA_correct_RT.cc cfa_linedn_RT.cc green_equil_RT.cc hilite_recon.cc expo_before_b.cc fast_demo.cc amaze_demosaic_RT.cc CA_correct_RT.cc cfa_linedn_RT.cc green_equil_RT.cc hilite_recon.cc expo_before_b.cc

View File

@ -3,7 +3,6 @@
*/ */
#include "camconst.h" #include "camconst.h"
#include "settings.h" #include "settings.h"
#include "safegtk.h"
#include "rt_math.h" #include "rt_math.h"
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
@ -689,7 +688,7 @@ void CameraConstantsStore::init(Glib::ustring baseDir, Glib::ustring userSetting
Glib::ustring userFile(Glib::build_filename(userSettingsDir, "camconst.json")); Glib::ustring userFile(Glib::build_filename(userSettingsDir, "camconst.json"));
if (safe_file_test(userFile, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test(userFile, Glib::FILE_TEST_EXISTS)) {
parse_camera_constants_file(userFile); parse_camera_constants_file(userFile);
} }
} }

View File

@ -1,7 +1,6 @@
#include "clutstore.h" #include "clutstore.h"
#include "rt_math.h" #include "rt_math.h"
#include "stdimagesource.h" #include "stdimagesource.h"
#include "safegtk.h"
#include "../rtgui/options.h" #include "../rtgui/options.h"
rtengine::CLUTStore clutStore; rtengine::CLUTStore clutStore;
@ -154,7 +153,7 @@ Imagefloat* HaldCLUT::loadFile( Glib::ustring filename, Glib::ustring workingCol
Imagefloat *result = 0; Imagefloat *result = 0;
StdImageSource imgSrc; StdImageSource imgSrc;
if ( !safe_file_test( filename, Glib::FILE_TEST_EXISTS ) || imgSrc.load(filename) ) { if ( !Glib::file_test( filename, Glib::FILE_TEST_EXISTS ) || imgSrc.load(filename) ) {
return result; return result;
} }

View File

@ -19,7 +19,6 @@
#include <cstring> #include <cstring>
#include "dcp.h" #include "dcp.h"
#include "safegtk.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "iccstore.h" #include "iccstore.h"
#include "rawimagesource.h" #include "rawimagesource.h"
@ -828,7 +827,7 @@ DCPProfile::DCPProfile(Glib::ustring fname)
aDeltas1 = aDeltas2 = aLookTable = NULL; aDeltas1 = aDeltas2 = aLookTable = NULL;
FILE *pFile = safe_g_fopen(fname, "rb"); FILE *pFile = g_fopen(fname.c_str (), "rb");
TagDirectory *tagDir = ExifManager::parseTIFF(pFile, false); TagDirectory *tagDir = ExifManager::parseTIFF(pFile, false);
@ -1717,7 +1716,7 @@ void DCPStore::init (Glib::ustring rtProfileDir)
Glib::Dir* dir = NULL; Glib::Dir* dir = NULL;
try { try {
if (!safe_file_test (dirname, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (dirname, Glib::FILE_TEST_IS_DIR)) {
return; return;
} }
@ -1733,7 +1732,7 @@ void DCPStore::init (Glib::ustring rtProfileDir)
Glib::ustring sname = *i; Glib::ustring sname = *i;
// ignore directories // ignore directories
if (!safe_file_test (fname, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (fname, Glib::FILE_TEST_IS_DIR)) {
size_t lastdot = sname.find_last_of ('.'); size_t lastdot = sname.find_last_of ('.');
if (lastdot != Glib::ustring::npos && lastdot <= sname.size() - 4 && (!sname.casefold().compare (lastdot, 4, ".dcp"))) { if (lastdot != Glib::ustring::npos && lastdot <= sname.size() - 4 && (!sname.casefold().compare (lastdot, 4, ".dcp"))) {
@ -1781,7 +1780,7 @@ DCPProfile* DCPStore::getStdProfile(Glib::ustring camShortName)
bool DCPStore::isValidDCPFileName(Glib::ustring filename) const bool DCPStore::isValidDCPFileName(Glib::ustring filename) const
{ {
if (!safe_file_test (filename, Glib::FILE_TEST_EXISTS) || safe_file_test (filename, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (filename, Glib::FILE_TEST_EXISTS) || Glib::file_test (filename, Glib::FILE_TEST_IS_DIR)) {
return false; return false;
} }

View File

@ -20,7 +20,6 @@
#include "../rtgui/options.h" #include "../rtgui/options.h"
#include <giomm.h> #include <giomm.h>
#include "../rtgui/guiutils.h" #include "../rtgui/guiutils.h"
#include "safegtk.h"
#include "rawimage.h" #include "rawimage.h"
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>

View File

@ -19,7 +19,6 @@
#include "ffmanager.h" #include "ffmanager.h"
#include "../rtgui/options.h" #include "../rtgui/options.h"
#include <giomm.h> #include <giomm.h>
#include "safegtk.h"
#include "rawimage.h" #include "rawimage.h"
#include <sstream> #include <sstream>
#include <cstdio> #include <cstdio>

View File

@ -16,18 +16,21 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "iccstore.h"
#include <cstring>
#ifdef WIN32 #ifdef WIN32
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "iccstore.h"
#include "iccmatrices.h"
#include <glib/gstdio.h>
#include "safegtk.h"
#include "../rtgui/options.h"
#include <cstring> #include <glib/gstdio.h>
#include "iccmatrices.h"
#include "../rtgui/options.h"
namespace namespace
{ {
@ -59,7 +62,7 @@ void loadProfiles (const Glib::ustring& dirName,
const Glib::ustring filePath = Glib::build_filename (dirName, fileName); const Glib::ustring filePath = Glib::build_filename (dirName, fileName);
if (!safe_file_test (filePath, Glib::FILE_TEST_IS_REGULAR)) if (!Glib::file_test (filePath, Glib::FILE_TEST_IS_REGULAR))
continue; continue;
Glib::ustring name = fileName.substr (0, fileName.size() - 4); Glib::ustring name = fileName.substr (0, fileName.size() - 4);
@ -356,8 +359,9 @@ cmsHPROFILE ICCStore::getProfile (const Glib::ustring& name) const
const ProfileMap::const_iterator r = fileProfiles.find (name); const ProfileMap::const_iterator r = fileProfiles.find (name);
if (r != fileProfiles.end ()) if (r != fileProfiles.end ()) {
return r->second; return r->second;
}
if (name.compare (0, 5, "file:") == 0) { if (name.compare (0, 5, "file:") == 0) {
const ProfileContent content (name.substr (5)); const ProfileContent content (name.substr (5));
@ -371,7 +375,7 @@ cmsHPROFILE ICCStore::getProfile (const Glib::ustring& name) const
} }
} }
return NULL; return nullptr;
} }
cmsHPROFILE ICCStore::getStdProfile (const Glib::ustring& name) const cmsHPROFILE ICCStore::getStdProfile (const Glib::ustring& name) const
@ -418,7 +422,6 @@ ProfileContent ICCStore::getContent (const Glib::ustring& name) const
std::uint8_t ICCStore::getInputIntents (cmsHPROFILE profile) const std::uint8_t ICCStore::getInputIntents (cmsHPROFILE profile) const
{ {
MyMutex::MyLock lock (mutex_); MyMutex::MyLock lock (mutex_);
return getSupportedIntents (profile, LCMS_USED_AS_INPUT); return getSupportedIntents (profile, LCMS_USED_AS_INPUT);
@ -426,7 +429,6 @@ std::uint8_t ICCStore::getInputIntents (cmsHPROFILE profile) const
std::uint8_t ICCStore::getOutputIntents (cmsHPROFILE profile) const std::uint8_t ICCStore::getOutputIntents (cmsHPROFILE profile) const
{ {
MyMutex::MyLock lock (mutex_); MyMutex::MyLock lock (mutex_);
return getSupportedIntents (profile, LCMS_USED_AS_OUTPUT); return getSupportedIntents (profile, LCMS_USED_AS_OUTPUT);
@ -434,7 +436,6 @@ std::uint8_t ICCStore::getOutputIntents (cmsHPROFILE profile) const
std::uint8_t ICCStore::getProofIntents (cmsHPROFILE profile) const std::uint8_t ICCStore::getProofIntents (cmsHPROFILE profile) const
{ {
MyMutex::MyLock lock (mutex_); MyMutex::MyLock lock (mutex_);
return getSupportedIntents (profile, LCMS_USED_AS_PROOF); return getSupportedIntents (profile, LCMS_USED_AS_PROOF);
@ -503,7 +504,7 @@ void ICCStore::findDefaultMonitorProfile ()
ProfileContent::ProfileContent (const Glib::ustring& fileName) : data(NULL), length(0) ProfileContent::ProfileContent (const Glib::ustring& fileName) : data(NULL), length(0)
{ {
FILE* f = safe_g_fopen (fileName, "rb"); FILE* f = g_fopen (fileName.c_str (), "rb");
if (!f) { if (!f) {
return; return;

View File

@ -19,7 +19,6 @@
#include "imagedata.h" #include "imagedata.h"
#include "iptcpairs.h" #include "iptcpairs.h"
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include "safegtk.h"
using namespace rtengine; using namespace rtengine;
@ -53,7 +52,7 @@ ImageData::ImageData (Glib::ustring fname, RawMetaDataLocation* ri)
iptc = NULL; iptc = NULL;
if (ri && (ri->exifBase >= 0 || ri->ciffBase >= 0)) { if (ri && (ri->exifBase >= 0 || ri->ciffBase >= 0)) {
FILE* f = safe_g_fopen (fname, "rb"); FILE* f = g_fopen (fname.c_str (), "rb");
if (f) { if (f) {
if (ri->exifBase >= 0) { if (ri->exifBase >= 0) {
@ -74,18 +73,18 @@ ImageData::ImageData (Glib::ustring fname, RawMetaDataLocation* ri)
extractInfo (); extractInfo ();
} }
} else if ((dotpos < fname.size() - 3 && !fname.casefold().compare (dotpos, 4, ".jpg")) || (dotpos < fname.size() - 4 && !fname.casefold().compare (dotpos, 5, ".jpeg"))) { } else if ((dotpos < fname.size() - 3 && !fname.casefold().compare (dotpos, 4, ".jpg")) || (dotpos < fname.size() - 4 && !fname.casefold().compare (dotpos, 5, ".jpeg"))) {
FILE* f = safe_g_fopen (fname, "rb"); FILE* f = g_fopen (fname.c_str (), "rb");
if (f) { if (f) {
root = rtexif::ExifManager::parseJPEG (f); root = rtexif::ExifManager::parseJPEG (f);
extractInfo (); extractInfo ();
fclose (f); fclose (f);
FILE* ff = safe_g_fopen (fname, "rb"); FILE* ff = g_fopen (fname.c_str (), "rb");
iptc = iptc_data_new_from_jpeg_file (ff); iptc = iptc_data_new_from_jpeg_file (ff);
fclose (ff); fclose (ff);
} }
} else if ((dotpos < fname.size() - 3 && !fname.casefold().compare (dotpos, 4, ".tif")) || (dotpos < fname.size() - 4 && !fname.casefold().compare (dotpos, 5, ".tiff"))) { } else if ((dotpos < fname.size() - 3 && !fname.casefold().compare (dotpos, 4, ".tif")) || (dotpos < fname.size() - 4 && !fname.casefold().compare (dotpos, 5, ".tiff"))) {
FILE* f = safe_g_fopen (fname, "rb"); FILE* f = g_fopen (fname.c_str (), "rb");
if (f) { if (f) {
root = rtexif::ExifManager::parseTIFF (f); root = rtexif::ExifManager::parseTIFF (f);

View File

@ -36,7 +36,6 @@
#endif #endif
#include "imageio.h" #include "imageio.h"
#include "safegtk.h"
#include "iptcpairs.h" #include "iptcpairs.h"
#include "iccjpeg.h" #include "iccjpeg.h"
#include "color.h" #include "color.h"
@ -208,7 +207,7 @@ void png_flush(png_struct_def *png_ptr);
int ImageIO::getPNGSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat, IIOSampleArrangement &sArrangement) int ImageIO::getPNGSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat, IIOSampleArrangement &sArrangement)
{ {
FILE *file = safe_g_fopen (fname, "rb"); FILE *file = g_fopen (fname.c_str (), "rb");
if (!file) { if (!file) {
return IMIO_CANNOTREADFILE; return IMIO_CANNOTREADFILE;
@ -282,7 +281,7 @@ int ImageIO::getPNGSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat,
int ImageIO::loadPNG (Glib::ustring fname) int ImageIO::loadPNG (Glib::ustring fname)
{ {
FILE *file = safe_g_fopen (fname, "rb"); FILE *file = g_fopen (fname.c_str (), "rb");
if (!file) { if (!file) {
return IMIO_CANNOTREADFILE; return IMIO_CANNOTREADFILE;
@ -531,7 +530,7 @@ int ImageIO::loadJPEGFromMemory (const char* buffer, int bufsize)
int ImageIO::loadJPEG (Glib::ustring fname) int ImageIO::loadJPEG (Glib::ustring fname)
{ {
FILE *file = safe_g_fopen(fname, "rb"); FILE *file = g_fopen(fname.c_str (), "rb");
if (!file) { if (!file) {
return IMIO_CANNOTREADFILE; return IMIO_CANNOTREADFILE;

View File

@ -19,7 +19,6 @@
#include <cstring> #include <cstring>
#include "lcp.h" #include "lcp.h"
#include "safegtk.h"
#include "iccmatrices.h" #include "iccmatrices.h"
#include "iccstore.h" #include "iccstore.h"
#include "rawimagesource.h" #include "rawimagesource.h"
@ -303,7 +302,7 @@ LCPProfile::LCPProfile(Glib::ustring fname)
persModelCount = 0; persModelCount = 0;
*inInvalidTag = 0; *inInvalidTag = 0;
FILE *pFile = safe_g_fopen(fname, "rb"); FILE *pFile = g_fopen(fname.c_str (), "rb");
bool done; bool done;
@ -807,7 +806,7 @@ LCPProfile* LCPStore::getProfile (Glib::ustring filename)
bool LCPStore::isValidLCPFileName(Glib::ustring filename) const bool LCPStore::isValidLCPFileName(Glib::ustring filename) const
{ {
if (!safe_file_test (filename, Glib::FILE_TEST_EXISTS) || safe_file_test (filename, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (filename, Glib::FILE_TEST_EXISTS) || Glib::file_test (filename, Glib::FILE_TEST_IS_DIR)) {
return false; return false;
} }
@ -828,7 +827,7 @@ Glib::ustring LCPStore::getDefaultCommonDirectory() const
WideCharToMultiByte(CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0); WideCharToMultiByte(CP_UTF8, 0, pathW, -1, pathA, MAX_PATH, 0, 0);
Glib::ustring fullDir = Glib::ustring(pathA) + Glib::ustring("\\Adobe\\CameraRaw\\LensProfiles\\1.0"); Glib::ustring fullDir = Glib::ustring(pathA) + Glib::ustring("\\Adobe\\CameraRaw\\LensProfiles\\1.0");
if (safe_file_test(fullDir, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (fullDir, Glib::FILE_TEST_IS_DIR)) {
dir = fullDir; dir = fullDir;
} }
} }

View File

@ -19,7 +19,6 @@
#include "myfile.h" #include "myfile.h"
#include <cstdarg> #include <cstdarg>
#include <glibmm.h> #include <glibmm.h>
#include "safegtk.h"
#ifdef BZIP_SUPPORT #ifdef BZIP_SUPPORT
#include <bzlib.h> #include <bzlib.h>
#endif #endif
@ -58,6 +57,7 @@ int munmap(void *start, size_t length)
#else // WIN32 #else // WIN32
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -96,7 +96,7 @@ IMFILE* fopen (const char* fname)
if ( fstat(fd, &stat_buffer) < 0 ) { if ( fstat(fd, &stat_buffer) < 0 ) {
printf("no stat\n"); printf("no stat\n");
close(fd); close (fd);
return 0; return 0;
} }

View File

@ -16,10 +16,9 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
//#include <glib/gstdio.h> #include <glib/gstdio.h>
#include "procparams.h" #include "procparams.h"
#include "rt_math.h" #include "rt_math.h"
#include "safegtk.h"
#include "safekeyfile.h" #include "safekeyfile.h"
#include "dcp.h" #include "dcp.h"
#include "../rtgui/multilangmgr.h" #include "../rtgui/multilangmgr.h"
@ -3385,7 +3384,7 @@ int ProcParams::write (Glib::ustring &fname, Glib::ustring &content) const
if (fname.length()) { if (fname.length()) {
FILE *f; FILE *f;
f = safe_g_fopen (fname, "wt"); f = g_fopen (fname.c_str (), "wt");
if (f == NULL) { if (f == NULL) {
error = 1; error = 1;
@ -3414,7 +3413,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
pedited->set(false); pedited->set(false);
} }
FILE* f = safe_g_fopen (fname, "rt"); FILE* f = g_fopen (fname.c_str (), "rt");
if (!f) { if (!f) {
return 1; return 1;

View File

@ -13,7 +13,6 @@
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include "safegtk.h"
namespace rtengine namespace rtengine
{ {

View File

@ -34,7 +34,6 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <csetjmp> #include <csetjmp>
#include "safekeyfile.h" #include "safekeyfile.h"
#include "safegtk.h"
#include "rawimage.h" #include "rawimage.h"
#include "jpeg.h" #include "jpeg.h"
#include "../rtgui/ppversion.h" #include "../rtgui/ppversion.h"
@ -1653,7 +1652,7 @@ bool Thumbnail::writeImage (const Glib::ustring& fname, int format)
Glib::ustring fullFName = fname + ".rtti"; Glib::ustring fullFName = fname + ".rtti";
FILE* f = safe_g_fopen (fullFName, "wb"); FILE* f = g_fopen (fullFName.c_str (), "wb");
if (!f) { if (!f) {
return false; return false;
@ -1692,11 +1691,11 @@ bool Thumbnail::readImage (const Glib::ustring& fname)
Glib::ustring fullFName = fname + ".rtti"; Glib::ustring fullFName = fname + ".rtti";
if (!safe_file_test (fullFName, Glib::FILE_TEST_EXISTS)) { if (!Glib::file_test (fullFName, Glib::FILE_TEST_EXISTS)) {
return false; return false;
} }
FILE* f = safe_g_fopen (fullFName, "rb"); FILE* f = g_fopen (fullFName.c_str (), "rb");
if (!f) { if (!f) {
return false; return false;
@ -1837,7 +1836,7 @@ bool Thumbnail::writeData (const Glib::ustring& fname)
MyMutex::MyLock thmbLock(thumbMutex); MyMutex::MyLock thmbLock(thumbMutex);
try { try {
if( safe_file_test(fname, Glib::FILE_TEST_EXISTS) ) { if( Glib::file_test(fname, Glib::FILE_TEST_EXISTS) ) {
keyFile.load_from_file (fname); keyFile.load_from_file (fname);
} }
} catch (Glib::Error &err) { } catch (Glib::Error &err) {
@ -1867,7 +1866,7 @@ bool Thumbnail::writeData (const Glib::ustring& fname)
Glib::ArrayHandle<double> cm ((double*)colorMatrix, 9, Glib::OWNERSHIP_NONE); Glib::ArrayHandle<double> cm ((double*)colorMatrix, 9, Glib::OWNERSHIP_NONE);
keyFile.set_double_list ("LiveThumbData", "ColorMatrix", cm); keyFile.set_double_list ("LiveThumbData", "ColorMatrix", cm);
FILE *f = safe_g_fopen (fname, "wt"); FILE *f = g_fopen (fname.c_str (), "wt");
if (!f) { if (!f) {
if (options.rtSettings.verbose) { if (options.rtSettings.verbose) {
@ -1886,7 +1885,7 @@ bool Thumbnail::writeData (const Glib::ustring& fname)
bool Thumbnail::readEmbProfile (const Glib::ustring& fname) bool Thumbnail::readEmbProfile (const Glib::ustring& fname)
{ {
FILE* f = safe_g_fopen (fname, "rb"); FILE* f = g_fopen (fname.c_str (), "rb");
if (!f) { if (!f) {
embProfileData = NULL; embProfileData = NULL;
@ -1910,7 +1909,7 @@ bool Thumbnail::writeEmbProfile (const Glib::ustring& fname)
{ {
if (embProfileData) { if (embProfileData) {
FILE* f = safe_g_fopen(fname, "wb"); FILE* f = g_fopen(fname.c_str (), "wb");
if (f) { if (f) {
fwrite (embProfileData, 1, embProfileLength, f); fwrite (embProfileData, 1, embProfileLength, f);
@ -1925,7 +1924,7 @@ bool Thumbnail::writeEmbProfile (const Glib::ustring& fname)
bool Thumbnail::readAEHistogram (const Glib::ustring& fname) bool Thumbnail::readAEHistogram (const Glib::ustring& fname)
{ {
FILE* f = safe_g_fopen (fname, "rb"); FILE* f = g_fopen (fname.c_str (), "rb");
if (!f) { if (!f) {
aeHistogram(0); aeHistogram(0);
@ -1943,7 +1942,7 @@ bool Thumbnail::writeAEHistogram (const Glib::ustring& fname)
{ {
if (aeHistogram) { if (aeHistogram) {
FILE* f = safe_g_fopen (fname, "wb"); FILE* f = g_fopen (fname.c_str (), "wb");
if (f) { if (f) {
fwrite (&aeHistogram[0], 1, (65536 >> aeHistCompression)*sizeof(aeHistogram[0]), f); fwrite (&aeHistogram[0], 1, (65536 >> aeHistCompression)*sizeof(aeHistogram[0]), f);

View File

@ -1,42 +0,0 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
* Copyright (c) 2010 Sasha Vasko <sasha@aftercode.net>
* Copyright (c) 2010 Oliver Duis <www.oliverduis.de>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "safegtk.h"
#include <fcntl.h>
#include <cstdio>
#include <memory>
#include <glib/gstdio.h>
#ifdef WIN32
#include <windows.h>
#endif
FILE * safe_g_fopen(const Glib::ustring& src, const gchar *mode)
{
return g_fopen(src.c_str(), mode);
}
bool safe_file_test (const Glib::ustring& filename, Glib::FileTest test)
{
return Glib::file_test (filename, test);
}

View File

@ -1,11 +0,0 @@
#ifndef SAFE_GTK_H_INCLUDED
#define SAFE_GTK_H_INCLUDED
#include <gtkmm.h>
#include <glibmm.h>
#include <giomm.h>
FILE * safe_g_fopen(const Glib::ustring& src, const gchar *mode);
bool safe_file_test (const Glib::ustring& filename, Glib::FileTest test);
#endif

View File

@ -25,9 +25,11 @@
#include <sstream> #include <sstream>
#include <stdint.h> #include <stdint.h>
#include "../rtgui/cacheimagedata.h" #include <glib/gstdio.h>
#include "rtexif.h" #include "rtexif.h"
#include "../rtengine/safegtk.h"
#include "../rtgui/cacheimagedata.h"
#include "../rtgui/version.h" #include "../rtgui/version.h"
#include "../rtgui/ppversion.h" #include "../rtgui/ppversion.h"
@ -274,7 +276,7 @@ bool TagDirectory::CPBDump (const Glib::ustring &commFName, const Glib::ustring
if (!keyFile) { if (!keyFile) {
// open the file in write mode // open the file in write mode
f = safe_g_fopen (commFName, "wt"); f = g_fopen (commFName.c_str (), "wt");
if (f == NULL) { if (f == NULL) {
printf("TagDirectory::keyFileDump(\"%s\") >>> Error: unable to open file with write access!\n", commFName.c_str()); printf("TagDirectory::keyFileDump(\"%s\") >>> Error: unable to open file with write access!\n", commFName.c_str());

View File

@ -33,7 +33,6 @@
#include "filecatalog.h" #include "filecatalog.h"
#include "batchqueuebuttonset.h" #include "batchqueuebuttonset.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
using namespace std; using namespace std;
@ -861,7 +860,7 @@ Glib::ustring BatchQueue::autoCompleteFileName (const Glib::ustring& fileName, c
fname = Glib::ustring::compose ("%1-%2.%3", Glib::build_filename (dstdir, dstfname), tries, format); fname = Glib::ustring::compose ("%1-%2.%3", Glib::build_filename (dstdir, dstfname), tries, format);
} }
int fileExists = safe_file_test (fname, Glib::FILE_TEST_EXISTS); int fileExists = Glib::file_test (fname, Glib::FILE_TEST_EXISTS);
if (inOverwriteMode && fileExists) { if (inOverwriteMode && fileExists) {
if (::g_remove (fname.c_str ()) != 0) { if (::g_remove (fname.c_str ()) != 0) {

View File

@ -22,7 +22,6 @@
#include "multilangmgr.h" #include "multilangmgr.h"
#include "rtwindow.h" #include "rtwindow.h"
#include "soundman.h" #include "soundman.h"
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
struct BQProcessLoaded { struct BQProcessLoaded {
@ -39,7 +38,7 @@ int processLoadedBatchQueueUIThread (void* data)
static Glib::ustring makeFolderLabel(Glib::ustring path) static Glib::ustring makeFolderLabel(Glib::ustring path)
{ {
if (!safe_file_test (path, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
return "(" + M("GENERAL_NONE") + ")"; return "(" + M("GENERAL_NONE") + ")";
} }
@ -115,7 +114,7 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog)
outdirFolder->signal_current_folder_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::pathFolderChanged)); outdirFolder->signal_current_folder_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::pathFolderChanged));
outdirFolder->set_tooltip_markup (M("PREFERENCES_OUTDIRFOLDERHINT")); outdirFolder->set_tooltip_markup (M("PREFERENCES_OUTDIRFOLDERHINT"));
if (safe_file_test (options.savePathFolder, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (options.savePathFolder, Glib::FILE_TEST_IS_DIR)) {
outdirFolder->set_current_folder (options.savePathFolder); outdirFolder->set_current_folder (options.savePathFolder);
} }
@ -333,8 +332,8 @@ void BatchQueuePanel::pathFolderButtonPressed ()
int result = fc.run(); int result = fc.run();
if (result == Gtk::RESPONSE_OK) { if (result == Gtk::RESPONSE_OK) {
if (safe_file_test(fc.get_filename(), Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test(fc.get_current_folder(), Glib::FILE_TEST_IS_DIR)) {
options.savePathFolder = fc.get_filename(); options.savePathFolder = fc.get_filename ();
outdirFolderButton->set_label(makeFolderLabel(options.savePathFolder)); outdirFolderButton->set_label(makeFolderLabel(options.savePathFolder));
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
#include "bayerpreprocess.h" #include "bayerpreprocess.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
using namespace rtengine; using namespace rtengine;

View File

@ -18,7 +18,6 @@
*/ */
#include "bayerrawexposure.h" #include "bayerrawexposure.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
using namespace rtengine; using namespace rtengine;

View File

@ -20,7 +20,6 @@
#include <vector> #include <vector>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include "../rtengine/safekeyfile.h" #include "../rtengine/safekeyfile.h"
#include "../rtengine/safegtk.h"
#include "version.h" #include "version.h"
#include <locale.h> #include <locale.h>
@ -197,7 +196,7 @@ int CacheImageData::save (const Glib::ustring& fname)
rtengine::SafeKeyFile keyFile; rtengine::SafeKeyFile keyFile;
if (safe_file_test(fname, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
try { try {
keyFile.load_from_file (fname); keyFile.load_from_file (fname);
} catch (Glib::Error &err) { } catch (Glib::Error &err) {
@ -257,7 +256,7 @@ int CacheImageData::save (const Glib::ustring& fname)
keyFile.set_integer ("ExtraRawInfo", "ThumbImageOffset", thumbOffset); keyFile.set_integer ("ExtraRawInfo", "ThumbImageOffset", thumbOffset);
} }
FILE *f = safe_g_fopen (fname, "wt"); FILE *f = g_fopen (fname.c_str (), "wt");
if (!f) { if (!f) {
if (options.rtSettings.verbose) { if (options.rtSettings.verbose) {

View File

@ -24,7 +24,6 @@
#include "diagonalcurveeditorsubgroup.h" #include "diagonalcurveeditorsubgroup.h"
#include "flatcurveeditorsubgroup.h" #include "flatcurveeditorsubgroup.h"
#include "multilangmgr.h" #include "multilangmgr.h"
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring groupLabel) : curveDir(curveDir), curve_reset(NULL), CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring groupLabel) : curveDir(curveDir), curve_reset(NULL),

View File

@ -19,7 +19,6 @@
#include "darkframe.h" #include "darkframe.h"
#include "options.h" #include "options.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
#include "rtimage.h" #include "rtimage.h"
@ -81,7 +80,7 @@ void DarkFrame::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi
dfAuto->set_inconsistent(!pedited->raw.dfAuto ); dfAuto->set_inconsistent(!pedited->raw.dfAuto );
} }
if (safe_file_test (pp->raw.dark_frame, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (pp->raw.dark_frame, Glib::FILE_TEST_EXISTS)) {
darkFrameFile->set_filename (pp->raw.dark_frame); darkFrameFile->set_filename (pp->raw.dark_frame);
} else { } else {
darkFrameReset(); darkFrameReset();

View File

@ -25,8 +25,6 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include "../rtengine/safegtk.h"
#include "guiutils.h" #include "guiutils.h"
#include "rtimage.h" #include "rtimage.h"
#include "multilangmgr.h" #include "multilangmgr.h"
@ -336,8 +334,8 @@ void DirBrowser::updateDir (const Gtk::TreeModel::iterator& iter)
change = false; change = false;
for (Gtk::TreeModel::iterator it = iter->children().begin(); it != iter->children().end(); it++) for (Gtk::TreeModel::iterator it = iter->children().begin(); it != iter->children().end(); it++)
if (!safe_file_test (it->get_value (dtColumns.dirname), Glib::FILE_TEST_EXISTS) if (!Glib::file_test (it->get_value (dtColumns.dirname), Glib::FILE_TEST_EXISTS)
|| !safe_file_test (it->get_value (dtColumns.dirname), Glib::FILE_TEST_IS_DIR)) { || !Glib::file_test (it->get_value (dtColumns.dirname), Glib::FILE_TEST_IS_DIR)) {
GThreadLock lock; GThreadLock lock;
dirTreeModel->erase (it); dirTreeModel->erase (it);
change = true; change = true;
@ -381,7 +379,7 @@ void DirBrowser::row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewC
Glib::ustring dname = dirTreeModel->get_iter (path)->get_value (dtColumns.dirname); Glib::ustring dname = dirTreeModel->get_iter (path)->get_value (dtColumns.dirname);
if (safe_file_test (dname, Glib::FILE_TEST_IS_DIR)) if (Glib::file_test (dname, Glib::FILE_TEST_IS_DIR))
dirSelectionSignal (dname, Glib::ustring()); dirSelectionSignal (dname, Glib::ustring());
} }
@ -478,7 +476,7 @@ void DirBrowser::open (const Glib::ustring& dirname, const Glib::ustring& fileNa
void DirBrowser::file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName) void DirBrowser::file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName)
{ {
if (!file || !safe_file_test (dirName, Glib::FILE_TEST_IS_DIR) || event_type == Gio::FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED) { if (!file || !Glib::file_test (dirName, Glib::FILE_TEST_IS_DIR) || event_type == Gio::FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED) {
return; return;
} }

View File

@ -21,7 +21,6 @@
#include <iostream> #include <iostream>
#include "../rtengine/safegtk.h"
#include "../rtengine/imagesource.h" #include "../rtengine/imagesource.h"
#include "../rtengine/iccstore.h" #include "../rtengine/iccstore.h"
#include "soundman.h" #include "soundman.h"
@ -492,7 +491,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel)
show_all (); show_all ();
/* /*
// save as dialog // save as dialog
if (safe_file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR)) if (Glib::file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR))
saveAsDialog = new SaveAsDialog (options.lastSaveAsPath); saveAsDialog = new SaveAsDialog (options.lastSaveAsPath);
else else
saveAsDialog = new SaveAsDialog (safe_get_user_picture_dir()); saveAsDialog = new SaveAsDialog (safe_get_user_picture_dir());
@ -789,7 +788,7 @@ void EditorPanel::close ()
navigator->previewWindow->setPreviewHandler (NULL); navigator->previewWindow->setPreviewHandler (NULL);
// If the file was deleted somewhere, the openThm.descreaseRef delete the object, but we don't know here // If the file was deleted somewhere, the openThm.descreaseRef delete the object, but we don't know here
if (safe_file_test(fname, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
openThm->removeThumbnailListener (this); openThm->removeThumbnailListener (this);
openThm->decreaseRef (); openThm->decreaseRef ();
} }
@ -803,7 +802,7 @@ void EditorPanel::saveProfile ()
} }
// If the file was deleted, do not generate ghost entries // If the file was deleted, do not generate ghost entries
if (safe_file_test(fname, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
ProcParams params; ProcParams params;
ipc->getParams (&params); ipc->getParams (&params);
@ -1543,7 +1542,7 @@ void EditorPanel::saveAsPressed ()
SaveAsDialog* saveAsDialog; SaveAsDialog* saveAsDialog;
if (safe_file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR)) {
saveAsDialog = new SaveAsDialog (options.lastSaveAsPath); saveAsDialog = new SaveAsDialog (options.lastSaveAsPath);
} else { } else {
saveAsDialog = new SaveAsDialog (PlacesBrowser::userPicturesDir ()); saveAsDialog = new SaveAsDialog (PlacesBrowser::userPicturesDir ());
@ -1590,7 +1589,7 @@ void EditorPanel::saveAsPressed ()
fnameTemp = Glib::ustring::compose ("%1-%2.%3", Glib::build_filename (dstdir, dstfname), tries, dstext); fnameTemp = Glib::ustring::compose ("%1-%2.%3", Glib::build_filename (dstdir, dstfname), tries, dstext);
} }
if (!safe_file_test (fnameTemp, Glib::FILE_TEST_EXISTS)) { if (!Glib::file_test (fnameTemp, Glib::FILE_TEST_EXISTS)) {
fnameOut = fnameTemp; fnameOut = fnameTemp;
fnameOK = true; fnameOK = true;
break; break;
@ -1703,7 +1702,7 @@ bool EditorPanel::idle_sendToGimp( ProgressConnector<rtengine::IImage16*> *pc, G
int tries = 1; int tries = 1;
while (safe_file_test (fileName, Glib::FILE_TEST_EXISTS) && tries < 1000) { while (Glib::file_test (fileName, Glib::FILE_TEST_EXISTS) && tries < 1000) {
fileName = Glib::ustring::compose("%1-%2.%3", fname, tries, sf.format); fileName = Glib::ustring::compose("%1-%2.%3", fname, tries, sf.format);
tries++; tries++;
} }

View File

@ -25,7 +25,6 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include "../rtengine/rt_math.h" #include "../rtengine/rt_math.h"
#include "../rtengine/safegtk.h"
#include "guiutils.h" #include "guiutils.h"
#include "options.h" #include "options.h"
@ -1026,7 +1025,7 @@ void FileCatalog::copyMoveRequested (std::vector<FileBrowserEntry*> tbe, bool m
while(!filecopymovecomplete) { while(!filecopymovecomplete) {
// check for filename conflicts at destination - prevent overwriting (actually RT will crash on overwriting attempt) // check for filename conflicts at destination - prevent overwriting (actually RT will crash on overwriting attempt)
if (!safe_file_test(dest_fPath, Glib::FILE_TEST_EXISTS) && !safe_file_test(dest_fPath_param, Glib::FILE_TEST_EXISTS)) { if (!Glib::file_test(dest_fPath, Glib::FILE_TEST_EXISTS) && !Glib::file_test(dest_fPath_param, Glib::FILE_TEST_EXISTS)) {
// copy/move file to destination // copy/move file to destination
Glib::RefPtr<Gio::File> dest_file = Gio::File::create_for_path ( dest_fPath ); Glib::RefPtr<Gio::File> dest_file = Gio::File::create_for_path ( dest_fPath );
@ -1047,12 +1046,12 @@ void FileCatalog::copyMoveRequested (std::vector<FileBrowserEntry*> tbe, bool m
// attempt to copy/move paramFile only if it exist next to the src // attempt to copy/move paramFile only if it exist next to the src
Glib::RefPtr<Gio::File> scr_param = Gio::File::create_for_path ( src_fPath + paramFileExtension ); Glib::RefPtr<Gio::File> scr_param = Gio::File::create_for_path ( src_fPath + paramFileExtension );
if (safe_file_test( src_fPath + paramFileExtension, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test( src_fPath + paramFileExtension, Glib::FILE_TEST_EXISTS)) {
Glib::RefPtr<Gio::File> dest_param = Gio::File::create_for_path ( dest_fPath_param); Glib::RefPtr<Gio::File> dest_param = Gio::File::create_for_path ( dest_fPath_param);
// copy/move paramFile to destination // copy/move paramFile to destination
if (moveRequested) { if (moveRequested) {
if (safe_file_test( dest_fPath + paramFileExtension, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test( dest_fPath + paramFileExtension, Glib::FILE_TEST_EXISTS)) {
// profile already got copied to destination from cache after cacheMgr->renameEntry // profile already got copied to destination from cache after cacheMgr->renameEntry
// delete source profile as cleanup // delete source profile as cleanup
::g_remove ((src_fPath + paramFileExtension).c_str ()); ::g_remove ((src_fPath + paramFileExtension).c_str ());
@ -1257,7 +1256,7 @@ void FileCatalog::renameRequested (std::vector<FileBrowserEntry*> tbe)
Glib::ustring nfname = Glib::build_filename (dirName, nBaseName); Glib::ustring nfname = Glib::build_filename (dirName, nBaseName);
/* check if filename already exists*/ /* check if filename already exists*/
if (safe_file_test (nfname, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (nfname, Glib::FILE_TEST_EXISTS)) {
Glib::ustring msg_ = Glib::ustring("<b>") + nfname + ": " + M("MAIN_MSG_ALREADYEXISTS") + "</b>"; Glib::ustring msg_ = Glib::ustring("<b>") + nfname + ": " + M("MAIN_MSG_ALREADYEXISTS") + "</b>";
Gtk::MessageDialog msgd (msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); Gtk::MessageDialog msgd (msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run (); msgd.run ();
@ -1703,7 +1702,7 @@ void FileCatalog::reparseDirectory ()
return; return;
} }
if (!safe_file_test (selectedDirectory, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (selectedDirectory, Glib::FILE_TEST_IS_DIR)) {
closeDir (); closeDir ();
return; return;
} }
@ -1715,7 +1714,7 @@ void FileCatalog::reparseDirectory ()
std::vector<Glib::ustring> fileNamesToDel; std::vector<Glib::ustring> fileNamesToDel;
for (size_t i = 0; i < t.size(); i++) for (size_t i = 0; i < t.size(); i++)
if (!safe_file_test (t[i]->filename, Glib::FILE_TEST_EXISTS)) { if (!Glib::file_test (t[i]->filename, Glib::FILE_TEST_EXISTS)) {
fileNamesToDel.push_back (t[i]->filename); fileNamesToDel.push_back (t[i]->filename);
} }
@ -2049,7 +2048,7 @@ void FileCatalog::buttonBrowsePathPressed ()
// handle shortcuts in the BrowsePath -- END // handle shortcuts in the BrowsePath -- END
// validate the path // validate the path
if (safe_file_test(BrowsePathValue, Glib::FILE_TEST_IS_DIR) && selectDir) { if (Glib::file_test(BrowsePathValue, Glib::FILE_TEST_IS_DIR) && selectDir) {
selectDir (BrowsePathValue); selectDir (BrowsePathValue);
} else } else
// error, likely path not found: show red arrow // error, likely path not found: show red arrow

View File

@ -18,8 +18,6 @@
*/ */
#include "filepanel.h" #include "filepanel.h"
#include "../rtengine/safegtk.h"
#include "rtwindow.h" #include "rtwindow.h"
#include "inspector.h" #include "inspector.h"
#include "placesbrowser.h" #include "placesbrowser.h"
@ -179,7 +177,7 @@ void FilePanel::init ()
dirBrowser->fillDirTree (); dirBrowser->fillDirTree ();
placesBrowser->refreshPlacesList (); placesBrowser->refreshPlacesList ();
if (argv1 != "" && safe_file_test (argv1, Glib::FILE_TEST_IS_DIR)) { if (argv1 != "" && Glib::file_test (argv1, Glib::FILE_TEST_IS_DIR)) {
dirBrowser->open (argv1); dirBrowser->open (argv1);
} else { } else {
if (options.startupDir == STARTUPDIR_HOME) { if (options.startupDir == STARTUPDIR_HOME) {
@ -187,7 +185,7 @@ void FilePanel::init ()
} else if (options.startupDir == STARTUPDIR_CURRENT) { } else if (options.startupDir == STARTUPDIR_CURRENT) {
dirBrowser->open (argv0); dirBrowser->open (argv0);
} else if (options.startupDir == STARTUPDIR_CUSTOM || options.startupDir == STARTUPDIR_LAST) { } else if (options.startupDir == STARTUPDIR_CUSTOM || options.startupDir == STARTUPDIR_LAST) {
if (options.startupPath.length() && safe_file_test(options.startupPath, Glib::FILE_TEST_EXISTS) && safe_file_test(options.startupPath, Glib::FILE_TEST_IS_DIR)) { if (options.startupPath.length() && Glib::file_test(options.startupPath, Glib::FILE_TEST_EXISTS) && Glib::file_test(options.startupPath, Glib::FILE_TEST_IS_DIR)) {
dirBrowser->open (options.startupPath); dirBrowser->open (options.startupPath);
} else { } else {
// Fallback option if the path is empty or the folder doesn't exist // Fallback option if the path is empty or the folder doesn't exist
@ -324,9 +322,9 @@ void FilePanel::saveOptions ()
void FilePanel::open (const Glib::ustring& d) void FilePanel::open (const Glib::ustring& d)
{ {
if (safe_file_test (d, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (d, Glib::FILE_TEST_IS_DIR)) {
dirBrowser->open (d.c_str()); dirBrowser->open (d.c_str());
} else if (safe_file_test (d, Glib::FILE_TEST_EXISTS)) { } else if (Glib::file_test (d, Glib::FILE_TEST_EXISTS)) {
dirBrowser->open (Glib::path_get_dirname(d), Glib::path_get_basename(d)); dirBrowser->open (Glib::path_get_dirname(d), Glib::path_get_basename(d));
} }
} }

View File

@ -4,7 +4,6 @@
#include "options.h" #include "options.h"
#include "../rtengine/clutstore.h" #include "../rtengine/clutstore.h"
#include "../rtengine/safegtk.h"
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;

View File

@ -19,7 +19,6 @@
#include "flatfield.h" #include "flatfield.h"
#include "options.h" #include "options.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
#include "rtimage.h" #include "rtimage.h"
@ -140,7 +139,7 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi
} }
} }
if (safe_file_test (pp->raw.ff_file, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (pp->raw.ff_file, Glib::FILE_TEST_EXISTS)) {
flatFieldFile->set_filename (pp->raw.ff_file); flatFieldFile->set_filename (pp->raw.ff_file);
} else { } else {
flatFieldFile_Reset(); flatFieldFile_Reset();

View File

@ -21,7 +21,6 @@
#include "options.h" #include "options.h"
#include "../rtengine/rt_math.h" #include "../rtengine/rt_math.h"
#include "../rtengine/utils.h" #include "../rtengine/utils.h"
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
#include "multilangmgr.h" #include "multilangmgr.h"
@ -131,7 +130,7 @@ bool confirmOverwrite (Gtk::Window& parent, const std::string& filename)
{ {
bool safe = true; bool safe = true;
if (safe_file_test (filename, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (filename, Glib::FILE_TEST_EXISTS)) {
Glib::ustring msg_ = Glib::ustring ("<b>\"") + Glib::path_get_basename (filename) + "\": " Glib::ustring msg_ = Glib::ustring ("<b>\"") + Glib::path_get_basename (filename) + "\": "
+ M("MAIN_MSG_ALREADYEXISTS") + "</b>\n" + M("MAIN_MSG_QOVERWRITE"); + M("MAIN_MSG_ALREADYEXISTS") + "</b>\n" + M("MAIN_MSG_QOVERWRITE");
Gtk::MessageDialog msgd (parent, msg_, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true); Gtk::MessageDialog msgd (parent, msg_, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true);

View File

@ -20,7 +20,6 @@
#include "icmpanel.h" #include "icmpanel.h"
#include "options.h" #include "options.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include "../rtengine/iccstore.h" #include "../rtengine/iccstore.h"
#include "../rtengine/dcp.h" #include "../rtengine/dcp.h"
#include "rtimage.h" #include "rtimage.h"
@ -598,7 +597,7 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited)
} else if (icameraICC->get_active ()) { } else if (icameraICC->get_active ()) {
pp->icm.input = "(cameraICC)"; pp->icm.input = "(cameraICC)";
} else { } else {
if (safe_file_test (ipDialog->get_filename (), Glib::FILE_TEST_EXISTS) && !safe_file_test (ipDialog->get_filename (), Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (ipDialog->get_filename (), Glib::FILE_TEST_EXISTS) && !Glib::file_test (ipDialog->get_filename (), Glib::FILE_TEST_IS_DIR)) {
pp->icm.input = "file:" + ipDialog->get_filename (); pp->icm.input = "file:" + ipDialog->get_filename ();
} else { } else {
pp->icm.input = ""; // just a directory pp->icm.input = ""; // just a directory

View File

@ -22,14 +22,13 @@
#include "cursormanager.h" #include "cursormanager.h"
#include "guiutils.h" #include "guiutils.h"
#include "options.h" #include "options.h"
#include "../rtengine/safegtk.h"
#include "../rtengine/previewimage.h" #include "../rtengine/previewimage.h"
extern Options options; extern Options options;
InspectorBuffer::InspectorBuffer(const Glib::ustring &imagePath) : currTransform(0), fromRaw(false) InspectorBuffer::InspectorBuffer(const Glib::ustring &imagePath) : currTransform(0), fromRaw(false)
{ {
if (!imagePath.empty() && safe_file_test(imagePath, Glib::FILE_TEST_EXISTS) && !safe_file_test(imagePath, Glib::FILE_TEST_IS_DIR)) { if (!imagePath.empty() && Glib::file_test(imagePath, Glib::FILE_TEST_EXISTS) && !Glib::file_test(imagePath, Glib::FILE_TEST_IS_DIR)) {
imgPath = imagePath; imgPath = imagePath;
// generate thumbnail image // generate thumbnail image

View File

@ -19,7 +19,6 @@
#include <glibmm.h> #include <glibmm.h>
#include "lensprofile.h" #include "lensprofile.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include "../rtengine/lcp.h" #include "../rtengine/lcp.h"
#include <sstream> #include <sstream>
#include "rtimage.h" #include "rtimage.h"

View File

@ -54,8 +54,6 @@
#include "conio.h" #include "conio.h"
#endif #endif
#include "../rtengine/safegtk.h"
extern Options options; extern Options options;
// stores path to data files // stores path to data files
@ -286,7 +284,7 @@ int main(int argc, char **argv)
#ifndef WIN32 #ifndef WIN32
// Move the old path to the new one if the new does not exist // Move the old path to the new one if the new does not exist
if (safe_file_test(Glib::build_filename(options.rtdir, "cache"), Glib::FILE_TEST_IS_DIR) && !safe_file_test(options.cacheBaseDir, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test(Glib::build_filename(options.rtdir, "cache"), Glib::FILE_TEST_IS_DIR) && !Glib::file_test(options.cacheBaseDir, Glib::FILE_TEST_IS_DIR)) {
g_rename(Glib::build_filename (options.rtdir, "cache").c_str (), options.cacheBaseDir.c_str ()); g_rename(Glib::build_filename (options.rtdir, "cache").c_str (), options.cacheBaseDir.c_str ());
} }
@ -295,7 +293,7 @@ int main(int argc, char **argv)
simpleEditor = false; simpleEditor = false;
if( !argv1.empty() ) if( !argv1.empty() )
if( safe_file_test(argv1, Glib::FILE_TEST_EXISTS) && !safe_file_test(argv1, Glib::FILE_TEST_IS_DIR)) { if( Glib::file_test(argv1, Glib::FILE_TEST_EXISTS) && !Glib::file_test(argv1, Glib::FILE_TEST_IS_DIR)) {
simpleEditor = true; simpleEditor = true;
} }
@ -420,7 +418,7 @@ int processLineParams( int argc, char **argv )
iArg++; iArg++;
outputPath = fname_to_utf8 (argv[iArg]); outputPath = fname_to_utf8 (argv[iArg]);
if( safe_file_test (outputPath, Glib::FILE_TEST_IS_DIR)) { if( Glib::file_test (outputPath, Glib::FILE_TEST_IS_DIR)) {
outputDirectory = true; outputDirectory = true;
} }
} }
@ -739,7 +737,7 @@ int processLineParams( int argc, char **argv )
continue; continue;
} }
if( !overwriteFiles && safe_file_test( outputFile , Glib::FILE_TEST_EXISTS ) ) { if( !overwriteFiles && Glib::file_test( outputFile , Glib::FILE_TEST_EXISTS ) ) {
std::cerr << outputFile << " already exists: use -Y option to overwrite. This image has been skipped." << std::endl; std::cerr << outputFile << " already exists: use -Y option to overwrite. This image has been skipped." << std::endl;
continue; continue;
} }
@ -780,7 +778,7 @@ int processLineParams( int argc, char **argv )
Glib::ustring sideProcessingParams = inputFile + paramFileExtension; Glib::ustring sideProcessingParams = inputFile + paramFileExtension;
// the "load" method don't reset the procparams values anymore, so values found in the procparam file override the one of currentParams // the "load" method don't reset the procparams values anymore, so values found in the procparam file override the one of currentParams
if( !safe_file_test( sideProcessingParams, Glib::FILE_TEST_EXISTS ) || currentParams.load ( sideProcessingParams )) { if( !Glib::file_test( sideProcessingParams, Glib::FILE_TEST_EXISTS ) || currentParams.load ( sideProcessingParams )) {
std::cerr << "Warning: sidecar file requested but not found for: " << sideProcessingParams << std::endl; std::cerr << "Warning: sidecar file requested but not found for: " << sideProcessingParams << std::endl;
} else { } else {
sideCarFound = true; sideCarFound = true;

View File

@ -24,7 +24,6 @@
#include "../rtengine/safekeyfile.h" #include "../rtengine/safekeyfile.h"
#include "addsetids.h" #include "addsetids.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include "version.h" #include "version.h"
#ifdef _OPENMP #ifdef _OPENMP
@ -70,13 +69,13 @@ inline bool Options::checkProfilePath(Glib::ustring &path)
Glib::ustring p = getUserProfilePath(); Glib::ustring p = getUserProfilePath();
if (!p.empty() && safe_file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS)) { if (!p.empty() && Glib::file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS)) {
return true; return true;
} }
p = getGlobalProfilePath(); p = getGlobalProfilePath();
if (!p.empty() && safe_file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS)) { if (!p.empty() && Glib::file_test (path + paramFileExtension, Glib::FILE_TEST_EXISTS)) {
return true; return true;
} else { } else {
return false; return false;
@ -85,7 +84,7 @@ inline bool Options::checkProfilePath(Glib::ustring &path)
bool Options::checkDirPath(Glib::ustring &path, Glib::ustring errString) bool Options::checkDirPath(Glib::ustring &path, Glib::ustring errString)
{ {
if (safe_file_test (path, Glib::FILE_TEST_EXISTS) && safe_file_test (path, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (path, Glib::FILE_TEST_EXISTS) && Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
return true; return true;
} else { } else {
if (!errString.empty()) { if (!errString.empty()) {
@ -170,51 +169,51 @@ void Options::updatePaths()
Glib::ustring preferredPath = getPreferredProfilePath(); Glib::ustring preferredPath = getPreferredProfilePath();
// Paths are updated only if the user or global profile path is set // Paths are updated only if the user or global profile path is set
if (lastRgbCurvesDir.empty() || !safe_file_test (lastRgbCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastRgbCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastRgbCurvesDir.empty() || !Glib::file_test (lastRgbCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastRgbCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastRgbCurvesDir = preferredPath; lastRgbCurvesDir = preferredPath;
} }
if (lastLabCurvesDir.empty() || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastLabCurvesDir.empty() || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastLabCurvesDir = preferredPath; lastLabCurvesDir = preferredPath;
} }
if (lastRetinexDir.empty() || !safe_file_test (lastRetinexDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastRetinexDir.empty() || !Glib::file_test (lastRetinexDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastRetinexDir = preferredPath; lastRetinexDir = preferredPath;
} }
if (lastDenoiseCurvesDir.empty() || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastDenoiseCurvesDir.empty() || !Glib::file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastDenoiseCurvesDir = preferredPath; lastDenoiseCurvesDir = preferredPath;
} }
if (lastWaveletCurvesDir.empty() || !safe_file_test (lastWaveletCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastWaveletCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastWaveletCurvesDir.empty() || !Glib::file_test (lastWaveletCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastWaveletCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastWaveletCurvesDir = preferredPath; lastWaveletCurvesDir = preferredPath;
} }
if (lastPFCurvesDir.empty() || !safe_file_test (lastPFCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastPFCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastPFCurvesDir.empty() || !Glib::file_test (lastPFCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastPFCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastPFCurvesDir = preferredPath; lastPFCurvesDir = preferredPath;
} }
if (lastHsvCurvesDir.empty() || !safe_file_test (lastHsvCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastHsvCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastHsvCurvesDir.empty() || !Glib::file_test (lastHsvCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastHsvCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastHsvCurvesDir = preferredPath; lastHsvCurvesDir = preferredPath;
} }
if (lastToneCurvesDir.empty() || !safe_file_test (lastToneCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastToneCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastToneCurvesDir.empty() || !Glib::file_test (lastToneCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastToneCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastToneCurvesDir = preferredPath; lastToneCurvesDir = preferredPath;
} }
if (lastProfilingReferenceDir.empty() || !safe_file_test (lastProfilingReferenceDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastProfilingReferenceDir, Glib::FILE_TEST_IS_DIR)) { if (lastProfilingReferenceDir.empty() || !Glib::file_test (lastProfilingReferenceDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastProfilingReferenceDir, Glib::FILE_TEST_IS_DIR)) {
lastProfilingReferenceDir = preferredPath; lastProfilingReferenceDir = preferredPath;
} }
if (lastVibranceCurvesDir.empty() || !safe_file_test (lastVibranceCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastVibranceCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastVibranceCurvesDir.empty() || !Glib::file_test (lastVibranceCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastVibranceCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastVibranceCurvesDir = preferredPath; lastVibranceCurvesDir = preferredPath;
} }
if (loadSaveProfilePath.empty() || !safe_file_test (loadSaveProfilePath, Glib::FILE_TEST_EXISTS) || !safe_file_test (loadSaveProfilePath, Glib::FILE_TEST_IS_DIR)) { if (loadSaveProfilePath.empty() || !Glib::file_test (loadSaveProfilePath, Glib::FILE_TEST_EXISTS) || !Glib::file_test (loadSaveProfilePath, Glib::FILE_TEST_IS_DIR)) {
loadSaveProfilePath = preferredPath; loadSaveProfilePath = preferredPath;
} }
if (lastBWCurvesDir.empty() || !safe_file_test (lastBWCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastBWCurvesDir, Glib::FILE_TEST_IS_DIR)) { if (lastBWCurvesDir.empty() || !Glib::file_test (lastBWCurvesDir, Glib::FILE_TEST_EXISTS) || !Glib::file_test (lastBWCurvesDir, Glib::FILE_TEST_IS_DIR)) {
lastBWCurvesDir = preferredPath; lastBWCurvesDir = preferredPath;
} }
@ -255,7 +254,7 @@ Glib::ustring Options::findProfilePath(Glib::ustring &profName)
p = getUserProfilePath(); p = getUserProfilePath();
Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension); Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension);
if (!p.empty() && safe_file_test (fullPath, Glib::FILE_TEST_EXISTS)) { if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) {
return Glib::path_get_dirname(fullPath); return Glib::path_get_dirname(fullPath);
} }
} else if (p == "${G}") { } else if (p == "${G}") {
@ -263,7 +262,7 @@ Glib::ustring Options::findProfilePath(Glib::ustring &profName)
p = getGlobalProfilePath(); p = getGlobalProfilePath();
Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension); Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension);
if (!p.empty() && safe_file_test (fullPath, Glib::FILE_TEST_EXISTS)) { if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) {
return Glib::path_get_dirname(fullPath); return Glib::path_get_dirname(fullPath);
} }
} else { } else {
@ -271,7 +270,7 @@ Glib::ustring Options::findProfilePath(Glib::ustring &profName)
p = getUserProfilePath(); p = getUserProfilePath();
Glib::ustring fullPath = Glib::build_filename(p, profName + paramFileExtension); Glib::ustring fullPath = Glib::build_filename(p, profName + paramFileExtension);
if (!p.empty() && safe_file_test (fullPath, Glib::FILE_TEST_EXISTS)) { if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) {
// update the profile path // update the profile path
profName = Glib::build_filename("${U}", profName); profName = Glib::build_filename("${U}", profName);
return Glib::path_get_dirname(fullPath); return Glib::path_get_dirname(fullPath);
@ -280,7 +279,7 @@ Glib::ustring Options::findProfilePath(Glib::ustring &profName)
p = getGlobalProfilePath(); p = getGlobalProfilePath();
fullPath = Glib::build_filename(p, profName + paramFileExtension); fullPath = Glib::build_filename(p, profName + paramFileExtension);
if (!p.empty() && safe_file_test (fullPath, Glib::FILE_TEST_EXISTS)) { if (!p.empty() && Glib::file_test (fullPath, Glib::FILE_TEST_EXISTS)) {
profName = Glib::build_filename("${G}", profName); profName = Glib::build_filename("${G}", profName);
return Glib::path_get_dirname(fullPath); return Glib::path_get_dirname(fullPath);
} }
@ -729,7 +728,7 @@ int Options::readFromFile (Glib::ustring fname)
setlocale(LC_NUMERIC, "C"); // to set decimal point to "." setlocale(LC_NUMERIC, "C"); // to set decimal point to "."
rtengine::SafeKeyFile keyFile; rtengine::SafeKeyFile keyFile;
if( !safe_file_test(fname, Glib::FILE_TEST_EXISTS)) { if( !Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
return 1; return 1;
} }
@ -2105,7 +2104,7 @@ int Options::saveToFile (Glib::ustring fname)
keyFile.set_string ("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); keyFile.set_string ("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir);
keyFile.set_string ("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); keyFile.set_string ("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir);
FILE *f = safe_g_fopen (fname, "wt"); FILE *f = g_fopen (fname.c_str (), "wt");
if (f == NULL) { if (f == NULL) {
if (options.rtSettings.verbose) { if (options.rtSettings.verbose) {

View File

@ -22,7 +22,6 @@
#include <gtkmm.h> #include <gtkmm.h>
#include "multilangmgr.h" #include "multilangmgr.h"
#include "popupcommon.h" #include "popupcommon.h"
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label) PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label)

View File

@ -25,7 +25,6 @@
#include "../rtengine/dfmanager.h" #include "../rtengine/dfmanager.h"
#include "../rtengine/ffmanager.h" #include "../rtengine/ffmanager.h"
#include <sstream> #include <sstream>
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
@ -1357,7 +1356,7 @@ void Preferences::parseDir (Glib::ustring dirname, std::vector<Glib::ustring>& i
Glib::ustring sname = *i; Glib::ustring sname = *i;
// ignore directories // ignore directories
if (!safe_file_test (fname, Glib::FILE_TEST_IS_DIR) && sname.size() >= ext.size() && sname.substr (sname.size() - ext.size(), ext.size()).casefold() == ext) { if (!Glib::file_test (fname, Glib::FILE_TEST_IS_DIR) && sname.size() >= ext.size() && sname.substr (sname.size() - ext.size(), ext.size()).casefold() == ext) {
items.push_back (sname.substr(0, sname.size() - ext.size())); items.push_back (sname.substr(0, sname.size() - ext.size()));
} }
} }
@ -1647,18 +1646,18 @@ void Preferences::fillPreferences ()
#ifdef WIN32 #ifdef WIN32
edPS->set_active (moptions.editorToSendTo == 2); edPS->set_active (moptions.editorToSendTo == 2);
if (safe_file_test (moptions.gimpDir, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (moptions.gimpDir, Glib::FILE_TEST_IS_DIR)) {
gimpDir->set_current_folder (moptions.gimpDir); gimpDir->set_current_folder (moptions.gimpDir);
} }
if (safe_file_test (moptions.psDir, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (moptions.psDir, Glib::FILE_TEST_IS_DIR)) {
psDir->set_current_folder (moptions.psDir); psDir->set_current_folder (moptions.psDir);
} }
#elif defined __APPLE__ #elif defined __APPLE__
edPS->set_active (moptions.editorToSendTo == 2); edPS->set_active (moptions.editorToSendTo == 2);
if (safe_file_test (moptions.psDir, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (moptions.psDir, Glib::FILE_TEST_IS_DIR)) {
psDir->set_current_folder (moptions.psDir); psDir->set_current_folder (moptions.psDir);
} }

View File

@ -18,7 +18,6 @@
*/ */
#include "preprocess.h" #include "preprocess.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
using namespace rtengine; using namespace rtengine;

View File

@ -21,7 +21,6 @@
#include "previewloader.h" #include "previewloader.h"
#include "guiutils.h" #include "guiutils.h"
#include "threadutils.h" #include "threadutils.h"
#include "../rtengine/safegtk.h"
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
@ -123,7 +122,7 @@ public:
try { try {
Thumbnail* tmb = 0; Thumbnail* tmb = 0;
{ {
if (safe_file_test(j.dir_entry_, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test(j.dir_entry_, Glib::FILE_TEST_EXISTS)) {
tmb = cacheMgr->getEntry(j.dir_entry_); tmb = cacheMgr->getEntry(j.dir_entry_);
} }
} }

View File

@ -21,7 +21,6 @@
#include "profilestore.h" #include "profilestore.h"
#include "clipboard.h" #include "clipboard.h"
#include "multilangmgr.h" #include "multilangmgr.h"
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
using namespace rtengine; using namespace rtengine;

View File

@ -20,7 +20,6 @@
#include "options.h" #include "options.h"
#include "toolpanel.h" #include "toolpanel.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
ProfileStore profileStore; ProfileStore profileStore;
@ -168,7 +167,7 @@ bool ProfileStore::parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath
unsigned int folder = 0; // folder's own Id unsigned int folder = 0; // folder's own Id
// reload the available profiles from the profile dir // reload the available profiles from the profile dir
if (!realPath.empty() && safe_file_test(realPath, Glib::FILE_TEST_EXISTS) && safe_file_test (realPath, Glib::FILE_TEST_IS_DIR)) { if (!realPath.empty() && Glib::file_test(realPath, Glib::FILE_TEST_EXISTS) && Glib::file_test (realPath, Glib::FILE_TEST_IS_DIR)) {
// add this entry to the folder list // add this entry to the folder list
folders.push_back(virtualPath); folders.push_back(virtualPath);
@ -199,7 +198,7 @@ bool ProfileStore::parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath
Glib::ustring fname = Glib::build_filename(realPath, currDir); Glib::ustring fname = Glib::build_filename(realPath, currDir);
if (safe_file_test (fname, Glib::FILE_TEST_IS_DIR)) { if (Glib::file_test (fname, Glib::FILE_TEST_IS_DIR)) {
Glib::ustring vp(Glib::build_filename(virtualPath, currDir)); Glib::ustring vp(Glib::build_filename(virtualPath, currDir));
Glib::ustring rp(Glib::build_filename(realPath, currDir)); Glib::ustring rp(Glib::build_filename(realPath, currDir));
fileFound = parseDir (rp, vp, currDir, folder, level + 1, 0); fileFound = parseDir (rp, vp, currDir, folder, level + 1, 0);

View File

@ -18,7 +18,6 @@
*/ */
#include "rawcacorrection.h" #include "rawcacorrection.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
#include "rtimage.h" #include "rtimage.h"

View File

@ -18,7 +18,6 @@
*/ */
#include "rawexposure.h" #include "rawexposure.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
using namespace rtengine; using namespace rtengine;

View File

@ -19,7 +19,6 @@
#include "saveasdlg.h" #include "saveasdlg.h"
#include "multilangmgr.h" #include "multilangmgr.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include "rtimage.h" #include "rtimage.h"
extern Options options; extern Options options;
@ -224,7 +223,7 @@ void SaveAsDialog::okPressed ()
// checking if the filename field is empty. The user have to click Cancel if he don't want to specify a filename // checking if the filename field is empty. The user have to click Cancel if he don't want to specify a filename
// NB: There seem to be a bug in Gtkmm2.22 / FileChooserWidget : if you suppress the filename entry and // NB: There seem to be a bug in Gtkmm2.22 / FileChooserWidget : if you suppress the filename entry and
// click on a folder in the list, the filename field is empty but get_filename will return the folder's path :/ // click on a folder in the list, the filename field is empty but get_filename will return the folder's path :/
if (!fname.length() || safe_file_test (fname, Glib::FILE_TEST_IS_DIR)) { if (!fname.length() || Glib::file_test (fname, Glib::FILE_TEST_IS_DIR)) {
Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_EMPTYFILENAME") + "</b>"; Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_EMPTYFILENAME") + "</b>";
Gtk::MessageDialog msgd (*this, msg_, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); Gtk::MessageDialog msgd (*this, msg_, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
msgd.run (); msgd.run ();

View File

@ -18,7 +18,6 @@
*/ */
#include "sharpenedge.h" #include "sharpenedge.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
#include <cmath> #include <cmath>

View File

@ -18,7 +18,6 @@
*/ */
#include "sharpenmicro.h" #include "sharpenmicro.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
#include <cmath> #include <cmath>

View File

@ -21,7 +21,10 @@
#ifndef _SOUNDMAN_ #ifndef _SOUNDMAN_
#define _SOUNDMAN_ #define _SOUNDMAN_
#include "../rtengine/safegtk.h" namespace Glib
{
class ustring;
}
class SoundManager class SoundManager
{ {

View File

@ -20,8 +20,6 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include "../rtengine/safegtk.h"
#include "multilangmgr.h" #include "multilangmgr.h"
#include "rtimage.h" #include "rtimage.h"
@ -109,8 +107,8 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t
// Tab 2: the informations about the current version // Tab 2: the informations about the current version
std::string buildFileName = Glib::build_filename (creditsPath, "AboutThisBuild.txt"); std::string buildFileName = Glib::build_filename (creditsPath, "AboutThisBuild.txt");
if ( safe_file_test(buildFileName, (Glib::FILE_TEST_EXISTS)) ) { if ( Glib::file_test(buildFileName, (Glib::FILE_TEST_EXISTS)) ) {
FILE *f = safe_g_fopen (buildFileName, "rt"); FILE *f = g_fopen (buildFileName.c_str (), "rt");
if (f != NULL) { if (f != NULL) {
char* buffer = new char[1024]; char* buffer = new char[1024];
@ -139,8 +137,8 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t
// Tab 3: the credits // Tab 3: the credits
std::string creditsFileName = Glib::build_filename (creditsPath, "AUTHORS.txt"); std::string creditsFileName = Glib::build_filename (creditsPath, "AUTHORS.txt");
if ( safe_file_test(creditsFileName, (Glib::FILE_TEST_EXISTS)) ) { if ( Glib::file_test(creditsFileName, (Glib::FILE_TEST_EXISTS)) ) {
FILE *f = safe_g_fopen (creditsFileName, "rt"); FILE *f = g_fopen (creditsFileName.c_str (), "rt");
if (f != NULL) { if (f != NULL) {
char* buffer = new char[1024]; char* buffer = new char[1024];
@ -170,8 +168,8 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t
// Tab 4: the license // Tab 4: the license
std::string licenseFileName = Glib::build_filename (licensePath, "LICENSE.txt"); std::string licenseFileName = Glib::build_filename (licensePath, "LICENSE.txt");
if ( safe_file_test(licenseFileName, (Glib::FILE_TEST_EXISTS)) ) { if ( Glib::file_test(licenseFileName, (Glib::FILE_TEST_EXISTS)) ) {
FILE *f = safe_g_fopen (licenseFileName, "rt"); FILE *f = g_fopen (licenseFileName.c_str (), "rt");
if (f != NULL) { if (f != NULL) {
char* buffer = new char[1024]; char* buffer = new char[1024];
@ -207,8 +205,8 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t
// Tab 5: the Release Notes // Tab 5: the Release Notes
std::string releaseNotesFileName = Glib::build_filename (creditsPath, "RELEASE_NOTES.txt"); std::string releaseNotesFileName = Glib::build_filename (creditsPath, "RELEASE_NOTES.txt");
if ( safe_file_test(releaseNotesFileName, (Glib::FILE_TEST_EXISTS)) ) { if ( Glib::file_test(releaseNotesFileName, (Glib::FILE_TEST_EXISTS)) ) {
FILE *f = safe_g_fopen (releaseNotesFileName, "rt"); FILE *f = g_fopen (releaseNotesFileName.c_str (), "rt");
if (f != NULL) { if (f != NULL) {
char* buffer = new char[1024]; char* buffer = new char[1024];

View File

@ -30,7 +30,6 @@
#include "profilestore.h" #include "profilestore.h"
#include "batchqueue.h" #include "batchqueue.h"
#include "extprog.h" #include "extprog.h"
#include "../rtengine/safegtk.h"
using namespace rtengine::procparams; using namespace rtengine::procparams;
@ -942,7 +941,7 @@ bool Thumbnail::openDefaultViewer(int destination)
if (destination == 1) { if (destination == 1) {
openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormatBatch.format); openFName = Glib::ustring::compose ("%1.%2", BatchQueue::calcAutoFileNameBase(fname), options.saveFormatBatch.format);
if (safe_file_test (openFName, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (openFName, Glib::FILE_TEST_EXISTS)) {
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (openFName.c_str(), -1, NULL, NULL, NULL); wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (openFName.c_str(), -1, NULL, NULL, NULL);
ShellExecuteW(NULL, L"open", wfilename, NULL, NULL, SW_SHOWMAXIMIZED ); ShellExecuteW(NULL, L"open", wfilename, NULL, NULL, SW_SHOWMAXIMIZED );
g_free(wfilename); g_free(wfilename);
@ -956,7 +955,7 @@ bool Thumbnail::openDefaultViewer(int destination)
printf("Opening %s\n", openFName.c_str()); printf("Opening %s\n", openFName.c_str());
if (safe_file_test (openFName, Glib::FILE_TEST_EXISTS)) { if (Glib::file_test (openFName, Glib::FILE_TEST_EXISTS)) {
// Output file exists, so open explorer and select output file // Output file exists, so open explorer and select output file
wchar_t* org = (wchar_t*)g_utf8_to_utf16 (Glib::ustring::compose("/select,\"%1\"", openFName).c_str(), -1, NULL, NULL, NULL); wchar_t* org = (wchar_t*)g_utf8_to_utf16 (Glib::ustring::compose("/select,\"%1\"", openFName).c_str(), -1, NULL, NULL, NULL);
wchar_t* par = new wchar_t[wcslen(org) + 1]; wchar_t* par = new wchar_t[wcslen(org) + 1];
@ -977,7 +976,7 @@ bool Thumbnail::openDefaultViewer(int destination)
delete[] par; delete[] par;
g_free(org); g_free(org);
} else if (safe_file_test (Glib::path_get_dirname(openFName), Glib::FILE_TEST_EXISTS)) { } else if (Glib::file_test (Glib::path_get_dirname(openFName), Glib::FILE_TEST_EXISTS)) {
// Out file does not exist, but directory // Out file does not exist, but directory
wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (Glib::path_get_dirname(openFName).c_str(), -1, NULL, NULL, NULL); wchar_t *wfilename = (wchar_t*)g_utf8_to_utf16 (Glib::path_get_dirname(openFName).c_str(), -1, NULL, NULL, NULL);
ShellExecuteW(NULL, L"explore", wfilename, NULL, NULL, SW_SHOWNORMAL ); ShellExecuteW(NULL, L"explore", wfilename, NULL, NULL, SW_SHOWNORMAL );

View File

@ -18,7 +18,6 @@
*/ */
#include "xtransrawexposure.h" #include "xtransrawexposure.h"
#include "guiutils.h" #include "guiutils.h"
#include "../rtengine/safegtk.h"
#include <sstream> #include <sstream>
using namespace rtengine; using namespace rtengine;