Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor clang-tidy warnings #1290

Merged
merged 1 commit into from
Aug 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ FMT_API bool grisu_format(Double value, buffer<char>& buf, int precision,
buf.push_back('0');
} else {
exp = -precision;
buf.resize(precision);
buf.resize(to_unsigned(precision));
std::uninitialized_fill_n(buf.data(), precision, '0');
}
return true;
Expand Down
8 changes: 4 additions & 4 deletions src/posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "fmt/posix.h"

#include <limits.h>
#include <climits>
#include <sys/stat.h>
#include <sys/types.h>

Expand Down Expand Up @@ -49,7 +49,7 @@
namespace {
#ifdef _WIN32
// Return type of read and write functions.
typedef int RWResult;
using RWResult = int;

// On Windows the count argument to read and write is unsigned, so convert
// it from size_t preventing integer overflow.
Expand All @@ -58,7 +58,7 @@ inline unsigned convert_rwcount(std::size_t count) {
}
#else
// Return type of read and write functions.
typedef ssize_t RWResult;
using RWResult = ssize_t;

inline std::size_t convert_rwcount(std::size_t count) { return count; }
#endif
Expand Down Expand Up @@ -138,7 +138,7 @@ long long file::size() const {
unsigned long long long_size = size_upper;
return (long_size << sizeof(DWORD) * CHAR_BIT) | size_lower;
#else
typedef struct stat Stat;
using Stat = struct stat;
Stat file_stat = Stat();
if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1)
FMT_THROW(system_error(errno, "cannot get file attributes"));
Expand Down