[PATCH] wordpad: add units (in/inch/pt)

Dylan Smith dylan.ah.smith at gmail.com
Thu May 6 13:26:02 CDT 2010


>-    /* FIXME: Allow other units and convert between them */
>     if(!lstrcmpA(endptr, units_cmA))
>+    {
>+        if (punit != NULL) *punit = UNIT_CM;
>+        endptr += 2;
>+    }
>+    else if (!lstrcmpA(endptr, units_inA))
>+    {
>+        if (punit != NULL) *punit = UNIT_INCH;
>+        endptr += 2;
>+    }
>+    else if (!lstrcmpA(endptr, units_inchA))
>+    {
>+        if (punit != NULL) *punit = UNIT_INCH;
>+        endptr += 4;
>+    }
>+    else if (!lstrcmpA(endptr, units_ptA))
>+    {
>+        if (punit != NULL) *punit = UNIT_PT;
>         endptr += 2;
>+    }
>
>     return *endptr == '\0';
> }

You should really use strlen(units_*A) instead of a constant for
incrementing endptr since these strings may be different lengths once
localized.  For instance I believe inch in French is "pouce" which is
5 characters so the null byte would truncate it to "pouc".

This should have already been done with "cm" units even though no
translation has made it different from 2 characters in length.



More information about the wine-devel mailing list