@@ -270,23 +270,23 @@ Convert a Win32 system call error code to a descriptive string [only available o
270
270
function FormatMessage end
271
271
272
272
if is_windows ()
273
- GetLastError () = ccall (:GetLastError ,stdcall,UInt32,())
273
+ GetLastError () = ccall (:GetLastError , stdcall, UInt32, ())
274
274
275
275
function FormatMessage (e= GetLastError ())
276
276
const FORMAT_MESSAGE_ALLOCATE_BUFFER = UInt32 (0x100 )
277
277
const FORMAT_MESSAGE_FROM_SYSTEM = UInt32 (0x1000 )
278
278
const FORMAT_MESSAGE_IGNORE_INSERTS = UInt32 (0x200 )
279
279
const FORMAT_MESSAGE_MAX_WIDTH_MASK = UInt32 (0xFF )
280
- lpMsgBuf = Array {Ptr{UInt16},0 } ()
281
- lpMsgBuf[1 ] = 0
282
- len = ccall (:FormatMessageW ,stdcall,UInt32,(Cint, Ptr{Void}, Cint, Cint, Ptr{Ptr{UInt16}}, Cint, Ptr{Void}),
280
+ lpMsgBuf = Ref {Ptr{UInt16}} ()
281
+ lpMsgBuf[] = 0
282
+ len = ccall (:FormatMessageW , stdcall, UInt32, (Cint, Ptr{Void}, Cint, Cint, Ptr{Ptr{UInt16}}, Cint, Ptr{Void}),
283
283
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
284
284
C_NULL , e, 0 , lpMsgBuf, 0 , C_NULL )
285
- p = lpMsgBuf[1 ]
285
+ p = lpMsgBuf[]
286
286
len == 0 && return " "
287
287
buf = Array {UInt16} (len)
288
288
unsafe_copy! (pointer (buf), p, len)
289
- ccall (:LocalFree ,stdcall,Ptr{Void},(Ptr{Void},),p)
289
+ ccall (:LocalFree , stdcall, Ptr{Void}, (Ptr{Void},), p)
290
290
return transcode (String, buf)
291
291
end
292
292
end
0 commit comments