]> git.lyx.org Git - lyx.git/commitdiff
Fix some INFO reports from compaq cxx in support/
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 18 Oct 2000 14:07:29 +0000 (14:07 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 18 Oct 2000 14:07:29 +0000 (14:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1139 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
NEWS
src/support/FileInfo.C
src/support/FileInfo.h
src/support/LRegex.C
src/support/StrPool.C
src/support/filetools.C
src/support/lstrings.C
src/support/lstrings.h
src/support/lyxlib.h
src/support/mkdir.C

index 73b9697a4932cb3ce0897ad602694a834f274436..e3d13e736a5beccba04094a8514bed302db71440 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2000-10-18  Angus Leeming <a.leeming@ic.ac.uk>
+       * src/support/lstrings.C (lowercase, uppercase):
+       use explicit casts to remove compiler warnings.
+
+       * src/support/LRegex.C (Impl):
+       * src/support/StrPool.C (add):
+       * src/support/filetools.C (MakeAbsPath, NormalizePath, MakeRelPath)
+       (AddPath, MakeDisplayPath):
+       * src/support/lstrings.C (prefixIs, subst):
+       use correct type to remove compiler warnings.
+
+       * src/support/lstrings.[Ch] (countChar): returns string::size_type.
+
+       * src/support/lyxlib.h:
+       * src/support/mkdir.C (mkdir): change parameter to mode_t for
+       portability and to remove compiler warning with DEC cxx.
+
+       * src/support/FileInfo.[Ch] (flagRWX): ditto.
+
 2000-10-18  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * src/minibuffer.C (peek_event): retun 1 when there has been a
diff --git a/NEWS b/NEWS
index 5c13c7a068a09043f7ca059d92c2a46e2fea15f1..630f979fa8f742c4f27cf38a228db5b4322ed563 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,8 +20,8 @@ from the older development version:
 - LyX now has a Preference popup where you can change most of your
   lyxrc settings [Allan, details?]
 
-- the menus can now be defined from a text file (like the toolbar) and
-  shows the keyboard bindings associated to commands.
+- The menus can now be defined in a text file, and they automatically
+  display the keyboard bindings associated with commands.
 
 - it is now possible to provide your own icons for the toolbar.
 
index 3bc18c123120fd13509a765a9d4eb983ba4559d3..944652b9e1c3f79e0e5308521f3aafa02e0c01eb 100644 (file)
@@ -237,7 +237,7 @@ char FileInfo::typeLetter() const
 
 
 // should not be in FileInfo
-void FileInfo::flagRWX(unsigned short i, char * szString) const
+void FileInfo::flagRWX(mode_t i, char * szString) const
 {
        szString[0] = (i & S_IRUSR) ? 'r' : '-';
        szString[1] = (i & S_IWUSR) ? 'w' : '-';
index b2f8caad182a92e9ef83c54d3e07c7e7cad4b4f3..93bbadc8fb860525800ed0831f709cd0b1a032db 100644 (file)
@@ -60,7 +60,7 @@ public:
        char typeLetter() const;
        
        /// builds 'rwx' string describing file access rights
-       void flagRWX(unsigned short i, char * szString) const;
+       void flagRWX(mode_t i, char * szString) const;
        
        /// updates mode string to match suid/sgid/sticky bits
        void setSticky(char * szString) const;
index c6c1e938ce28db8bf25093aac9a23facfb6d3f7f..1b6064abd78a9027fac64a8728fceb9df0c9908c 100644 (file)
@@ -59,10 +59,10 @@ struct LRegex::Impl {
        {
                regmatch_t tmp;
                regexec(preg, str.c_str(), 1, &tmp, 0);
-               unsigned int const first = tmp.rm_so != -1 ?
-                       static_cast<unsigned int>(tmp.rm_so) : string::npos;
-               unsigned int const second = tmp.rm_eo != -1 ?
-                       static_cast<unsigned int>(tmp.rm_eo) : string::npos;
+               string::size_type const first = tmp.rm_so != -1 ?
+                       tmp.rm_so : string::npos;
+               string::size_type const second = tmp.rm_eo != -1 ?
+                       tmp.rm_eo : string::npos;
                return make_pair(first, second - first);
        }
        
@@ -91,18 +91,16 @@ struct LRegex::Impl {
                size_t const subs =
                        (preg->re_nsub != 0 ? (preg->re_nsub + 1) : 1);
                regmatch_t * mat = new regmatch_t[subs];
-               unsigned int first = 0;
-               unsigned int second = 0;
+               string::size_type first = 0;
+               string::size_type second = 0;
                matches.erase(matches.begin(), matches.end());
                if (!regexec(preg, str.c_str(), subs, mat, 0)) { // some match
                        matches.reserve(subs);
                        for (size_t i = 0; i < subs; ++i) {
                                first = mat[i].rm_so != -1 ?
-                                       static_cast<unsigned int>
-                                       (mat[i].rm_so) : string::npos;
+                                       mat[i].rm_so : string::npos;
                                second = mat[i].rm_eo != -1 ?
-                                       static_cast<unsigned int>
-                                       (mat[i].rm_eo) : string::npos;
+                                       mat[i].rm_eo : string::npos;
                                matches.push_back(make_pair(first,
                                                            second - first));
                        }
index 0fc53402ccff589e3de7f207361f292176e86032..7dd6168f171ba66d7daf67192c3c4137f7dbc47b 100644 (file)
@@ -31,7 +31,7 @@ StrPool::~StrPool()
 */
 char const * StrPool::add(string const & str)
 {
-       int s = str.length();
+       string::size_type s = str.length();
         char * buf = new char [s + 1];
         str.copy(buf, s);
         buf[s] = '\0';
index 8f19df47a52d3bd8a31d1d5e21f675e9072ad941..fdd8bef9e82ca60cee7131ea5f2578fb22a751ad 100644 (file)
@@ -579,7 +579,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 +701,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,8 +853,8 @@ 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;
@@ -913,9 +913,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 +966,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;
 
index 689a54be761ecb06a63ebaeec3406e0daaf3d9be..270af081b9172d8f60377ebf6d9f8cc999810452 100644 (file)
@@ -155,13 +155,13 @@ double strToDbl(string const & str)
 
 char lowercase(char c) 
 { 
-       return tolower(c); 
+       return char( tolower(c) ); 
 }
 
 
 char uppercase(char c) 
 { 
-       return toupper(c); 
+       return char( toupper(c) ); 
 }
 
 
@@ -205,7 +205,7 @@ bool prefixIs(string const & a, char const * pre)
 {
        Assert(pre);
        
-       unsigned int const l = strlen(pre);
+       size_t const l = strlen(pre);
        string::size_type const alen = a.length();
        
        if (l > alen || a.empty())
@@ -253,7 +253,7 @@ bool suffixIs(string const & a, char const * suf)
 {
        Assert(suf);
        
-       unsigned int const suflen = strlen(suf);
+       size_t const suflen = strlen(suf);
        if (suflen > a.length())
                return false;
        else {
@@ -353,7 +353,7 @@ bool containsOnly(char const * s, string const & cset)
 }
 
 
-unsigned int countChar(string const & a, char c)
+string::size_type countChar(string const & a, char c)
 {
 #ifdef HAVE_STD_COUNT
        return count(a.begin(), a.end(), c);
@@ -441,7 +441,7 @@ string const subst(string const & a,
        
        string lstr(a);
        string::size_type i = 0;
-       int olen = strlen(oldstr);
+       string::size_type olen = strlen(oldstr);
        while((i = lstr.find(oldstr, i)) != string::npos) {
                lstr.replace(i, olen, newstr);
                i += newstr.length(); // We need to be sure that we dont
index d718b57243511c8aa934268c7972201b077d2329..cc3e88acda57de2c16d7566bec356876e1ece1ad 100644 (file)
@@ -127,7 +127,7 @@ bool containsOnly(char const *, char const *);
 bool containsOnly(char const *, string const &);
 
 /// Counts how many of character c there is in a
-unsigned int countChar(string const & a, char c);
+string::size_type countChar(string const & a, char c);
 
 /** Extracts a token from this string at the nth delim.
   Doesn't modify the original string. Similar to strtok.
index acaa2b0e4eb70f065d89683d6d8f0ddb5f25791a..a159ee30d07e111d9e7057fdd3a93fdbbff714e2 100644 (file)
@@ -47,7 +47,7 @@ namespace lyx {
        ///
        void abort();
         ///
-        int mkdir(string const & pathname, unsigned long int mode);
+        int mkdir(string const & pathname, mode_t mode);
        ///
        int putenv(char const * str);
         ///
index e3a5102ecb0b09a511627f792844705cc6aa8157..66f148821e4b02c67a4ba2d94d2d87d3cca2b375 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "lyxlib.h"
 
-int lyx::mkdir(string const & pathname, unsigned long int mode)
+int lyx::mkdir(string const & pathname, mode_t mode)
 {
        return ::mkdir(pathname.c_str(), mode);
 }