]> git.lyx.org Git - lyx.git/blobdiff - src/support/copy.cpp
cosmetics
[lyx.git] / src / support / copy.cpp
index 15b674ccdcce7d1a9da52ceaa644c973aa0a0ed6..3c7c43ad56f2b21ef428db3b478ad3b70c93cea9 100644 (file)
 # include <sys/types.h>
 #endif
 
+using namespace std;
 
 namespace lyx {
+namespace support {
 
-
-using std::ifstream;
-using std::ofstream;
-using std::ios;
-using std::string;
-
-
-bool lyx::support::chmod(FileName const & file, unsigned long int mode)
+bool chmod(FileName const & file, unsigned long int mode)
 {
 #if defined (HAVE_CHMOD) && defined (HAVE_MODE_T)
        if (::chmod(file.toFilesystemEncoding().c_str(), mode_t(mode)) != 0)
                return false;
 #else
-# ifdef WITH_WARNINGS
-#  warning "File permissions are ignored on this system."
-# endif
+       // FIXME: "File permissions are ignored on this system."
 #endif
        return true;
 }
 
 
-bool lyx::support::copy(FileName const & from, FileName const & to, unsigned long int mode)
+bool copy(FileName const & from, FileName const & to, unsigned long int mode)
 {
        ifstream ifs(from.toFilesystemEncoding().c_str(), ios::binary | ios::in);
        if (!ifs)
                return false;
 
        if (mode != (unsigned long int)-1) {
-               ofstream ofs(to.toFilesystemEncoding().c_str(), ios::binary | ios::out | ios::trunc);
+               ofstream ofs(to.toFilesystemEncoding().c_str(),
+                       ios::binary | ios::out | ios::trunc);
                if (!ofs)
                        return false;
                ofs.close();
@@ -61,7 +55,8 @@ bool lyx::support::copy(FileName const & from, FileName const & to, unsigned lon
                        return false;
        }
 
-       ofstream ofs(to.toFilesystemEncoding().c_str(), ios::binary | ios::out | ios::trunc);
+       ofstream ofs(to.toFilesystemEncoding().c_str(),
+                       ios::binary | ios::out | ios::trunc);
        if (!ofs)
                return false;
 
@@ -69,5 +64,5 @@ bool lyx::support::copy(FileName const & from, FileName const & to, unsigned lon
        return ofs.good();
 }
 
-
+} // namespace support
 } // namespace lyx