summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2015-10-04 14:18:54 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2015-10-04 14:18:54 +0100
commitc68736bc028a4965df4d43d59e550ba3185054fb (patch)
tree1c9b33f16e2f93ee621d0ad7246959513e9ab136 /libs/ardour
parentcf33204e358de6ee2f46a7c595e27948994c80bf (diff)
Change a few instances of 'stat()' to use 'g_stat()' (for UTF8 compatibility on Windows)
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/audio_diskstream.cc5
-rw-r--r--libs/ardour/find_session.cc9
-rw-r--r--libs/ardour/session_state.cc9
-rw-r--r--libs/ardour/utils.cc11
-rw-r--r--libs/ardour/vst_info_file.cc9
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 <cstdlib>
#include <ctime>
+#include <pbd/gstdio_compat.h>
#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 <unistd.h>
-#include <sys/stat.h>
#include <cstring>
#include <climits>
#include <cerrno>
+#include <pbd/gstdio_compat.h>
+
#include <glibmm/miscutils.h>
#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 <cstdio> /* snprintf(3) ... grrr */
#include <cmath>
#include <unistd.h>
-#include <sys/stat.h>
#include <climits>
#include <signal.h>
#include <sys/time.h>
@@ -3065,7 +3064,7 @@ Session::cleanup_sources (CleanupReport& rep)
/* now try to move all unused files into the "dead" directory(ies) */
for (vector<string>::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 <cerrno>
#include <iostream>
#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#ifndef COMPILER_MSVC
@@ -42,6 +41,8 @@
#include <errno.h>
#include <regex.h>
+#include <pbd/gstdio_compat.h>
+
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
@@ -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 <cassert>
#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
@@ -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");