diff options
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/Glob.cxx | 6 | ||||
-rw-r--r-- | Source/kwsys/RegularExpression.cxx | 18 | ||||
-rw-r--r-- | Source/kwsys/RegularExpression.hxx.in | 16 |
3 files changed, 23 insertions, 17 deletions
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index f5dc512..21efca8 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -380,13 +380,13 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr) } kwsys_stl::string fexpr = expr; - int skip = 0; - int last_slash = 0; + kwsys_stl::string::size_type skip = 0; + kwsys_stl::string::size_type last_slash = 0; for ( cc = 0; cc < expr.size(); cc ++ ) { if ( cc > 0 && expr[cc] == '/' && expr[cc-1] != '\\' ) { - last_slash = static_cast<int>(cc); + last_slash = cc; } if ( cc > 0 && (expr[cc] == '[' || expr[cc] == '?' || expr[cc] == '*') && diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx index 6a62351..89cab6c 100644 --- a/Source/kwsys/RegularExpression.cxx +++ b/Source/kwsys/RegularExpression.cxx @@ -269,7 +269,7 @@ const unsigned char MAGIC = 0234; * Utility definitions. */ -#define UCHARAT(p) ((const unsigned char*)(p))[0] +#define UCHARAT(p) (reinterpret_cast<const unsigned char*>(p))[0] #define FAIL(m) { regerror(m); return(0); } @@ -316,7 +316,7 @@ static char* regatom (int*); static char* regnode (char); static const char* regnext (register const char*); static char* regnext (register char*); -static void regc (unsigned char); +static void regc (char); static void reginsert (char, char*); static void regtail (char*, const char*); static void regoptail (char*, const char*); @@ -362,7 +362,7 @@ bool RegularExpression::compile (const char* exp) { regnpar = 1; regsize = 0L; regcode = ®dummy; - regc(MAGIC); + regc(static_cast<char>(MAGIC)); if(!reg(0, &flags)) { printf ("RegularExpression::compile(): Error in compile.\n"); @@ -394,7 +394,7 @@ bool RegularExpression::compile (const char* exp) { regparse = exp; regnpar = 1; regcode = this->program; - regc(MAGIC); + regc(static_cast<char>(MAGIC)); reg(0, &flags); // Dig out information for optimizations. @@ -426,7 +426,7 @@ bool RegularExpression::compile (const char* exp) { for (; scan != 0; scan = regnext(scan)) if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) { longest = OPERAND(scan); - len = int(strlen(OPERAND(scan))); + len = strlen(OPERAND(scan)); } this->regmust = longest; this->regmlen = len; @@ -675,7 +675,7 @@ static char* regatom (int *flagp) { return 0; } for (; rxpclass <= rxpclassend; rxpclass++) - regc(static_cast<unsigned char>(rxpclass)); + regc(static_cast<char>(rxpclass)); regparse++; } } @@ -778,7 +778,7 @@ static char* regnode (char op) { /* - regc - emit (if appropriate) a byte of code */ -static void regc (unsigned char b) { +static void regc (char b) { if (regcode != ®dummy) *regcode++ = b; else @@ -1018,14 +1018,14 @@ static int regmatch (const char* prog) { reginput++; break; case EXACTLY:{ - register int len; + register size_t len; register const char* opnd; opnd = OPERAND(scan); // Inline the first character, for speed. if (*opnd != *reginput) return (0); - len = int(strlen(opnd)); + len = strlen(opnd); if (len > 1 && strncmp(opnd, reginput, len) != 0) return (0); reginput += len; diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in index a681e11..9af53d3 100644 --- a/Source/kwsys/RegularExpression.hxx.in +++ b/Source/kwsys/RegularExpression.hxx.in @@ -323,7 +323,8 @@ inline RegularExpression::~RegularExpression () */ inline kwsys_stl::string::size_type RegularExpression::start () const { - return(this->startp[0] - searchstring); + return static_cast<kwsys_stl::string::size_type>( + this->startp[0] - searchstring); } @@ -332,7 +333,8 @@ inline kwsys_stl::string::size_type RegularExpression::start () const */ inline kwsys_stl::string::size_type RegularExpression::end () const { - return(this->endp[0] - searchstring); + return static_cast<kwsys_stl::string::size_type>( + this->endp[0] - searchstring); } /** @@ -367,7 +369,8 @@ inline void RegularExpression::set_invalid () */ inline kwsys_stl::string::size_type RegularExpression::start(int n) const { - return this->startp[n] - searchstring; + return static_cast<kwsys_stl::string::size_type>( + this->startp[n] - searchstring); } @@ -376,7 +379,8 @@ inline kwsys_stl::string::size_type RegularExpression::start(int n) const */ inline kwsys_stl::string::size_type RegularExpression::end(int n) const { - return this->endp[n] - searchstring; + return static_cast<kwsys_stl::string::size_type>( + this->endp[n] - searchstring); } /** @@ -390,7 +394,9 @@ inline kwsys_stl::string RegularExpression::match(int n) const } else { - return kwsys_stl::string(this->startp[n], this->endp[n] - this->startp[n]); + return kwsys_stl::string(this->startp[n], + static_cast<kwsys_stl::string::size_type>( + this->endp[n] - this->startp[n])); } } |