[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Wed May 7 19:21:35 CEST 2003
CVS commit by staikos:
- Don't allow access to array[-1].
- Make the for(;;); a little more explicit
M +12 -7 kstequationcurve.cpp 1.7
--- kdeextragear-2/kst/kst/kstequationcurve.cpp #1.6:1.7
@@ -456,8 +456,8 @@ void KstEquationCurve::preProcess() {
i+=2;
} else if (TempString[i]=='-' &&
- (TempString[i-1]=='*' || TempString[i-1]=='/' ||
- TempString[i-1]=='+' || TempString[i-1]=='-' ||
- TempString[i-1]=='(' || TempString[i-1]=='E' ||
- TempString[i-1]=='^')|| TempString[i-1]=='e') {
+ (TempString[Prev]=='*' || TempString[Prev]=='/' ||
+ TempString[Prev]=='+' || TempString[Prev]=='-' ||
+ TempString[Prev]=='(' || TempString[Prev]=='E' ||
+ TempString[Prev]=='^')|| TempString[Prev]=='e') {
String[j++]='!';
i++;
@@ -465,6 +465,10 @@ void KstEquationCurve::preProcess() {
i++;
} else if (TempString[i]=='[') {
- for (i_t = i; (TempString[i_t]!='\0') && (TempString[i_t]!=']'); i_t++);
- if (i_t - i - 1>98) i_t = i + 98;
+ for (i_t = i; (TempString[i_t]!='\0') && (TempString[i_t]!=']'); i_t++)
+ ;
+
+ if (i_t - i - 1>98)
+ i_t = i + 98;
+
strncpy(ts,TempString+i+1, i_t - i - 1);
ts[i_t-i-1] = '\0';
@@ -579,5 +583,6 @@ bool KstEquationCurve::FillRPNQ() {
}
}
- if (IsBinop(&String[i-1])!=0 || IsMonop(&String[i-1])!=0) Error=true;
+ if (IsBinop(&String[i-1])!=0 || IsMonop(&String[i-1])!=0)
+ Error=true;
for(opstack.cPeek(Tmp);Tmp[0]!='#';opstack.cPeek(Tmp)) {
if (Tmp[0]=='(') Error=true;
More information about the Kst
mailing list