June 23, 2009 CloseHandle missing in phobos/std/file.dtrunk/phobos/std/file.d read? | ||||
---|---|---|---|---|
| ||||
version(Windows) void[] read(in char[] name) 140 { 141 alias TypeTuple!(GENERIC_READ, 142 FILE_SHARE_READ, (SECURITY_ATTRIBUTES*).init, OPEN_EXISTING, 143 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 144 HANDLE.init) 145 defaults; 146 auto h = useWfuncs 147 ? CreateFileW(std.utf.toUTF16z(name), defaults) 148 : CreateFileA(toMBSz(name), defaults); 149 150 cenforce(h != INVALID_HANDLE_VALUE, name); 151 scope(exit) cenforce(CloseHandle(h), name); 152 const size = GetFileSize(h, null); 153 cenforce(size != INVALID_FILE_SIZE, name); 154 auto buf = GC.malloc(size, GC.BlkAttr.NO_SCAN)[0 .. size]; 155 scope(failure) delete buf; 156 157 DWORD numread; 158 cenforce(ReadFile(h,buf.ptr, size, &numread, null) == 1 159 && numread == size, name); 160 return buf[0 .. size]; CloseHandle missing here? 161 } |
June 23, 2009 Re: CloseHandle missing in phobos/std/file.dtrunk/phobos/std/file.d read? | ||||
---|---|---|---|---|
| ||||
Posted in reply to dennis luehring | On 23.06.2009 13:49, dennis luehring wrote:
> 151 scope(exit) cenforce(CloseHandle(h), name);
sorry missed that line
|
Copyright © 1999-2021 by the D Language Foundation