use stding

This commit is contained in:
Jean-Francois Dockes 2017-02-28 08:27:04 +01:00
parent d08f05888d
commit 49ad782f7c
2 changed files with 12 additions and 11 deletions

View File

@ -670,7 +670,7 @@ bool pcSubst(const string& in, string& out, const map<string, string>& subs)
} }
return true; return true;
} }
inline static int ulltorbuf(unsigned long long val, char *rbuf) inline static int ulltorbuf(uint64_t val, char *rbuf)
{ {
int idx; int idx;
for (idx = 0; val; idx++) { for (idx = 0; val; idx++) {
@ -690,7 +690,7 @@ inline static void ullcopyreverse(const char *rbuf, string& buf, int idx)
} }
} }
void ulltodecstr(unsigned long long val, string& buf) void ulltodecstr(uint64_t val, string& buf)
{ {
buf.clear(); buf.clear();
if (val == 0) { if (val == 0) {
@ -705,7 +705,7 @@ void ulltodecstr(unsigned long long val, string& buf)
return; return;
} }
void lltodecstr(long long val, string& buf) void lltodecstr(int64_t val, string& buf)
{ {
buf.clear(); buf.clear();
if (val == 0) { if (val == 0) {
@ -730,14 +730,14 @@ void lltodecstr(long long val, string& buf)
return; return;
} }
string lltodecstr(long long val) string lltodecstr(int64_t val)
{ {
string buf; string buf;
lltodecstr(val, buf); lltodecstr(val, buf);
return buf; return buf;
} }
string ulltodecstr(unsigned long long val) string ulltodecstr(uint64_t val)
{ {
string buf; string buf;
ulltodecstr(val, buf); ulltodecstr(val, buf);
@ -745,7 +745,7 @@ string ulltodecstr(unsigned long long val)
} }
// Convert byte count into unit (KB/MB...) appropriate for display // Convert byte count into unit (KB/MB...) appropriate for display
string displayableBytes(off_t size) string displayableBytes(int64_t size)
{ {
const char *unit; const char *unit;

View File

@ -19,6 +19,7 @@
#define _SMALLUT_H_INCLUDED_ #define _SMALLUT_H_INCLUDED_
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h>
#include <string> #include <string>
#include <vector> #include <vector>
@ -162,13 +163,13 @@ extern std::string escapeShell(const std::string& str);
extern std::string truncate_to_word(const std::string& input, extern std::string truncate_to_word(const std::string& input,
std::string::size_type maxlen); std::string::size_type maxlen);
void ulltodecstr(unsigned long long val, std::string& buf); void ulltodecstr(uint64_t val, std::string& buf);
void lltodecstr(long long val, std::string& buf); void lltodecstr(int64_t val, std::string& buf);
std::string lltodecstr(long long val); std::string lltodecstr(int64_t val);
std::string ulltodecstr(unsigned long long val); std::string ulltodecstr(uint64_t val);
/** Convert byte count into unit (KB/MB...) appropriate for display */ /** Convert byte count into unit (KB/MB...) appropriate for display */
std::string displayableBytes(off_t size); std::string displayableBytes(int64_t size);
/** Break big string into lines */ /** Break big string into lines */
std::string breakIntoLines(const std::string& in, unsigned int ll = 100, std::string breakIntoLines(const std::string& in, unsigned int ll = 100,