From c68736bc028a4965df4d43d59e550ba3185054fb Mon Sep 17 00:00:00 2001 From: John Emmas Date: Sun, 4 Oct 2015 14:18:54 +0100 Subject: Change a few instances of 'stat()' to use 'g_stat()' (for UTF8 compatibility on Windows) --- libs/ardour/audio_diskstream.cc | 5 +++-- libs/ardour/find_session.cc | 9 +++++---- libs/ardour/session_state.cc | 9 ++++----- libs/ardour/utils.cc | 11 ++++++----- libs/ardour/vst_info_file.cc | 9 ++++----- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 814fd6ebce..12828c26b6 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -28,6 +28,7 @@ #include #include +#include #include "pbd/error.h" #include "pbd/xml++.h" #include "pbd/memento_command.h" @@ -2284,8 +2285,8 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) } // This protects sessions from errant CapturingSources in stored sessions - struct stat sbuf; - if (stat (prop->value().c_str(), &sbuf)) { + GStatBuf sbuf; + if (g_stat (prop->value().c_str(), &sbuf)) { continue; } diff --git a/libs/ardour/find_session.cc b/libs/ardour/find_session.cc index 67aa43d071..e6ab2b1e24 100644 --- a/libs/ardour/find_session.cc +++ b/libs/ardour/find_session.cc @@ -18,12 +18,13 @@ */ #include -#include #include #include #include +#include + #include #include "pbd/compose.h" @@ -44,7 +45,7 @@ namespace ARDOUR { int find_session (string str, string& path, string& snapshot, bool& isnew) { - struct stat statbuf; + GStatBuf statbuf; isnew = false; @@ -52,7 +53,7 @@ find_session (string str, string& path, string& snapshot, bool& isnew) /* check to see if it exists, and what it is */ - if (stat (str.c_str(), &statbuf)) { + if (g_stat (str.c_str(), &statbuf)) { if (errno == ENOENT) { isnew = true; } else { @@ -81,7 +82,7 @@ find_session (string str, string& path, string& snapshot, bool& isnew) /* is it there ? */ - if (stat (tmp.c_str(), &statbuf)) { + if (g_stat (tmp.c_str(), &statbuf)) { error << string_compose (_("cannot check statefile %1 (%2)"), tmp, strerror (errno)) << endmsg; return -1; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index d09385b8bf..57d5dda926 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -31,7 +31,6 @@ #include /* snprintf(3) ... grrr */ #include #include -#include #include #include #include @@ -3065,7 +3064,7 @@ Session::cleanup_sources (CleanupReport& rep) /* now try to move all unused files into the "dead" directory(ies) */ for (vector::iterator x = unused.begin(); x != unused.end(); ++x) { - struct stat statbuf; + GStatBuf statbuf; string newpath; @@ -3130,7 +3129,7 @@ Session::cleanup_sources (CleanupReport& rep) } - stat ((*x).c_str(), &statbuf); + g_stat ((*x).c_str(), &statbuf); if (::rename ((*x).c_str(), newpath.c_str()) != 0) { error << string_compose (_("cannot rename unused file source from %1 to %2 (%3)"), @@ -3161,8 +3160,8 @@ Session::cleanup_sources (CleanupReport& rep) } rep.paths.push_back (*x); - rep.space += statbuf.st_size; - } + rep.space += statbuf.st_size; + } /* dump the history list */ diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index c66b34a2ba..9f44f78705 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #ifndef COMPILER_MSVC @@ -42,6 +41,8 @@ #include #include +#include + #include #include @@ -662,11 +663,11 @@ ARDOUR::native_header_format_extension (HeaderFormat hf, const DataType& type) bool ARDOUR::matching_unsuffixed_filename_exists_in (const string& dir, const string& path) { - string bws = basename_nosuffix (path); + string bws = basename_nosuffix (path); struct dirent* dentry; - struct stat statbuf; + GStatBuf statbuf; DIR* dead; - bool ret = false; + bool ret = false; if ((dead = ::opendir (dir.c_str())) == 0) { error << string_compose (_("cannot open directory %1 (%2)"), dir, strerror (errno)) << endl; @@ -684,7 +685,7 @@ ARDOUR::matching_unsuffixed_filename_exists_in (const string& dir, const string& string fullpath = Glib::build_filename (dir, dentry->d_name); - if (::stat (fullpath.c_str(), &statbuf)) { + if (g_stat (fullpath.c_str(), &statbuf)) { continue; } diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index fb8e7dc37a..6ab9de2a2b 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -419,11 +418,11 @@ vstfx_infofile_for_read (const char* dllpath) string const path = vstfx_infofile_path (dllpath); if (Glib::file_test (path, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR))) { - struct stat dllstat; - struct stat fsistat; + GStatBuf dllstat; + GStatBuf fsistat; - if (stat (dllpath, &dllstat) == 0) { - if (stat (path.c_str (), &fsistat) == 0) { + if (g_stat (dllpath, &dllstat) == 0) { + if (g_stat (path.c_str (), &fsistat) == 0) { if (dllstat.st_mtime <= fsistat.st_mtime) { /* plugin is older than info file */ return g_fopen (path.c_str (), "rb"); -- cgit v1.2.3