Re: [PATCH] wordpad: add units (in/inch/pt)
- /* 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.
participants (1)
-
Dylan Smith