Index: RegExp.cpp
===================================================================
--- RegExp.cpp	(revision 12787)
+++ RegExp.cpp	(working copy)
@@ -1806,7 +1806,7 @@
 					jj = std::next(op)->symbol;
 					if(*str!=jj)
 					{
-						while(str<strend && cmp() && st.max--)
+						while(str<strend && cmp() && st.max-- > 0)
 						{
 							str++;
 							if(str[0]==jj)
@@ -1819,7 +1819,7 @@
 					jj = std::next(op)->symbol;
 					if(*str==jj)
 					{
-						while(str<strend && cmp() && st.max--)
+						while(str<strend && cmp() && st.max-- > 0)
 						{
 							str++;
 							if(str[0]!=jj)
@@ -1832,7 +1832,7 @@
 					jj = std::next(op)->symbol;
 					if(TOLOWER(*str)!=jj)
 					{
-						while(str<strend && cmp() && st.max--)
+						while(str<strend && cmp() && st.max-- > 0)
 						{
 							str++;
 							if(TOLOWER(str[0])==jj)
@@ -1845,7 +1845,7 @@
 					jj = std::next(op)->symbol;
 					if(TOLOWER(*str)==jj)
 					{
-						while(str<strend && cmp() && st.max--)
+						while(str<strend && cmp() && st.max-- > 0)
 						{
 							str++;
 							if(TOLOWER(str[0])!=jj)
@@ -1858,7 +1858,7 @@
 					jj = std::next(op)->type;
 					if(!isType(*str,jj))
 					{
-						while(str<strend && cmp() && st.max--)
+						while(str<strend && cmp() && st.max-- > 0)
 						{
 							str++;
 							if(isType(str[0],jj))
@@ -1871,7 +1871,7 @@
 					jj = std::next(op)->type;
 					if(isType(*str,jj))
 					{
-						while(str<strend && cmp() && st.max--)
+						while(str<strend && cmp() && st.max-- > 0)
 						{
 							str++;
 							if(!isType(str[0],jj))
@@ -1884,7 +1884,7 @@
 					cl = std::next(op)->symbolclass;
 					if(!cl->GetBit(*str))
 					{
-						while(str<strend && cmp() && st.max--)
+						while(str<strend && cmp() && st.max-- > 0)
 						{
 							str++;
 							if(cl->GetBit(str[0]))
@@ -2480,7 +2480,7 @@
 
 						if (!minimizing)
 						{
-							while (str<strend && *str!=0x0d && *str!=0x0a && st.max--)str++;
+							while (str<strend && *str!=0x0d && *str!=0x0a && st.max-- > 0)str++;
 						}
 						else
 						{
@@ -2555,7 +2555,7 @@
 
 						if (!minimizing)
 						{
-							while (str<strend && TOLOWER(*str)==op->range.symbol && st.max--)str++;
+							while (str<strend && TOLOWER(*str)==op->range.symbol && st.max-- > 0)str++;
 						}
 						else
 						{
@@ -2577,7 +2577,7 @@
 
 						if (!minimizing)
 						{
-							while (str<strend && *str==op->range.symbol && st.max--)str++;
+							while (str<strend && *str==op->range.symbol && st.max-- > 0)str++;
 						}
 						else
 						{
@@ -2616,7 +2616,7 @@
 
 						if (!minimizing)
 						{
-							while (str<strend && TOLOWER(*str)!=op->range.symbol && st.max--)str++;
+							while (str<strend && TOLOWER(*str)!=op->range.symbol && st.max-- > 0)str++;
 						}
 						else
 						{
@@ -2638,7 +2638,7 @@
 
 						if (!minimizing)
 						{
-							while (str<strend && *str!=op->range.symbol && st.max--)str++;
+							while (str<strend && *str!=op->range.symbol && st.max-- > 0)str++;
 						}
 						else
 						{
@@ -2675,7 +2675,7 @@
 
 					if (!minimizing)
 					{
-						while (str<strend && op->range.symbolclass->GetBit(*str) && st.max--)str++;
+						while (str<strend && op->range.symbolclass->GetBit(*str) && st.max-- > 0)str++;
 					}
 					else
 					{
@@ -2711,7 +2711,7 @@
 
 					if (!minimizing)
 					{
-						while (str<strend && isType(*str,op->range.type) && st.max--)str++;
+						while (str<strend && isType(*str,op->range.type) && st.max-- > 0)str++;
 					}
 					else
 					{
@@ -2747,7 +2747,7 @@
 
 					if (!minimizing)
 					{
-						while (str<strend && !isType(*str,op->range.type) && st.max--)str++;
+						while (str<strend && !isType(*str,op->range.type) && st.max-- > 0)str++;
 					}
 					else
 					{
@@ -2801,7 +2801,7 @@
 
 					if (!minimizing)
 					{
-						while (str<strend && StrCmp(str,start+m->start,start+m->end) && st.max--);
+						while (str<strend && StrCmp(str,start+m->start,start+m->end) && st.max-- > 0);
 					}
 					else
 					{
