build: windows fixes

This commit is contained in:
Danny Robson 2015-07-23 13:53:48 +10:00
parent f4738fc010
commit b6ce75aca6
5 changed files with 16 additions and 16 deletions

2
io.hpp
View File

@ -68,7 +68,7 @@ namespace util {
operator HANDLE (void) const;
HANDLE handle;
HANDLE fd;
};
#endif

View File

@ -128,29 +128,29 @@ mapped_file::cend (void) const
//-----------------------------------------------------------------------------
util::handle_ref::handle_ref ():
handle (INVALID_HANDLE_VALUE)
util::handle::handle():
fd (INVALID_HANDLE_VALUE)
{ ; }
util::handle_ref::~handle_ref ()
util::handle::~handle ()
{
reset (INVALID_HANDLE_VALUE);
}
void
util::handle_ref::reset (HANDLE _handle)
util::handle::reset (HANDLE _handle)
{
if (handle != INVALID_HANDLE_VALUE)
if (!CloseHandle (handle))
if (fd != INVALID_HANDLE_VALUE)
if (!CloseHandle (fd))
win32_error::throw_code ();
handle = _handle;
fd = _handle;
}
util::handle_ref::operator HANDLE (void) const
util::handle::operator HANDLE (void) const
{
return handle;
return fd;
}

View File

@ -44,8 +44,8 @@ namespace util {
const uint8_t* cend (void) const;
private:
handle_ref m_file;
handle_ref m_mapping;
handle m_file;
handle m_mapping;
std::unique_ptr<uint8_t,BOOL(*)(LPCVOID)> m_data;
size_t m_size;

View File

@ -97,7 +97,7 @@ void
util::pgm::write (const util::image::buffer<uint8_t> &src,
const boost::filesystem::path &path)
{
std::ofstream dst (path.c_str ());
std::ofstream dst (path.string ());
write (src.begin (), src.w, src.h, src.s, path);
}
@ -110,7 +110,7 @@ util::pgm::write (const uint8_t *restrict pixels,
size_t stride,
const boost::filesystem::path &path)
{
std::ofstream dst (path.c_str ());
std::ofstream dst (path.string ());
write (pixels, width, height, stride, dst);
}
@ -137,7 +137,7 @@ util::ppm::write (const uint8_t *restrict pixels,
size_t stride,
const boost::filesystem::path &path)
{
std::ofstream dst (path.c_str ());
std::ofstream dst (path.string ());
write (pixels, width, height, stride, dst);
}

View File

@ -181,7 +181,7 @@ main (int argc, char **argv)
#endif
#ifndef ENABLE_DEBUGGING
#if !defined(ENABLE_DEBUGGING) and !defined(PLATFORM_WIN32)
if (isatty (fileno (stdout))) {
std::cerr << "cowardly refusing to dump binary data to console\n";
return EXIT_FAILURE;