@@ -277,7 +277,7 @@ async function rename(oldpath, newpath) {
277277// Extract the FsStat object from the encoded buffer.
278278// See `runtime/ops/fs.rs` for the encoder.
279279//
280- // This is not a general purpose decoder. There are 5 types:
280+ // This is not a general purpose decoder. There are 4 types:
281281//
282282// 1. date
283283// offset += 4
@@ -294,14 +294,6 @@ async function rename(oldpath, newpath) {
294294//
295295// 4. ?u64 converts a zero u64 value to JS null on Windows.
296296// ?bool converts a false bool value to JS null on Windows.
297- //
298- // 5. !u64 persists the u64 value even if it's zero,
299- // only if the corresponding "_set" field is set to true.
300- // Unlike ?u64, this is OS agnostic.
301- // offset += 4
302- // 1/0 | extra padding | high u32 | low u32
303- // if value[0] == 1, u64 else null
304- //
305297function createByteStruct ( types ) {
306298 // types can be "date", "bool" or "u64".
307299 let offset = 0 ;
@@ -311,32 +303,26 @@ function createByteStruct(types) {
311303 for ( let i = 0 ; i < typeEntries . length ; ++ i ) {
312304 let { 0 : name , 1 : type } = typeEntries [ i ] ;
313305
314- const optionalLoose = StringPrototypeStartsWith ( type , "?" ) ;
315- const optionalStrict = StringPrototypeStartsWith ( type , "!" ) ;
316- if ( optionalLoose || optionalStrict ) type = StringPrototypeSlice ( type , 1 ) ;
306+ const optional = StringPrototypeStartsWith ( type , "?" ) ;
307+ if ( optional ) type = StringPrototypeSlice ( type , 1 ) ;
317308
318309 if ( type == "u64" ) {
319- if ( ! optionalLoose && ! optionalStrict ) {
310+ if ( ! optional ) {
320311 str += `${ name } : view[${ offset } ] + view[${ offset + 1 } ] * 2**32,` ;
321- } else if ( optionalLoose ) {
312+ } else {
322313 str += `${ name } : (unix ? (view[${ offset } ] + view[${
323314 offset + 1
324315 } ] * 2**32) : (view[${ offset } ] + view[${
325316 offset + 1
326317 } ] * 2**32) || null),`;
327- } else {
328- str += `${ name } : (view[${ offset } ] === 1 ? (view[${ offset + 2 } ] + view[${
329- offset + 3
330- } ] * 2**32) : null),`;
331- offset += 2 ;
332318 }
333319 } else if ( type == "date" ) {
334320 str += `${ name } : view[${ offset } ] === 0 ? null : new Date(view[${
335321 offset + 2
336322 } ] + view[${ offset + 3 } ] * 2**32),`;
337323 offset += 2 ;
338324 } else {
339- if ( ! optionalLoose ) {
325+ if ( ! optional ) {
340326 str += `${ name } : !!(view[${ offset } ] + view[${ offset + 1 } ] * 2**32),` ;
341327 } else {
342328 str += `${ name } : (unix ? !!((view[${ offset } ] + view[${
@@ -363,14 +349,14 @@ const { 0: statStruct, 1: statBuf } = createByteStruct({
363349 birthtime : "date" ,
364350 ctime : "date" ,
365351 dev : "u64" ,
366- ino : "! u64" ,
352+ ino : "? u64" ,
367353 mode : "u64" ,
368- nlink : "! u64" ,
354+ nlink : "? u64" ,
369355 uid : "?u64" ,
370356 gid : "?u64" ,
371357 rdev : "?u64" ,
372358 blksize : "?u64" ,
373- blocks : "! u64" ,
359+ blocks : "? u64" ,
374360 isBlockDevice : "?bool" ,
375361 isCharDevice : "?bool" ,
376362 isFifo : "?bool" ,
@@ -396,13 +382,13 @@ function parseFileInfo(response) {
396382 ctime : response . ctimeSet === true ? new Date ( Number ( response . ctime ) ) : null ,
397383 dev : response . dev ,
398384 mode : response . mode ,
399- ino : response . inoSet ? response . ino : null ,
400- nlink : response . nlinkSet ? response . nlink : null ,
385+ ino : unix ? response . ino : null ,
386+ nlink : unix ? response . nlink : null ,
401387 uid : unix ? response . uid : null ,
402388 gid : unix ? response . gid : null ,
403389 rdev : unix ? response . rdev : null ,
404390 blksize : unix ? response . blksize : null ,
405- blocks : response . blocksSet ? response . blocks : null ,
391+ blocks : unix ? response . blocks : null ,
406392 isBlockDevice : unix ? response . isBlockDevice : null ,
407393 isCharDevice : unix ? response . isCharDevice : null ,
408394 isFifo : unix ? response . isFifo : null ,
0 commit comments