--- a/src/smallut.cpp
+++ b/src/smallut.cpp
@@ -454,17 +454,26 @@
 
 void trimstring(string& s, const char *ws)
 {
+    rtrimstring(s, ws);
+    ltrimstring(s, ws);
+}
+
+void rtrimstring(string& s, const char *ws)
+{
+    string::size_type pos = s.find_last_not_of(ws);
+    if (pos != string::npos && pos != s.length() - 1) {
+        s.replace(pos + 1, string::npos, string());
+    }
+}
+
+void ltrimstring(string& s, const char *ws)
+{
     string::size_type pos = s.find_first_not_of(ws);
     if (pos == string::npos) {
         s.clear();
         return;
     }
     s.replace(0, pos, string());
-
-    pos = s.find_last_not_of(ws);
-    if (pos != string::npos && pos != s.length() - 1) {
-        s.replace(pos + 1, string::npos, string());
-    }
 }
 
 // Remove some chars and replace them with spaces
@@ -670,7 +679,7 @@
     }
     return true;
 }
-inline static int ulltorbuf(unsigned long long val, char *rbuf)
+inline static int ulltorbuf(uint64_t val, char *rbuf)
 {
     int idx;
     for (idx = 0; val; idx++) {
@@ -690,7 +699,7 @@
     }
 }
 
-void ulltodecstr(unsigned long long val, string& buf)
+void ulltodecstr(uint64_t val, string& buf)
 {
     buf.clear();
     if (val == 0) {
@@ -705,7 +714,7 @@
     return;
 }
 
-void lltodecstr(long long val, string& buf)
+void lltodecstr(int64_t val, string& buf)
 {
     buf.clear();
     if (val == 0) {
@@ -730,14 +739,14 @@
     return;
 }
 
-string lltodecstr(long long val)
+string lltodecstr(int64_t val)
 {
     string buf;
     lltodecstr(val, buf);
     return buf;
 }
 
-string ulltodecstr(unsigned long long val)
+string ulltodecstr(uint64_t val)
 {
     string buf;
     ulltodecstr(val, buf);
@@ -745,7 +754,7 @@
 }
 
 // Convert byte count into unit (KB/MB...) appropriate for display
-string displayableBytes(off_t size)
+string displayableBytes(int64_t size)
 {
     const char *unit;