mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
const'ify our strtod() helper functions
The C library doesn't use const char pointers for legacy reasons (and because you *can* modify the string the end pointer points to), but let's do it in our internal implementation just because it's a nice guarantee to have. We actually used to have a non-const end pointer and replace a decimal comma with a decimal dot, but that was because we didn't have the fancy "allow commas" flags. So by using our own strtod_flags() function, we can now keep all the strings we parse read-only rather than modify them as we parse them. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
19b982d3df
commit
2d1d78ebfe
4 changed files with 11 additions and 11 deletions
|
@ -464,9 +464,9 @@ void WeightModel::passInData(const QModelIndex& index, const QVariant& value)
|
|||
}
|
||||
}
|
||||
|
||||
weight_t string_to_weight(char *str)
|
||||
weight_t string_to_weight(const char *str)
|
||||
{
|
||||
char *end;
|
||||
const char *end;
|
||||
double value = strtod_flags(str, &end, 0);
|
||||
QString rest = QString(end).trimmed();
|
||||
QString local_kg = WeightModel::tr("kg");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue