diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2009-06-26 20:36:45 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2009-06-26 20:36:45 +0300 |
commit | cad62551c5fa9865dbe0841a0b3bc729c4fbe8fc (patch) | |
tree | 18c034dce54895c884ce480780b47f4ca3092f4b /src/xz/util.h | |
parent | Added missing source files to windows/Makefile. (diff) | |
download | xz-cad62551c5fa9865dbe0841a0b3bc729c4fbe8fc.tar.xz |
Ugly hack to make it possible to use the thousand separator
format character with snprintf() on POSIX systems but not
on non-POSIX systems and still keep xgettext working.
Diffstat (limited to '')
-rw-r--r-- | src/xz/util.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xz/util.h b/src/xz/util.h index 511d2ee9..3657eb80 100644 --- a/src/xz/util.h +++ b/src/xz/util.h @@ -41,6 +41,26 @@ extern uint64_t str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max); +/// \brief Convert uint64_t to a string +/// +/// Convert the given value to a string with locale-specific thousand +/// separators, if supported by the snprintf() implementation. The string +/// is stored into an internal static buffer indicated by the slot argument. +/// A pointer to the selected buffer is returned. +/// +/// This function exists, because non-POSIX systems don't support thousand +/// separator in format strings. Solving the problem in a simple way doesn't +/// work, because it breaks gettext (specifically, the xgettext tool). +extern const char *uint64_to_str(uint64_t value, uint32_t slot); + + +/// \brief Convert double to a string with one decimal place +/// +/// This is like uint64_to_str() except that this converts a double and +/// uses exactly one decimal place. +extern const char *double_to_str(double value); + + /// \brief Check if filename is empty and print an error message extern bool is_empty_filename(const char *filename); |