- spurious "no hard-coded metrics" warnings on labels with empty lines #2179
- fixed corruption of user shape characteristics during EPSF initialization
- output formats canon, dot, and xdot are not completely faithful to input #2184
+- gvpr index function produces wrong results #2211. This was a regression in
+ Graphviz 2.47.0.
## [3.0.0] – 2022-02-26
*/
int indexOf(char *s1, char *s2)
{
- char *s = strstr(s1, s2);
- return s == NULL ? -1 : (int)(s1 - s);
+ char c1 = *s2;
+ char c;
+ char *p;
+ int len2;
+
+ if (c1 == '\0')
+ return 0;
+ p = s1;
+ len2 = strlen(s2) - 1;
+ while ((c = *p++)) {
+ if (c != c1)
+ continue;
+ if (strncmp(p, s2 + 1, len2) == 0)
+ return ((p - s1) - 1);
+ }
+ return -1;
}
/* rindexOf:
assert canonical == new, "canonical translation is not stable"
@pytest.mark.skipif(shutil.which("gvpr") is None, reason="GVPR not available")
-@pytest.mark.xfail(strict=True)
def test_2211():
"""
GVPR’s `index` function should return correct results