summaryrefslogtreecommitdiffstats
path: root/kdecore
diff options
context:
space:
mode:
Diffstat (limited to 'kdecore')
-rw-r--r--kdecore/kmacroexpander.cpp56
-rw-r--r--kdecore/kshell.cpp80
2 files changed, 68 insertions, 68 deletions
diff --git a/kdecore/kmacroexpander.cpp b/kdecore/kmacroexpander.cpp
index 81fd5478f..3c421574e 100644
--- a/kdecore/kmacroexpander.cpp
+++ b/kdecore/kmacroexpander.cpp
@@ -160,20 +160,20 @@ bool KMacroExpanderBase::expandMacrosShellQuote( TQString &str, uint &pos )
continue;
nohit:
if (state.current == singlequote) {
- if (cc == '\'')
+ if (cc == (QChar)'\'')
state = sstack.pop();
- } else if (cc == '\\') {
+ } else if (cc == (QChar)'\\') {
// always swallow the char -> prevent anomalies due to expansion
pos += 2;
continue;
} else if (state.current == dollarquote) {
- if (cc == '\'')
+ if (cc == (QChar)'\'')
state = sstack.pop();
- } else if (cc == '$') {
+ } else if (cc == (QChar)'$') {
cc = str[++pos];
- if (cc == '(') {
+ if (cc == (QChar)'(') {
sstack.push( state );
- if (str[pos + 1] == '(') {
+ if (str[pos + 1] == (QChar)'(') {
Save sav = { str, pos + 2 };
ostack.push( sav );
state.current = math;
@@ -183,21 +183,21 @@ bool KMacroExpanderBase::expandMacrosShellQuote( TQString &str, uint &pos )
state.current = paren;
state.dquote = false;
}
- } else if (cc == '{') {
+ } else if (cc == (QChar)'{') {
sstack.push( state );
state.current = subst;
} else if (!state.dquote) {
- if (cc == '\'') {
+ if (cc == (QChar)'\'') {
sstack.push( state );
state.current = dollarquote;
- } else if (cc == '"') {
+ } else if (cc == (QChar)'"') {
sstack.push( state );
state.current = doublequote;
state.dquote = true;
}
}
// always swallow the char -> prevent anomalies due to expansion
- } else if (cc == '`') {
+ } else if (cc == (QChar)'`') {
str.replace( pos, 1, "$( " ); // add space -> avoid creating $((
pos2 = pos += 3;
for (;;) {
@@ -206,12 +206,12 @@ bool KMacroExpanderBase::expandMacrosShellQuote( TQString &str, uint &pos )
return false;
}
cc = str.unicode()[pos2];
- if (cc == '`')
+ if (cc == (QChar)'`')
break;
- if (cc == '\\') {
+ if (cc == (QChar)'\\') {
cc = str[++pos2];
- if (cc == '$' || cc == '`' || cc == '\\' ||
- (cc == '"' && state.dquote))
+ if (cc == (QChar)'$' || cc == (QChar)'`' || cc == (QChar)'\\' ||
+ (cc == (QChar)'"' && state.dquote))
{
str.remove( pos2 - 1, 1 );
continue;
@@ -225,25 +225,25 @@ bool KMacroExpanderBase::expandMacrosShellQuote( TQString &str, uint &pos )
state.dquote = false;
continue;
} else if (state.current == doublequote) {
- if (cc == '"')
+ if (cc == (QChar)'"')
state = sstack.pop();
- } else if (cc == '\'') {
+ } else if (cc == (QChar)'\'') {
if (!state.dquote) {
sstack.push( state );
state.current = singlequote;
}
- } else if (cc == '"') {
+ } else if (cc == (QChar)'"') {
if (!state.dquote) {
sstack.push( state );
state.current = doublequote;
state.dquote = true;
}
} else if (state.current == subst) {
- if (cc == '}')
+ if (cc == (QChar)'}')
state = sstack.pop();
- } else if (cc == ')') {
+ } else if (cc == (QChar)')') {
if (state.current == math) {
- if (str[pos + 1] == ')') {
+ if (str[pos + 1] == (QChar)')') {
state = sstack.pop();
pos += 2;
} else {
@@ -261,15 +261,15 @@ bool KMacroExpanderBase::expandMacrosShellQuote( TQString &str, uint &pos )
state = sstack.pop();
else
break;
- } else if (cc == '}') {
+ } else if (cc == (QChar)'}') {
if (state.current == KMacroExpander::group)
state = sstack.pop();
else
break;
- } else if (cc == '(') {
+ } else if (cc == (QChar)'(') {
sstack.push( state );
state.current = paren;
- } else if (cc == '{') {
+ } else if (cc == (QChar)'{') {
sstack.push( state );
state.current = KMacroExpander::group;
}
@@ -315,7 +315,7 @@ static TQStringList &operator+=( TQStringList &s, const TQString &n) { s << n; r
static bool
isIdentifier( uint c )
{
- return c == '_' || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
+ return c == (QChar)'_' || (c >= (QChar)'A' && c <= (QChar)'Z') || (c >= (QChar)'a' && c <= (QChar)'z') || (c >= (QChar)'0' && c <= (QChar)'9');
}
////////
@@ -407,9 +407,9 @@ KMacroMapExpander<TQString,VT>::expandEscapedMacro( const TQString &str, uint po
return 2;
}
uint sl, rsl, rpos;
- if (str[pos + 1] == '{') {
+ if (str[pos + 1] == (QChar)'{') {
rpos = pos + 2;
- for (sl = 0; str[rpos + sl] != '}'; sl++)
+ for (sl = 0; str[rpos + sl] != (QChar)'}'; sl++)
if (rpos + sl >= str.length())
return 0;
rsl = sl + 3;
@@ -473,9 +473,9 @@ KWordMacroExpander::expandEscapedMacro( const TQString &str, uint pos, TQStringL
return 2;
}
uint sl, rsl, rpos;
- if (str[pos + 1] == '{') {
+ if (str[pos + 1] == (QChar)'{') {
rpos = pos + 2;
- for (sl = 0; str[rpos + sl] != '}'; sl++)
+ for (sl = 0; str[rpos + sl] != (QChar)'}'; sl++)
if (rpos + sl >= str.length())
return 0;
rsl = sl + 3;
diff --git a/kdecore/kshell.cpp b/kdecore/kshell.cpp
index 3dcb3f273..5b92b1d5e 100644
--- a/kdecore/kshell.cpp
+++ b/kdecore/kshell.cpp
@@ -29,12 +29,12 @@
static int fromHex( TQChar c )
{
- if (c >= '0' && c <= '9')
- return c - '0';
- else if (c >= 'A' && c <= 'F')
- return c - 'A' + 10;
- else if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
+ if (c >= (QChar)'0' && c <= (QChar)'9')
+ return c - (QChar)'0';
+ else if (c >= (QChar)'A' && c <= (QChar)'F')
+ return c - (QChar)'A' + 10;
+ else if (c >= (QChar)'a' && c <= (QChar)'f')
+ return c - (QChar)'a' + 10;
return -1;
}
@@ -48,7 +48,7 @@ inline static bool isQuoteMeta( uint c )
return (c < sizeof(iqm) * 8) && (iqm[c / 8] & (1 << (c & 7)));
#else
- return c == '\\' || c == '\'' || c == '"' || c == '$';
+ return c == (int)'\\' || c == (int)'\'' || c == (int)'"' || c == (int)'$';
#endif
}
@@ -75,17 +75,17 @@ TQStringList KShell::splitArgs( const TQString &args, int flags, int *err )
c = args.unicode()[pos++];
} while (c.isSpace());
TQString cret;
- if ((flags & TildeExpand) && c == '~') {
+ if ((flags & TildeExpand) && c == (QChar)'~') {
uint opos = pos;
for (; ; pos++) {
if (pos >= args.length())
break;
c = args.unicode()[pos];
- if (c == '/' || c.isSpace())
+ if (c == (QChar)'/' || c.isSpace())
break;
if (isQuoteMeta( c )) {
pos = opos;
- c = '~';
+ c = (QChar)'~';
goto notilde;
}
if ((flags & AbortOnMeta) && isMeta( c ))
@@ -94,7 +94,7 @@ TQStringList KShell::splitArgs( const TQString &args, int flags, int *err )
TQString ccret = homeDir( TQConstString( args.unicode() + opos, pos - opos ).string() );
if (ccret.isEmpty()) {
pos = opos;
- c = '~';
+ c = (QChar)'~';
goto notilde;
}
if (pos >= args.length()) {
@@ -111,67 +111,67 @@ TQStringList KShell::splitArgs( const TQString &args, int flags, int *err )
}
// before the notilde label, as a tilde does not match anyway
if (firstword) {
- if (c == '_' || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
+ if (c == (QChar)'_' || (c >= (QChar)'A' && c <= (QChar)'Z') || (c >= (QChar)'a' && c <= (QChar)'z')) {
uint pos2 = pos;
TQChar cc;
do
cc = args[pos2++];
- while (cc == '_' || (cc >= 'A' && cc <= 'Z') ||
- (cc >= 'a' && cc <= 'z') || (cc >= '0' && cc <= '9'));
- if (cc == '=')
+ while (cc == (QChar)'_' || (cc >= (QChar)'A' && cc <= (QChar)'Z') ||
+ (cc >= (QChar)'a' && cc <= (QChar)'z') || (cc >= (QChar)'0' && cc <= (QChar)'9'));
+ if (cc == (QChar)'=')
goto metaerr;
}
}
notilde:
do {
- if (c == '\'') {
+ if (c == (QChar)'\'') {
uint spos = pos;
do {
if (pos >= args.length())
goto quoteerr;
c = args.unicode()[pos++];
- } while (c != '\'');
+ } while (c != (QChar)'\'');
cret += TQConstString( args.unicode() + spos, pos - spos - 1 ).string();
- } else if (c == '"') {
+ } else if (c == (QChar)'"') {
for (;;) {
if (pos >= args.length())
goto quoteerr;
c = args.unicode()[pos++];
- if (c == '"')
+ if (c == (QChar)'"')
break;
- if (c == '\\') {
+ if (c == (QChar)'\\') {
if (pos >= args.length())
goto quoteerr;
c = args.unicode()[pos++];
- if (c != '"' && c != '\\' &&
- !((flags & AbortOnMeta) && (c == '$' || c == '`')))
- cret += '\\';
- } else if ((flags & AbortOnMeta) && (c == '$' || c == '`'))
+ if (c != (QChar)'"' && c != (QChar)'\\' &&
+ !((flags & AbortOnMeta) && (c == (QChar)'$' || c == (QChar)'`')))
+ cret += (QChar)'\\';
+ } else if ((flags & AbortOnMeta) && (c == (QChar)'$' || c == (QChar)'`'))
goto metaerr;
cret += c;
}
- } else if (c == '$' && args[pos] == '\'') {
+ } else if (c == (QChar)'$' && args[pos] == (QChar)'\'') {
pos++;
for (;;) {
if (pos >= args.length())
goto quoteerr;
c = args.unicode()[pos++];
- if (c == '\'')
+ if (c == (QChar)'\'')
break;
- if (c == '\\') {
+ if (c == (QChar)'\\') {
if (pos >= args.length())
goto quoteerr;
c = args.unicode()[pos++];
switch (c) {
- case 'a': cret += '\a'; break;
- case 'b': cret += '\b'; break;
- case 'e': cret += '\033'; break;
- case 'f': cret += '\f'; break;
- case 'n': cret += '\n'; break;
- case 'r': cret += '\r'; break;
- case 't': cret += '\t'; break;
- case '\\': cret += '\\'; break;
- case '\'': cret += '\''; break;
+ case 'a': cret += (QChar)'\a'; break;
+ case 'b': cret += (QChar)'\b'; break;
+ case 'e': cret += (QChar)'\033'; break;
+ case 'f': cret += (QChar)'\f'; break;
+ case 'n': cret += (QChar)'\n'; break;
+ case 'r': cret += (QChar)'\r'; break;
+ case 't': cret += (QChar)'\t'; break;
+ case '\\': cret += (QChar)'\\'; break;
+ case '\'': cret += (QChar)'\''; break;
case 'c': cret += args[pos++] & 31; break;
case 'x':
{
@@ -189,11 +189,11 @@ TQStringList KShell::splitArgs( const TQString &args, int flags, int *err )
break;
}
default:
- if (c >= '0' && c <= '7') {
+ if (c >= (QChar)'0' && c <= (QChar)'7') {
int hv = c - '0';
for (int i = 0; i < 2; i++) {
c = args[pos];
- if (c < '0' || c > '7')
+ if (c < (QChar)'0' || c > (QChar)'7')
break;
hv = hv * 8 + (c - '0');
pos++;
@@ -209,7 +209,7 @@ TQStringList KShell::splitArgs( const TQString &args, int flags, int *err )
cret += c;
}
} else {
- if (c == '\\') {
+ if (c == (QChar)'\\') {
if (pos >= args.length())
goto quoteerr;
c = args.unicode()[pos++];
@@ -354,7 +354,7 @@ TQString KShell::joinArgsDQ( const TQStringList &args )
TQString KShell::tildeExpand( const TQString &fname )
{
- if (fname[0] == '~') {
+ if (fname[0] == (QChar)'~') {
int pos = fname.find( '/' );
if (pos < 0)
return homeDir( TQConstString( fname.unicode() + 1, fname.length() - 1 ).string() );