summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2017-10-15 10:18:53 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2017-10-15 10:18:53 +0000
commit41f92be2f19e771820c12a4c528896e9133545f4 (patch)
tree5c5697637c31db6dc2cb897ca57c5fc31f356807
parent6bfa08c63d75ea8883952dc1ea3a7da5f3da73c7 (diff)
Replace remaining calls to unlink() with fl_unlink().
Tested under Linux, MinGW, and Visual Studio 2015. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12496 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--FL/Fl_System_Driver.H2
-rw-r--r--FL/fl_utf8.h4
-rw-r--r--fluid/fluid.cxx5
-rw-r--r--fluid/template_panel.cxx2
-rw-r--r--fluid/template_panel.fl2
-rw-r--r--fluid/undo.cxx10
-rw-r--r--src/Fl_x.cxx2
-rw-r--r--src/fl_utf8.cxx10
8 files changed, 16 insertions, 21 deletions
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H
index b1fb209c6..dfdd4c3e3 100644
--- a/FL/Fl_System_Driver.H
+++ b/FL/Fl_System_Driver.H
@@ -95,7 +95,7 @@ public:
virtual int access(const char* f, int mode) { return -1;}
virtual int stat(const char* f, struct stat *b) { return -1;}
virtual char *getcwd(char* b, int l) {return NULL;}
- virtual int unlink(const char* f) {return -1;}
+ virtual int unlink(const char* fname) {return -1;}
virtual int mkdir(const char* f, int mode) {return -1;}
virtual int rmdir(const char* f) {return -1;}
virtual int rename(const char* f, const char *n) {return -1;}
diff --git a/FL/fl_utf8.h b/FL/fl_utf8.h
index 54b192b1f..2b1623138 100644
--- a/FL/fl_utf8.h
+++ b/FL/fl_utf8.h
@@ -3,7 +3,7 @@
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
* Copyright 2000-2010 by O'ksi'D.
- * Copyright 2016 by Bill Spitzak and others.
+ * Copyright 2016-2017 by Bill Spitzak and others.
*
* This library is free software. Distribution and use rights are outlined in
* the file "COPYING" which should have been included with this file. If this
@@ -180,7 +180,7 @@ FL_EXPORT int fl_open(const char* f, int o, ...);
FL_EXPORT int fl_open_ext(const char* fname, int translation, int oflags, ...);
/* OD: Portable UTF-8 aware unlink wrapper */
-FL_EXPORT int fl_unlink(const char *f);
+FL_EXPORT int fl_unlink(const char *fname);
/* OD: Portable UTF-8 aware rmdir wrapper */
FL_EXPORT int fl_rmdir(const char *f);
diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx
index 5d65942a6..7c5131829 100644
--- a/fluid/fluid.cxx
+++ b/fluid/fluid.cxx
@@ -61,7 +61,6 @@
# define access _access
# define chdir _chdir
# define getcwd _getcwd
-# define unlink _unlink
# endif // !__WATCOMC__
#else
# include <unistd.h>
@@ -671,7 +670,7 @@ void new_cb(Fl_Widget *, void *v) {
undo_suspend();
read_file(cutfname(1), 0);
- unlink(cutfname(1));
+ fl_unlink(cutfname(1));
undo_resume();
} else {
// No instance name, so read the template without replacements...
@@ -864,7 +863,7 @@ void duplicate_cb(Fl_Widget*, void*) {
if (!read_file(cutfname(1), 1)) {
fl_message("Can't read %s: %s", cutfname(1), strerror(errno));
}
- unlink(cutfname(1));
+ fl_unlink(cutfname(1));
undo_resume();
force_parent = 0;
diff --git a/fluid/template_panel.cxx b/fluid/template_panel.cxx
index 565bb3a4d..5762980ac 100644
--- a/fluid/template_panel.cxx
+++ b/fluid/template_panel.cxx
@@ -202,7 +202,7 @@ void template_delete_cb(Fl_Button *, void *) {
if (!fl_choice("Are you sure you want to delete the template \"%s\"?",
"Cancel", "Delete", 0, name)) return;
- if (unlink(flfile)) {
+ if (fl_unlink(flfile)) {
fl_alert("Unable to delete template \"%s\":\n%s", name, strerror(errno));
return;
}
diff --git a/fluid/template_panel.fl b/fluid/template_panel.fl
index fd145c5c2..fd6a1d5e1 100644
--- a/fluid/template_panel.fl
+++ b/fluid/template_panel.fl
@@ -197,7 +197,7 @@ if (!flfile) return;
if (!fl_choice("Are you sure you want to delete the template \\"%s\\"?",
"Cancel", "Delete", 0, name)) return;
-if (unlink(flfile)) {
+if (fl_unlink(flfile)) {
fl_alert("Unable to delete template \\"%s\\":\\n%s", name, strerror(errno));
return;
}
diff --git a/fluid/undo.cxx b/fluid/undo.cxx
index 7d4af49bd..62770fec4 100644
--- a/fluid/undo.cxx
+++ b/fluid/undo.cxx
@@ -3,7 +3,7 @@
//
// FLUID undo support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2017 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -22,15 +22,11 @@
#include <FL/Fl_Preferences.H>
#include <FL/filename.H>
#include "../src/flstring.h"
+
#if defined(WIN32) && !defined(__CYGWIN__)
# include <io.h>
# include <windows.h>
# define getpid (int)GetCurrentProcessId
-# ifndef __WATCOMC__
-// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
-// on Windows, which is supposed to be POSIX compliant...
-# define unlink _unlink
-# endif // !__WATCOMC__
#else
# include <unistd.h>
#endif // WIN32 && !__CYGWIN__
@@ -159,7 +155,7 @@ void undo_clear() {
// Remove old checkpoint files...
for (int i = 0; i <= undo_max; i ++) {
- unlink(undo_filename(i, filename, sizeof(filename)));
+ fl_unlink(undo_filename(i, filename, sizeof(filename)));
}
// Reset current, last, and save indices...
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 9e51e7068..62d19d777 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1396,7 +1396,7 @@ fprintf(stderr,"\n");*/
close(fd);
free(sn_buffer); sn_buffer = 0;
shared = Fl_Shared_Image::get(tmp_fname);
- unlink(tmp_fname);
+ fl_unlink(tmp_fname);
if (!shared) return 0;
uchar *rgb = new uchar[shared->w() * shared->h() * shared->d()];
memcpy(rgb, shared->data()[0], shared->w() * shared->h() * shared->d());
diff --git a/src/fl_utf8.cxx b/src/fl_utf8.cxx
index 0a79e5867..25c2e81b9 100644
--- a/src/fl_utf8.cxx
+++ b/src/fl_utf8.cxx
@@ -454,14 +454,14 @@ char *fl_getcwd(char* b, int l) {
/** Cross-platform function to unlink() (that is, delete) a file using
a UTF-8 encoded filename.
- This function is especially useful under the MSWindows platform where the
- standard function expects UTF-16 encoded non-ASCII filenames.
+ This function is especially useful on the Windows platform where
+ the standard function expects UTF-16 encoded non-ASCII filenames.
- \param f the filename to unlink
+ \param fname the filename to unlink
\return the return value of _wunlink() on Windows or unlink() on other platforms.
*/
-int fl_unlink(const char* f) {
- return Fl::system_driver()->unlink(f);
+int fl_unlink(const char* fname) {
+ return Fl::system_driver()->unlink(fname);
}
/** Cross-platform function to create a directory with a UTF-8 encoded