]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.C
Add a bunch of c_str() for string stream uses; remove lyxfunc symbol-insert.
[lyx.git] / src / support / filetools.C
index 8f19df47a52d3bd8a31d1d5e21f675e9072ad941..c9605aa7f8f87dd153982a1565b8ca1601130828 100644 (file)
@@ -58,6 +58,13 @@ using std::pair;
 using std::endl;
 using std::ifstream;
 
+#if 0
+using std::getenv;
+using std::isalpha;
+using std::isalnum;
+using std::popen;
+#endif
+
 extern string system_lyxdir;
 extern string build_lyxdir;
 extern string user_lyxdir;
@@ -290,7 +297,7 @@ i18nLibFileSearch(string const & dir, string const & name,
 string const GetEnv(string const & envname)
 {
         // f.ex. what about error checking?
-        char const * const ch = ::getenv(envname.c_str());
+        char const * const ch = getenv(envname.c_str());
         string const envstr = !ch ? "" : ch;
         return envstr;
 }
@@ -539,7 +546,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
        // checks for already absolute path
        if (AbsolutePath(RelPath))
 #ifdef __EMX__
-               if(RelPath[0]!= '/' && RelPath[0]!= '\\')
+               if (RelPath[0]!= '/' && RelPath[0]!= '\\')
 #endif
                return RelPath;
 
@@ -579,7 +586,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
                if (Temp == ".") continue;
                if (Temp == "..") {
                        // Remove one level of TempBase
-                       int i = TempBase.length() - 2;
+                       string::difference_type i = TempBase.length() - 2;
 #ifndef __EMX__
                        if (i < 0) i = 0;
                        while (i > 0 && TempBase[i] != '/') --i;
@@ -701,7 +708,7 @@ string const NormalizePath(string const & path)
                        TempBase = "./";
                } else if (Temp == "..") {
                        // Remove one level of TempBase
-                       int i = TempBase.length() - 2;
+                       string::difference_type i = TempBase.length() - 2;
                        while (i > 0 && TempBase[i] != '/')
                                --i;
                        if (i >= 0 && TempBase[i] == '/')
@@ -853,11 +860,11 @@ string const MakeRelPath(string const & abspath0, string const & basepath0)
        if (abspath.empty())
                return "<unknown_path>";
 
-       int const abslen = abspath.length();
-       int const baselen = basepath.length();
+       string::size_type const abslen = abspath.length();
+       string::size_type const baselen = basepath.length();
        
        // Find first different character
-       int i = 0;
+       string::size_type i = 0;
        while (i < abslen && i < baselen && abspath[i] == basepath[i]) ++i;
 
        // Go back to last /
@@ -877,7 +884,7 @@ string const MakeRelPath(string const & abspath0, string const & basepath0)
        // Count how many dirs there are in basepath above match
        // and append as many '..''s into relpath
        string buf;
-       int j = i;
+       string::size_type j = i;
        while (j < baselen) {
                if (basepath[j] == '/') {
                        if (j + 1 == baselen) break;
@@ -913,9 +920,9 @@ string const AddPath(string const & path, string const & path_2)
        }
 
        if (!path2.empty()){
-               int p2start = path2.find_first_not_of('/');
+               string::size_type p2start = path2.find_first_not_of('/');
 
-               int p2end = path2.find_last_not_of('/');
+               string::size_type p2end = path2.find_last_not_of('/');
 
                string tmp = path2.substr(p2start, p2end - p2start + 1);
                buf += tmp + '/';
@@ -966,13 +973,13 @@ string const GetExtension(string const & name)
 string const
 MakeDisplayPath (string const & path, unsigned int threshold)
 {
-       int const l1 = path.length();
+       string::size_type const l1 = path.length();
 
        // First, we try a relative path compared to home
        string const home(GetEnvPath("HOME"));
        string relhome = MakeRelPath(path, home);
 
-       unsigned int l2 = relhome.length();
+       string::size_type l2 = relhome.length();
 
        string prefix;