update io.files.*.windows to use specialized arrays; also, io.files.info.windows was providing buffers that were too small, so fix that

db4
Joe Groff 2009-08-31 09:58:04 -05:00
parent 72bb3e144f
commit c1fe3854d4
2 changed files with 9 additions and 8 deletions

View File

@ -5,7 +5,8 @@ io.files.windows io.files.windows.nt kernel windows.kernel32
windows.time windows accessors alien.c-types combinators
generalizations system alien.strings io.encodings.utf16n
sequences splitting windows.errors fry continuations destructors
calendar ascii combinators.short-circuit locals classes.struct ;
calendar ascii combinators.short-circuit locals classes.struct
specialized-arrays.ushort ;
IN: io.files.info.windows
:: round-up-to ( n multiple -- n' )
@ -100,11 +101,11 @@ M: windows link-info ( path -- info )
file-info ;
: volume-information ( normalized-path -- volume-name volume-serial max-component flags type )
MAX_PATH 1 + [ <byte-array> ] keep
MAX_PATH 1 + [ <ushort-array> ] keep
"DWORD" <c-object>
"DWORD" <c-object>
"DWORD" <c-object>
MAX_PATH 1 + [ <byte-array> ] keep
MAX_PATH 1 + [ <ushort-array> ] keep
[ GetVolumeInformation win32-error=0/f ] 7 nkeep
drop 5 nrot drop
[ utf16n alien>string ] 4 ndip
@ -147,7 +148,7 @@ M: winnt file-system-info ( path -- file-system-info )
calculate-file-system-info ;
: volume>paths ( string -- array )
16384 "ushort" <c-array> tuck dup length
16384 <ushort-array> tuck dup length
0 <uint> dup [ GetVolumePathNamesForVolumeName 0 = ] dip swap [
win32-error-string throw
] [
@ -156,13 +157,13 @@ M: winnt file-system-info ( path -- file-system-info )
] if ;
: find-first-volume ( -- string handle )
MAX_PATH 1 + [ <byte-array> ] keep
MAX_PATH 1 + [ <ushort-array> ] keep
dupd
FindFirstVolume dup win32-error=0/f
[ utf16n alien>string ] dip ;
: find-next-volume ( handle -- string/f )
MAX_PATH 1 + [ <byte-array> tuck ] keep
MAX_PATH 1 + [ <ushort-array> tuck ] keep
FindNextVolume 0 = [
GetLastError ERROR_NO_MORE_FILES =
[ drop f ] [ win32-error-string throw ] if

View File

@ -5,11 +5,11 @@ windows.kernel32 kernel libc math threads system environment
alien.c-types alien.arrays alien.strings sequences combinators
combinators.short-circuit ascii splitting alien strings assocs
namespaces make accessors tr windows.time windows.shell32
windows.errors ;
windows.errors specialized-arrays.ushort ;
IN: io.files.windows.nt
M: winnt cwd
MAX_UNICODE_PATH dup "ushort" <c-array>
MAX_UNICODE_PATH dup <ushort-array>
[ GetCurrentDirectory win32-error=0/f ] keep
utf16n alien>string ;