Fix some INFO reports from compaq cxx in support/

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1139 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-10-18 14:07:29 +00:00
parent bdcc009110
commit bdbce4e178
11 changed files with 49 additions and 32 deletions

View File

@ -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

4
NEWS
View File

@ -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.

View 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' : '-';

View 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;

View 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));
}

View 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';

View 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;

View 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

View 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.

View 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);
///

View 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);
}