use g_unlink() rather than unlink() universally, requires <glib/gstdio.h> in several...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 15 Jul 2013 18:29:00 +0000 (14:29 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 15 Jul 2013 18:29:00 +0000 (14:29 -0400)
18 files changed:
gtk2_ardour/editor_export_audio.cc
gtk2_ardour/editor_videotimeline.cc
gtk2_ardour/export_video_dialog.cc
gtk2_ardour/sfdb_ui.cc
gtk2_ardour/transcode_video_dialog.cc
libs/ardour/audio_unit.cc
libs/ardour/audiofilesource.cc
libs/ardour/audiosource.cc
libs/ardour/export_handler.cc
libs/ardour/import.cc
libs/ardour/lv2_plugin.cc
libs/ardour/session_state.cc
libs/ardour/smf_source.cc
libs/gtkmm2ext/bindings.cc
libs/gtkmm2ext/motionfeedback.cc
libs/pbd/clear_dir.cc
libs/surfaces/frontier/kernel_drivers/tranzport.c
libs/surfaces/osc/osc.cc

index 877a39e7730478303b4898071a02230eb9583792..e40030d671d5a7fe6a0b7b65df792a7dba6b0511 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <gtkmm/messagedialog.h>
 
+#include <glib/gstdio.h>
+
 #include "gtkmm2ext/choice.h"
 
 #include "pbd/pthread_utils.h"
@@ -158,11 +160,11 @@ Editor::export_region ()
 
                        switch (ret) {
                        case Gtk::RESPONSE_ACCEPT:
-                               /* force unlink because the backend code will
+                               /* force ::g_unlink because the backend code will
                                   go wrong if it tries to open an existing
                                   file for writing.
                                */
-                               ::unlink (path.c_str());
+                               ::g_unlink (path.c_str());
                                break;
                        default:
                                return;
index 7395d767c77083c7697d177e0792b8a561d956b4..5da8a295b7b205090a249d8699f9110f649bd087 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <jack/types.h>
 
+#include <glib/gstdio.h>
+
 #include "ardour/profile.h"
 #include "ardour/rc_configuration.h"
 #include "ardour/audio_track.h"
@@ -118,7 +120,7 @@ Editor::embed_audio_from_video (std::string path, framepos_t n)
 
        import_status.all_done = true;
 #endif
-       unlink(path.c_str());
+       ::g_unlink(path.c_str());
 }
 
 void
index ce85fad81ef5c6129cb861c7bc00092239703740..d51fd60e2b0731608be4f1179405a8505db85207 100644 (file)
@@ -30,6 +30,8 @@
 #include <sigc++/bind.h>
 #include <libgen.h>
 
+#include <glib/gstdio.h>
+
 #include "pbd/error.h"
 #include "pbd/convert.h"
 #include "gtkmm2ext/utils.h"
@@ -405,8 +407,8 @@ void
 ExportVideoDialog::finished ()
 {
        if (aborted) {
-               unlink(outfn_path_entry.get_text().c_str());
-               unlink (insnd.c_str());
+               ::g_unlink(outfn_path_entry.get_text().c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_CANCEL);
        } else if (twopass && firstpass) {
                firstpass = false;
@@ -416,9 +418,9 @@ ExportVideoDialog::finished ()
                if (twopass_checkbox.get_active()) {
                        std::string outfn = outfn_path_entry.get_text();
                        std::string p2log = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass";
-                       unlink (p2log.c_str());
+                       ::g_unlink (p2log.c_str());
                }
-               unlink (insnd.c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_ACCEPT);
        }
 }
@@ -554,7 +556,7 @@ ExportVideoDialog::launch_export ()
        audio_progress_connection.disconnect();
        status->finish ();
        if (status->aborted()) {
-               unlink (insnd.c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_CANCEL);
                return;
        }
@@ -571,14 +573,14 @@ ExportVideoDialog::encode_pass (int pass)
        transcoder = new TranscodeFfmpeg(invid);
        if (!transcoder->ffexec_ok()) {
                /* ffmpeg binary was not found. TranscodeFfmpeg prints a warning */
-               unlink (insnd.c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_CANCEL);
                return;
        }
        if (!transcoder->probe_ok()) {
                /* video input file can not be read */
                warning << _("Export Video: Video input file cannot be read.") << endmsg;
-         unlink (insnd.c_str());
+         ::g_unlink (insnd.c_str());
          Gtk::Dialog::response(RESPONSE_CANCEL);
          return;
        }
index 482a3b61b7a2c42b248d360b8de2bd51ed39385d..f116041d03f736ee9f6780664070771108c8c0cf 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <gtkmm/box.h>
 #include <gtkmm/stock.h>
+
+#include <glib/gstdio.h>
 #include <glibmm/fileutils.h>
 
 #include "pbd/convert.h"
@@ -1487,7 +1489,7 @@ SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths
                        goto out;
                }
 
-               unlink (tmpc);
+               ::g_unlink (tmpc);
        }
 
        ret = true;
index fa5d447a3a0019a434005dc2698203c5ef0f8390..4d8b9b9f11a9d0cc23681711bbbb071c174e7cce 100644 (file)
@@ -30,6 +30,8 @@
 #include <sigc++/bind.h>
 #include <libgen.h>
 
+#include <glib/gstdio.h>
+
 #include "pbd/error.h"
 #include "pbd/convert.h"
 #include "gtkmm2ext/utils.h"
@@ -301,9 +303,9 @@ void
 TranscodeVideoDialog::finished ()
 {
        if (aborted) {
-               unlink(path_entry.get_text().c_str());
+               ::g_unlink(path_entry.get_text().c_str());
                if (!audiofile.empty()) {
-                       unlink(audiofile.c_str());
+                       ::g_unlink(audiofile.c_str());
                }
                Gtk::Dialog::response(RESPONSE_CANCEL);
        } else {
index 0e9a11e6dfcb003816c41d66318b037235cebbf5..ea2e93c5a07d92717e7adf0b61e8e8083b53218f 100644 (file)
@@ -2452,7 +2452,7 @@ AUPluginInfo::save_cached_info ()
 
        if (!tree.write (path)) {
                error << string_compose (_("could not save AU cache to %1"), path) << endmsg;
-               unlink (path.c_str());
+               ::g_unlink (path.c_str());
        }
 }
 
index 13b03f8f4828fdaa3998ef7b09b7c4938d89eb00..014baa90317b13c420af7c9863378ef6ddd4f976 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <sndfile.h>
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/fileutils.h>
 #include <glibmm/threads.h>
@@ -133,8 +134,8 @@ AudioFileSource::~AudioFileSource ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("AudioFileSource destructor %1, removable? %2\n", _path, removable()));
        if (removable()) {
-               unlink (_path.c_str());
-               unlink (peakpath.c_str());
+               ::g_unlink (_path.c_str());
+               ::g_unlink (peakpath.c_str());
        }
 }
 
@@ -292,7 +293,7 @@ AudioFileSource::mark_streaming_write_completed ()
 int
 AudioFileSource::move_dependents_to_trash()
 {
-       return ::unlink (peakpath.c_str());
+       return ::g_unlink (peakpath.c_str());
 }
 
 void
index d8c25b02002f1f092a614ba19c02f807b6fe9c4b..e224186bd29890ac825df14cb3288ff11ac9ceef 100644 (file)
@@ -653,7 +653,7 @@ AudioSource::build_peaks_from_scratch ()
   out:
        if (ret) {
                DEBUG_TRACE (DEBUG::Peaks, string_compose("Could not write peak data, attempting to remove peakfile %1\n", peakpath));
-               unlink (peakpath.c_str());
+               ::g_unlink (peakpath.c_str());
        }
 
        return ret;
index 4a6b0552c5bfce4d98512dbe0274a0ebb32b089f..5710ecc45213624d2749bff190b5c41903cb3608 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "ardour/export_handler.h"
 
+#include <glib/gstdio.h>
 #include <glibmm.h>
 #include <glibmm/convert.h>
 
@@ -415,10 +416,10 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp
 
        } catch (std::exception& e) {
                error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg;
-               ::unlink (filepath.c_str());
+               ::g_unlink (filepath.c_str());
        } catch (Glib::Exception& e) {
                error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg;
-               ::unlink (filepath.c_str());
+               ::g_unlink (filepath.c_str());
        }
 }
 
index 48937fb576824947dbbf66e021d51ae73f22ec6f..9be72a99661d17c39f007336ea8595d33b294b28 100644 (file)
@@ -34,6 +34,7 @@
 #include <sndfile.h>
 #include <samplerate.h>
 
+#include <glib/gstdio.h>
 #include <glibmm.h>
 
 #include <boost/scoped_array.hpp>
@@ -464,7 +465,7 @@ remove_file_source (boost::shared_ptr<Source> source)
        boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (source);
 
        if (fs) {
-               ::unlink (fs->path().c_str());
+               ::g_unlink (fs->path().c_str());
        }
 }
 
index d49f8412b73811218aad771301b1b3ae08df307e..c5a02575fd2545ca0a4408fb6b0ac52f0b06d5a0 100644 (file)
@@ -25,6 +25,7 @@
 #include <cstdlib>
 #include <cstring>
 
+#include <glib/gstdio.h>
 #include <giomm/file.h>
 #include <glib/gprintf.h>
 #include <glibmm.h>
@@ -1085,7 +1086,7 @@ LV2Plugin::do_remove_preset(string name)
                        name + ".ttl"
                )
        );
-       unlink(preset_file.c_str());
+       ::g_unlink(preset_file.c_str());
 }
 
 bool
index de573e61b67dec2775720975e8a0503ace2c103b..62edaa39115fe8e5b9b556228c4f283d341cd844 100644 (file)
@@ -2900,7 +2900,7 @@ Session::cleanup_sources (CleanupReport& rep)
                string peakpath = peak_path (base);
 
                if (Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
-                       if (::unlink (peakpath.c_str()) != 0) {
+                       if (::g_unlink (peakpath.c_str()) != 0) {
                                error << string_compose (_("cannot remove peakfile %1 for %2 (%3)"),
                                                          peakpath, _path, strerror (errno))
                                      << endmsg;
index 830fd75fdf6a9df618f09ea7a56918db7c7c63bb..d915bba8456025805284055bbd70604c12077a2c 100644 (file)
@@ -30,6 +30,7 @@
 #include "pbd/stl_delete.h"
 #include "pbd/strsplit.h"
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 
 #include "evoral/Control.hpp"
@@ -96,7 +97,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
 SMFSource::~SMFSource ()
 {
        if (removable()) {
-               unlink (_path.c_str());
+               ::g_unlink (_path.c_str());
        }
 }
 
index e049cd8d57e9c5a41af18d196bc31363d27007ac..f96bd586d985ec6d7cbcb35957291885df535b08 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <iostream>
 
+#include <glib/gstdio.h>
+
 #include "pbd/xml++.h"
 #include "pbd/convert.h"
 
@@ -389,7 +391,7 @@ Bindings::save (const string& path)
         save (*root);
 
         if (!tree.write (path)) {
-                ::unlink (path.c_str());
+                ::g_unlink (path.c_str());
                 return false;
         }
 
index bd0fd1cd736abf40feecc03812c0e410b4890436..221a8b0bd6c6a7b1684824a51d9f8aef11ac5df7 100644 (file)
@@ -25,6 +25,8 @@
 #include <unistd.h>
 #include <stdio.h> /* for snprintf, grrr */
 
+#include <glib/gstdio.h>
+
 #include <gdk/gdkkeysyms.h>
 #include <gtkmm.h>
 
@@ -516,15 +518,15 @@ MotionFeedback::render_pixbuf (int size)
                pixbuf = Gdk::Pixbuf::create_from_file (path);
        } catch (const Gdk::PixbufError &e) {
                 std::cerr << "Caught PixbufError: " << e.what() << std::endl;
-                unlink (path);
+                ::g_unlink (path);
                 throw;
        } catch (...) {
-                unlink (path);
+                ::g_unlink (path);
                g_message("Caught ... ");
                 throw;
        }
 
-        unlink (path);
+        ::g_unlink (path);
 
        g_free(path);
 
index 29410d41e51cbdbaab4ee7a8c5dce378ac10be7a..86f7067201930e1f4264bf73c098fa222a04a484 100644 (file)
@@ -24,6 +24,7 @@
 #include <errno.h>
 #include <string.h>
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 
 #include "pbd/error.h"
@@ -66,7 +67,7 @@ PBD::clear_directory (const string& dir, size_t* size, vector<string>* paths)
                         continue;
                 }
                 
-                if (::unlink (fullpath.c_str())) {
+                if (::g_unlink (fullpath.c_str())) {
                         error << string_compose (_("cannot remove file %1 (%2)"), fullpath, strerror (errno))
                               << endmsg;
                         ret = 1;
index 6893f66921671bc3628d8bf2b919fe0e56f1343a..b7b6709d56b87466ae398f3fc58a2cf9fe1514ed 100644 (file)
@@ -445,7 +445,7 @@ static void usb_tranzport_interrupt_out_callback(struct urb *urb)
 {
        struct usb_tranzport *dev = urb->context;
 
-       /* sync/async unlink faults aren't errors */
+       /* sync/async ::g_unlink faults aren't errors */
        if (urb->status && !(urb->status == -ENOENT ||
                             urb->status == -ECONNRESET ||
                             urb->status == -ESHUTDOWN))
index 0c7c8455a471c5debd5778efe3535db154e44425..8b57dc0c3e14007f8a30327fd1fcfc29a2ad76f3 100644 (file)
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 
 #include <pbd/pthread_utils.h>
@@ -181,7 +182,7 @@ OSC::start ()
        int fd = mkstemp(tmpstr);
        
        if (fd >= 0 ) {
-               unlink (tmpstr);
+               ::g_unlink (tmpstr);
                close (fd);
                
                _osc_unix_server = lo_server_new (tmpstr, error_callback);
@@ -284,11 +285,11 @@ OSC::stop ()
        }
        
        if (!_osc_unix_socket_path.empty()) {
-               unlink (_osc_unix_socket_path.c_str());
+               ::g_unlink (_osc_unix_socket_path.c_str());
        }
        
        if (!_osc_url_file.empty() ) {
-               unlink (_osc_url_file.c_str() );
+               ::g_unlink (_osc_url_file.c_str() );
        }
 
        // Delete any active route observers