From 844ef6d60dac6c31759a7dbc87d0cee2bc281c6a Mon Sep 17 00:00:00 2001 From: Shuo Chen Date: Wed, 24 Oct 2018 03:20:41 +0000 Subject: [PATCH] Fix warnings on 32-bit platforms. --- examples/procmon/procmon.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/procmon/procmon.cc b/examples/procmon/procmon.cc index fc96c594e..efacf88c0 100644 --- a/examples/procmon/procmon.cc +++ b/examples/procmon/procmon.cc @@ -19,6 +19,8 @@ #include #include #include +#define __STDC_FORMAT_MACROS +#include using namespace muduo; using namespace muduo::net; @@ -320,7 +322,8 @@ class Procmon : boost::noncopyable if (::lstat(namelist[i]->d_name, &stat) == 0) { Timestamp mtime(stat.st_mtime * Timestamp::kMicroSecondsPerSecond); - appendResponse("%c %9ld %s %s", getDirType(namelist[i]->d_type), stat.st_size, + int64_t size = stat.st_size; + appendResponse("%c %9" PRId64 " %s %s", getDirType(namelist[i]->d_type), size, mtime.toFormattedString(/*showMicroseconds=*/false).c_str(), namelist[i]->d_name); if (namelist[i]->d_type == DT_LNK)