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 int -> uint warning #2611

Merged
merged 5 commits into from
Dec 1, 2021
Merged
Changes from 3 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
11 changes: 10 additions & 1 deletion src/os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

# ifndef _WIN32
# include <unistd.h>
# ifndef mode_t
# define mode_t unsigned short
# endif
Acretock marked this conversation as resolved.
Show resolved Hide resolved
# else
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
Expand All @@ -41,6 +44,9 @@
# ifndef S_IROTH
# define S_IROTH 0
# endif
# ifndef mode_t
# define mode_t int
# endif
vitaut marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For win32:

#ifndef __MINGW32__
using mode_t = int;
#endif


Acretock marked this conversation as resolved.
Show resolved Hide resolved
# ifdef __MINGW32__
# define _SH_DENYNO 0x40
Expand Down Expand Up @@ -218,7 +224,7 @@ int buffered_file::fileno() const {

#if FMT_USE_FCNTL
file::file(cstring_view path, int oflag) {
int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
# if defined(_WIN32) && !defined(__MINGW32__)
fd_ = -1;
FMT_POSIX_CALL(sopen_s(&fd_, path.c_str(), oflag, _SH_DENYNO, mode));
Expand Down Expand Up @@ -361,5 +367,8 @@ long getpagesize() {
FMT_API void ostream::grow(size_t) {
if (this->size() == this->capacity()) flush();
}
# ifdef mode_t
# undef mode_t
# endif
Acretock marked this conversation as resolved.
Show resolved Hide resolved
#endif // FMT_USE_FCNTL
FMT_END_NAMESPACE