summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Facchini <stefano.facchini@gmail.com>2017-10-18 20:08:15 +0000
committerStefano Facchini <stefano.facchini@gmail.com>2017-10-19 17:22:34 +0000
commitc419daf4e13efc020401b3bcbbe8b6116bb3cdd7 (patch)
tree2826a647cf101a01a566a7623aba481957da3524
parentRemove all unused makefile.in (diff)
downloadinkscape-c419daf4e13efc020401b3bcbbe8b6116bb3cdd7.tar.gz
inkscape-c419daf4e13efc020401b3bcbbe8b6116bb3cdd7.zip
Drop obsolete wrapper around Glib::file_open_tmp
-rw-r--r--src/extension/implementation/script.cpp21
-rw-r--r--src/extension/implementation/xslt.cpp4
-rw-r--r--src/io/sys.cpp21
-rw-r--r--src/io/sys.h2
-rw-r--r--src/ui/dialog/print.cpp3
5 files changed, 13 insertions, 38 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index 8da56fecd..2901655f1 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -32,7 +32,6 @@
#include "extension/input.h"
#include "extension/db.h"
#include "inkscape.h"
-#include "io/sys.h"
#include "io/resource.h"
#include "preferences.h"
#include "script.h"
@@ -398,7 +397,7 @@ ScriptDocCache::ScriptDocCache (Inkscape::UI::View::View * view) :
_tempfd(0)
{
try {
- _tempfd = Inkscape::IO::file_open_tmp(_filename, "ink_ext_XXXXXX.svg");
+ _tempfd = Glib::file_open_tmp(_filename, "ink_ext_XXXXXX.svg");
} catch (...) {
/// \todo Popup dialog here
return;
@@ -462,7 +461,7 @@ Gtk::Widget *Script::prefs_output(Inkscape::Extension::Output *module)
\param filename File to open.
First things first, this function needs a temporary file name. To
- create on of those the function g_file_open_tmp is used with
+ create on of those the function Glib::file_open_tmp is used with
the header of ink_ext_.
The extension is then executed using the 'execute' function
@@ -483,7 +482,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module,
std::string tempfilename_out;
int tempfd_out = 0;
try {
- tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg");
+ tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg");
} catch (...) {
/// \todo Popup dialog here
return NULL;
@@ -513,7 +512,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module,
mydoc->changeUriAndHrefs(filenameArg);
}
- // make sure we don't leak file descriptors from g_file_open_tmp
+ // make sure we don't leak file descriptors from Glib::file_open_tmp
close(tempfd_out);
unlink(tempfilename_out.c_str());
@@ -539,7 +538,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module,
do that eh?
First things first, the document is saved to a temporary file that
- is an SVG file. To get the temporary filename g_file_open_tmp is used with
+ is an SVG file. To get the temporary filename Glib::file_open_tmp is used with
ink_ext_ as a prefix. Don't worry, this file gets deleted at the
end of the function.
@@ -558,7 +557,7 @@ void Script::save(Inkscape::Extension::Output *module,
std::string tempfilename_in;
int tempfd_in = 0;
try {
- tempfd_in = Inkscape::IO::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg");
+ tempfd_in = Glib::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg");
} catch (...) {
/// \todo Popup dialog here
throw Inkscape::Extension::Output::save_failed();
@@ -587,7 +586,7 @@ void Script::save(Inkscape::Extension::Output *module,
success = fileout.toFile(lfilename);
}
- // make sure we don't leak file descriptors from g_file_open_tmp
+ // make sure we don't leak file descriptors from Glib::file_open_tmp
close(tempfd_in);
// FIXME: convert to utf8 (from "filename encoding") and unlink_utf8name
unlink(tempfilename_in.c_str());
@@ -609,7 +608,7 @@ void Script::save(Inkscape::Extension::Output *module,
This function is a little bit trickier than the previous two. It
needs two temporary files to get it's work done. Both of these
- files have random names created for them using the g_file_open_temp function
+ files have random names created for them using the Glib::file_open_temp function
with the ink_ext_ prefix in the temporary directory. Like the other
functions, the temporary files are deleted at the end.
@@ -667,7 +666,7 @@ void Script::effect(Inkscape::Extension::Effect *module,
std::string tempfilename_out;
int tempfd_out = 0;
try {
- tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg");
+ tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg");
} catch (...) {
/// \todo Popup dialog here
return;
@@ -740,7 +739,7 @@ void Script::effect(Inkscape::Extension::Effect *module,
pump_events();
- // make sure we don't leak file descriptors from g_file_open_tmp
+ // make sure we don't leak file descriptors from Glib::file_open_tmp
close(tempfd_out);
g_unlink(tempfilename_out.c_str());
diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp
index 94852a98e..d11283db7 100644
--- a/src/extension/implementation/xslt.cpp
+++ b/src/extension/implementation/xslt.cpp
@@ -16,13 +16,13 @@
#include <config.h>
#endif
+#include <glibmm/fileutils.h>
#include "file.h"
#include "xslt.h"
#include "../extension.h"
#include "../output.h"
#include "extension/input.h"
-#include "io/sys.h"
#include "io/resource.h"
#include <unistd.h>
#include <cstring>
@@ -175,7 +175,7 @@ void XSLT::save(Inkscape::Extension::Output *module, SPDocument *doc, gchar cons
std::string tempfilename_out;
int tempfd_out = 0;
try {
- tempfd_out = Inkscape::IO::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX");
+ tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX");
} catch (...) {
/// \todo Popup dialog here
return;
diff --git a/src/io/sys.cpp b/src/io/sys.cpp
index 833dee437..2ff17cdc9 100644
--- a/src/io/sys.cpp
+++ b/src/io/sys.cpp
@@ -18,7 +18,6 @@
#include <fstream>
#include <glib.h>
#include <glib/gstdio.h>
-#include <glibmm/fileutils.h>
#include <glibmm/ustring.h>
#include <gtk/gtk.h>
@@ -107,26 +106,6 @@ int Inkscape::IO::mkdir_utf8name( char const *utf8name )
return retval;
}
-/*
- * Wrapper around Glib::file_open_tmp().
- * Returns a handle to the temp file.
- * name_used contains the actual name used (a raw filename, not necessarily utf8).
- *
- * Returns:
- * A file handle (as from open()) to the file opened for reading and writing.
- * The file is opened in binary mode on platforms where there is a difference.
- * The file handle should be closed with close().
- *
- * Note:
- * On Windows Vista Glib::file_open_tmp fails with the current version of glibmm
- * A special case is implemented for WIN32. This can be removed if the issue is fixed
- * in future versions of glibmm
- * */
-int Inkscape::IO::file_open_tmp(std::string& name_used, const std::string& prefix)
-{
- return Glib::file_open_tmp(name_used, prefix);
-}
-
bool Inkscape::IO::file_test( char const *utf8name, GFileTest test )
{
bool exists = false;
diff --git a/src/io/sys.h b/src/io/sys.h
index 78d25afa3..e349fc09c 100644
--- a/src/io/sys.h
+++ b/src/io/sys.h
@@ -32,8 +32,6 @@ FILE *fopen_utf8name( char const *utf8name, char const *mode );
int mkdir_utf8name( char const *utf8name );
-int file_open_tmp( std::string& name_used, const std::string& prefix );
-
bool file_test( char const *utf8name, GFileTest test );
bool file_directory_exists( char const *utf8name );
diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp
index 4d248fd09..532a8c364 100644
--- a/src/ui/dialog/print.cpp
+++ b/src/ui/dialog/print.cpp
@@ -26,7 +26,6 @@
#include "util/units.h"
#include "helper/png-write.h"
#include "svg/svg-color.h"
-#include "io/sys.h"
#include <glibmm/i18n.h>
@@ -52,7 +51,7 @@ static void draw_page(GtkPrintOperation *,
std::string tmp_base = "inkscape-print-png-XXXXXX";
int tmp_fd;
- if ( (tmp_fd = Inkscape::IO::file_open_tmp (tmp_png, tmp_base)) >= 0) {
+ if ( (tmp_fd = Glib::file_open_tmp(tmp_png, tmp_base)) >= 0) {
close(tmp_fd);
guint32 bgcolor = 0x00000000;