X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fwindows%2Fhandle.cpp;h=1cdf8ce208ed881d0d5510bc0efb3a93122640ca;hp=2dac33fa2b531dc88db375bea661f5b991aa6a15;hb=c8bf2d6c15893ccc9dbc4e04611b7229029f4808;hpb=0f5709b1262b17505c5bab06951611968a4bd326 diff --git a/source/io/windows/handle.cpp b/source/io/windows/handle.cpp index 2dac33f..1cdf8ce 100644 --- a/source/io/windows/handle.cpp +++ b/source/io/windows/handle.cpp @@ -1,7 +1,11 @@ +#define NOMINMAX +#include #include #include "handle.h" #include "handle_private.h" +using namespace std; + namespace Msp { namespace IO { @@ -9,8 +13,15 @@ void sys_set_blocking(Handle &, bool) { } -unsigned sys_read(Handle &handle, char *buf, unsigned size) +void sys_set_inherit(Handle &, bool) +{ +} + +size_t sys_read(Handle &handle, char *buf, size_t size) { + if(size>numeric_limits::max()) + throw invalid_argument("read"); + DWORD ret; if(ReadFile(*handle, buf, size, &ret, 0)==0) throw system_error("ReadFile"); @@ -18,8 +29,11 @@ unsigned sys_read(Handle &handle, char *buf, unsigned size) return ret; } -unsigned sys_write(Handle &handle, const char *buf, unsigned size) +size_t sys_write(Handle &handle, const char *buf, size_t size) { + if(size>numeric_limits::max()) + throw invalid_argument("write"); + DWORD ret; if(WriteFile(*handle, buf, size, &ret, 0)==0) throw system_error("WriteFile");