mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Merge pull request #10552 from obsidiansystems/tiny-cpp-style-cleanup
`file-descriptor.hh`: Avoid some C-isms for better C++-isms
This commit is contained in:
commit
731c389d32
1 changed files with 4 additions and 4 deletions
|
@ -17,13 +17,13 @@ struct Source;
|
||||||
/**
|
/**
|
||||||
* Operating System capability
|
* Operating System capability
|
||||||
*/
|
*/
|
||||||
typedef
|
using Descriptor =
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
HANDLE
|
HANDLE
|
||||||
#else
|
#else
|
||||||
int
|
int
|
||||||
#endif
|
#endif
|
||||||
Descriptor;
|
;
|
||||||
|
|
||||||
const Descriptor INVALID_DESCRIPTOR =
|
const Descriptor INVALID_DESCRIPTOR =
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
|
@ -41,7 +41,7 @@ const Descriptor INVALID_DESCRIPTOR =
|
||||||
static inline Descriptor toDescriptor(int fd)
|
static inline Descriptor toDescriptor(int fd)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return (HANDLE) _get_osfhandle(fd);
|
return reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
||||||
#else
|
#else
|
||||||
return fd;
|
return fd;
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,7 +56,7 @@ static inline Descriptor toDescriptor(int fd)
|
||||||
static inline int fromDescriptorReadOnly(Descriptor fd)
|
static inline int fromDescriptorReadOnly(Descriptor fd)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return _open_osfhandle((intptr_t) fd, _O_RDONLY);
|
return _open_osfhandle(reinterpret_cast<intptr_t>(fd), _O_RDONLY);
|
||||||
#else
|
#else
|
||||||
return fd;
|
return fd;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue