a = d = 1;
b = c = 0;
e = f = 0;
- if (sscanf(s, "matrix (%f %f %f %f %f %f) %n",
- &a, &b, &c, &d, &e, &f, &n) == 6)
+ if ((sscanf(s, " matrix (%f %f %f %f %f %f ) %n",
+ &a, &b, &c, &d, &e, &f, &n) == 6) && (n > 0))
;
- else if (sscanf(s, "translate (%f %f) %n",
- &e, &f, &n) == 2)
+ else if ((sscanf(s, " translate (%f %f ) %n",
+ &e, &f, &n) == 2) && (n > 0))
;
- else if (sscanf(s, "translate (%f) %n",
- &e, &n) == 1)
+ else if ((sscanf(s, " translate (%f ) %n",
+ &e, &n) == 1) && (n > 0))
;
- else if (sscanf(s, "scale (%f %f) %n",
- &a, &d, &n) == 2)
+ else if ((sscanf(s, " scale (%f %f ) %n",
+ &a, &d, &n) == 2) && (n > 0))
;
- else if (sscanf(s, "scale (%f) %n",
- &a, &n) == 1)
+ else if ((sscanf(s, " scale (%f ) %n",
+ &a, &n) == 1) && (n > 0))
d = a;
- else if (sscanf(s, "rotate (%f %f %f) %n",
- &angle, &x, &y, &n) == 3) {
+ else if ((sscanf(s, " rotate (%f %f %f ) %n",
+ &angle, &x, &y, &n) == 3) && (n > 0)) {
angle = angle / 180 * M_PI;
a = cos(angle);
b = sin(angle);
d = cos(angle);
e = -x * cos(angle) + y * sin(angle) + x;
f = -x * sin(angle) - y * cos(angle) + y;
- } else if (sscanf(s, "rotate (%f) %n",
- &angle, &n) == 1) {
+ } else if ((sscanf(s, " rotate (%f ) %n",
+ &angle, &n) == 1) && (n > 0)) {
angle = angle / 180 * M_PI;
a = cos(angle);
b = sin(angle);
c = -sin(angle);
d = cos(angle);
- } else if (sscanf(s, "skewX (%f) %n",
- &angle, &n) == 1) {
+ } else if ((sscanf(s, " skewX (%f ) %n",
+ &angle, &n) == 1) && (n > 0)) {
angle = angle / 180 * M_PI;
c = tan(angle);
- } else if (sscanf(s, "skewY (%f) %n",
- &angle, &n) == 1) {
+ } else if ((sscanf(s, " skewY (%f ) %n",
+ &angle, &n) == 1) && (n > 0)) {
angle = angle / 180 * M_PI;
b = tan(angle);
} else