mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
parent
7920b57d34
commit
3789a75ed6
@ -276,10 +276,10 @@ namespace Genode {
|
||||
* characters in front of the number. If the number is prefixed with "0x",
|
||||
* a base of 16 is used, otherwise a base of 10.
|
||||
*/
|
||||
inline size_t ascii_to_unsigned_long(const char *s, unsigned long &result,
|
||||
unsigned base)
|
||||
template <typename T>
|
||||
inline size_t ascii_to_unsigned(const char *s, T &result, unsigned base)
|
||||
{
|
||||
unsigned long i = 0, value = 0;
|
||||
T i = 0, value = 0;
|
||||
|
||||
if (!*s) return i;
|
||||
|
||||
@ -334,10 +334,22 @@ namespace Genode {
|
||||
*/
|
||||
inline size_t ascii_to(const char *s, unsigned long &result)
|
||||
{
|
||||
return ascii_to_unsigned_long(s, result, 0);
|
||||
return ascii_to_unsigned(s, result, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read unsigned long long value from string
|
||||
*
|
||||
* \return number of consumed characters
|
||||
*/
|
||||
inline size_t ascii_to(const char *s, unsigned long long &result)
|
||||
{
|
||||
return ascii_to_unsigned(s, result, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Read unsigned int value from string
|
||||
*
|
||||
@ -345,10 +357,7 @@ namespace Genode {
|
||||
*/
|
||||
inline size_t ascii_to(const char *s, unsigned int &result)
|
||||
{
|
||||
unsigned long result_long = 0;
|
||||
size_t ret = ascii_to_unsigned_long(s, result_long, 0);
|
||||
result = result_long;
|
||||
return ret;
|
||||
return ascii_to_unsigned(s, result, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -369,7 +378,7 @@ namespace Genode {
|
||||
int j = 0;
|
||||
unsigned long value = 0;
|
||||
|
||||
j = ascii_to_unsigned_long(s, value, 10);
|
||||
j = ascii_to_unsigned(s, value, 10);
|
||||
|
||||
if (!j) return i;
|
||||
|
||||
@ -391,7 +400,7 @@ namespace Genode {
|
||||
unsigned long res = 0;
|
||||
|
||||
/* convert numeric part of string */
|
||||
int i = ascii_to_unsigned_long(s, res, 0);
|
||||
int i = ascii_to_unsigned(s, res, 0);
|
||||
|
||||
/* handle suffixes */
|
||||
if (i > 0)
|
||||
|
@ -1034,7 +1034,7 @@ int dev_set_name(struct device *dev, const char *fmt, ...)
|
||||
int strict_strtoul(const char *s, unsigned int base, unsigned long *res)
|
||||
{
|
||||
unsigned long r = -EINVAL;
|
||||
Genode::ascii_to_unsigned_long(s, r, base);
|
||||
Genode::ascii_to_unsigned(s, r, base);
|
||||
*res = r;
|
||||
|
||||
return r;
|
||||
|
@ -69,7 +69,7 @@ class Vfs::Tar_file_system : public File_system
|
||||
strncpy(buf, field, sizeof(buf));
|
||||
|
||||
unsigned long value = 0;
|
||||
Genode::ascii_to_unsigned_long(buf, value, 8);
|
||||
Genode::ascii_to_unsigned(buf, value, 8);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace File_system {
|
||||
strncpy(buf, field, sizeof(buf));
|
||||
|
||||
unsigned long value = 0;
|
||||
ascii_to_unsigned_long(buf, value, 8);
|
||||
ascii_to_unsigned(buf, value, 8);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,8 @@ class Rom_session_component : public Genode::Rpc_object<Genode::Rom_session>
|
||||
while (block_id < block_cnt) {
|
||||
|
||||
unsigned long file_size = 0;
|
||||
Genode::ascii_to_unsigned_long(_tar_addr + block_id*_BLOCK_LEN + _FIELD_SIZE_LEN,
|
||||
file_size, 8);
|
||||
Genode::ascii_to_unsigned(_tar_addr + block_id*_BLOCK_LEN +
|
||||
_FIELD_SIZE_LEN, file_size, 8);
|
||||
|
||||
/* get name of tar record */
|
||||
char const *record_filename = _tar_addr + block_id*_BLOCK_LEN;
|
||||
|
Loading…
x
Reference in New Issue
Block a user