fix bug #319897, problem with counted atoms when the transition itself is

* xmlregexp.c: fix bug #319897, problem with counted atoms
  when the transition itself is counted too
* result/regexp/hard test/regexp/hard: augmented the regression
  tests with the problem exposed.
Daniel
diff --git a/ChangeLog b/ChangeLog
index 82207fa..ef32813 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Nov  1 16:22:29 CET 2005 Daniel Veillard <daniel@veillard.com>
+
+	* xmlregexp.c: fix bug #319897, problem with counted atoms
+	  when the transition itself is counted too
+	* result/regexp/hard test/regexp/hard: augmented the regression
+	  tests with the problem exposed.
+
 Tue Nov  1 11:54:39 CET 2005 Daniel Veillard <daniel@veillard.com>
 
 	* win32/Makefile.mingw include/win32config.h: applied patch from
diff --git a/result/regexp/hard b/result/regexp/hard
index f348c08..28d6164 100644
--- a/result/regexp/hard
+++ b/result/regexp/hard
@@ -5,3 +5,8 @@
 a0b: Ok
 aa0aaa: Fail
 b0aaa: Ok
+Regexp: (\d{1,3}\.){3}\d{1,3}
+1.2.3.4: Ok
+1.22.333.44: Ok
+1.2.3: Fail
+1..2.3: Fail
diff --git a/test/regexp/hard b/test/regexp/hard
index 40c6d2d..ddb4cfd 100644
--- a/test/regexp/hard
+++ b/test/regexp/hard
@@ -5,3 +5,8 @@
 a0b
 aa0aaa
 b0aaa
+=>(\d{1,3}\.){3}\d{1,3}
+1.2.3.4
+1.22.333.44
+1.2.3
+1..2.3
diff --git a/xmlregexp.c b/xmlregexp.c
index fe02822..fce1f1d 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -2812,7 +2812,15 @@
 
 		    /*
 		     * this is a multiple input sequence
+		     * If there is a counter associated increment it now.
+		     * before potentially saving and rollback
 		     */
+		    if (trans->counter >= 0) {
+#ifdef DEBUG_REGEXP_EXEC
+			printf("Increasing count %d\n", trans->counter);
+#endif
+			exec->counts[trans->counter]++;
+		    }
 		    if (exec->state->nbTrans > exec->transno + 1) {
 			xmlFARegExecSave(exec);
 		    }
@@ -2862,6 +2870,12 @@
 		    if (ret == 0) {
 			goto rollback;
 		    }
+		    if (trans->counter >= 0) {
+#ifdef DEBUG_REGEXP_EXEC
+			printf("Decreasing count %d\n", trans->counter);
+#endif
+			exec->counts[trans->counter]--;
+		    }
 		} else if ((ret == 0) && (atom->min == 0) && (atom->max > 0)) {
 		    /*
 		     * we don't match on the codepoint, but minOccurs of 0