@@ -2338,21 +2338,28 @@ return -NAN; #if defined(HAVE_STRTOF_L) || defined(HAVE_USELOCALE) const char *UTF8String = self.UTF8String; #else - /* - * If we have no strtof_l, we have no other choice than to replace the - * locale's decimal point with something that will be rejected and - * replacing "." with the locale's decimal point. - */ OFString *decimalSeparator = [OFLocale decimalSeparator]; - const char *UTF8String = [[self - stringByReplacingOccurrencesOfString: decimalSeparator - withString: @"!"] - stringByReplacingOccurrencesOfString: @"." - withString: decimalSeparator].UTF8String; + const char *UTF8String; + + if ([decimalSeparator isEqual: @"."]) + UTF8String = self.UTF8String; + else + /* + * If we have no strtof_l, we have no other choice than to + * replace the locale's decimal point with something that will + * be rejected and replacing "." with the locale's decimal + * point. + */ + UTF8String = [[self + stringByReplacingOccurrencesOfString: decimalSeparator + withString: @"!"] + stringByReplacingOccurrencesOfString: @"." + withString: decimalSeparator] + .UTF8String; #endif char *endPtr = NULL; float value; errno = 0; @@ -2398,21 +2405,28 @@ return -NAN; #if defined(HAVE_STRTOD_L) || defined(HAVE_USELOCALE) const char *UTF8String = self.UTF8String; #else - /* - * If we have no strtod_l, we have no other choice than to replace the - * locale's decimal point with something that will be rejected and - * replacing "." with the locale's decimal point. - */ OFString *decimalSeparator = [OFLocale decimalSeparator]; - const char *UTF8String = [[self - stringByReplacingOccurrencesOfString: decimalSeparator - withString: @"!"] - stringByReplacingOccurrencesOfString: @"." - withString: decimalSeparator].UTF8String; + const char *UTF8String; + + if ([decimalSeparator isEqual: @"."]) + UTF8String = self.UTF8String; + else + /* + * If we have no strtod_l, we have no other choice than to + * replace the locale's decimal point with something that will + * be rejected and replacing "." with the locale's decimal + * point. + */ + UTF8String = [[self + stringByReplacingOccurrencesOfString: decimalSeparator + withString: @"!"] + stringByReplacingOccurrencesOfString: @"." + withString: decimalSeparator] + .UTF8String; #endif char *endPtr = NULL; double value; errno = 0;