Skip to content

Commit f483ffb

Browse files
committed
Merge branch 'master' into xattrs
2 parents 0fc9554 + 24742c0 commit f483ffb

File tree

2 files changed

+22
-32
lines changed

2 files changed

+22
-32
lines changed

lib/libhfs/libhfs.c

+19-18
Original file line numberDiff line numberDiff line change
@@ -2642,12 +2642,11 @@ hfslib_read_file_finderinfo(
26422642

26432643
ptr = in_bytes;
26442644

2645-
#if 0
2646-
#pragma warn Fill in with real code!
2647-
#endif
2648-
/* FIXME: Fill in with real code! */
2649-
memset(out_info, 0, sizeof(*out_info));
2650-
ptr = (uint8_t*)ptr + sizeof(hfs_macos_extended_file_info_t);
2645+
for(int i = 0; i < 4; i++)
2646+
out_info->reserved[i] = be16tohp(&ptr);
2647+
out_info->extended_finder_flags = be16tohp(&ptr);
2648+
out_info->reserved2 = be16tohp(&ptr);
2649+
out_info->put_away_folder_cnid = be32tohp(&ptr);
26512650

26522651
return ((uint8_t*)ptr - (uint8_t*)in_bytes);
26532652
}
@@ -2662,12 +2661,14 @@ hfslib_read_folder_userinfo(void* in_bytes, hfs_macos_folder_info_t* out_info)
26622661

26632662
ptr = in_bytes;
26642663

2665-
#if 0
2666-
#pragma warn Fill in with real code!
2667-
#endif
2668-
/* FIXME: Fill in with real code! */
2669-
memset(out_info, 0, sizeof(*out_info));
2670-
ptr = (uint8_t*)ptr + sizeof(hfs_macos_folder_info_t);
2664+
out_info->window_bounds.t = be16tohp(&ptr);
2665+
out_info->window_bounds.l = be16tohp(&ptr);
2666+
out_info->window_bounds.b = be16tohp(&ptr);
2667+
out_info->window_bounds.r = be16tohp(&ptr);
2668+
out_info->finder_flags = be16tohp(&ptr);
2669+
out_info->location.v = be16tohp(&ptr);
2670+
out_info->location.h = be16tohp(&ptr);
2671+
out_info->reserved = be16tohp(&ptr);
26712672

26722673
return ((uint8_t*)ptr - (uint8_t*)in_bytes);
26732674
}
@@ -2684,12 +2685,12 @@ hfslib_read_folder_finderinfo(
26842685

26852686
ptr = in_bytes;
26862687

2687-
#if 0
2688-
#pragma warn Fill in with real code!
2689-
#endif
2690-
/* FIXME: Fill in with real code! */
2691-
memset(out_info, 0, sizeof(*out_info));
2692-
ptr = (uint8_t*)ptr + sizeof(hfs_macos_extended_folder_info_t);
2688+
out_info->scroll_position.v = be16tohp(&ptr);
2689+
out_info->scroll_position.h = be16tohp(&ptr);
2690+
out_info->reserved = be32tohp(&ptr);
2691+
out_info->extended_finder_flags = be16tohp(&ptr);
2692+
out_info->reserved2 = be16tohp(&ptr);
2693+
out_info->put_away_folder_cnid = be32tohp(&ptr);
26932694

26942695
return ((uint8_t*)ptr - (uint8_t*)in_bytes);
26952696
}

lib/libhfsuser/hfsuser.c

+3-14
Original file line numberDiff line numberDiff line change
@@ -458,37 +458,26 @@ static inline char* swapcopy(char* buf, char* src, size_t size) {
458458
#define SWAPCOPY(buf, src) swapcopy((char*)(buf),(char*)&(src),sizeof((src)))
459459

460460
void hfs_serialize_finderinfo(hfs_catalog_keyed_record_t* rec, char buf[32]) {
461+
memset(buf,0,32);
461462
if(rec->type == HFS_REC_FILE) {
462463
buf = SWAPCOPY(buf, rec->file.user_info.file_type);
463464
buf = SWAPCOPY(buf, rec->file.user_info.file_creator);
464465
buf = SWAPCOPY(buf, rec->file.user_info.finder_flags);
465466
buf = SWAPCOPY(buf, rec->file.user_info.location.v);
466467
buf = SWAPCOPY(buf, rec->file.user_info.location.h);
467-
buf = SWAPCOPY(buf, rec->file.user_info.reserved);
468-
469-
for(int i = 0; i < 4; i++)
470-
buf = SWAPCOPY(buf, rec->file.finder_info.reserved[i]);
468+
buf += 10;
471469
buf = SWAPCOPY(buf, rec->file.finder_info.extended_finder_flags);
472-
buf = SWAPCOPY(buf, rec->file.finder_info.reserved2);
473-
buf = SWAPCOPY(buf, rec->file.finder_info.put_away_folder_cnid);
474470
}
475471
else if(rec->type == HFS_REC_FLDR) {
476472
buf = SWAPCOPY(buf, rec->folder.user_info.window_bounds.t);
477473
buf = SWAPCOPY(buf, rec->folder.user_info.window_bounds.l);
478474
buf = SWAPCOPY(buf, rec->folder.user_info.window_bounds.b);
479475
buf = SWAPCOPY(buf, rec->folder.user_info.window_bounds.r);
480-
481476
buf = SWAPCOPY(buf, rec->folder.user_info.finder_flags);
482477
buf = SWAPCOPY(buf, rec->folder.user_info.location.v);
483478
buf = SWAPCOPY(buf, rec->folder.user_info.location.h);
484-
buf = SWAPCOPY(buf, rec->folder.user_info.reserved);
485-
486-
buf = SWAPCOPY(buf, rec->folder.finder_info.scroll_position.v);
487-
buf = SWAPCOPY(buf, rec->folder.finder_info.scroll_position.h);
488-
buf = SWAPCOPY(buf, rec->folder.finder_info.reserved);
479+
buf += 10;
489480
buf = SWAPCOPY(buf, rec->folder.finder_info.extended_finder_flags);
490-
buf = SWAPCOPY(buf, rec->folder.finder_info.reserved2);
491-
buf = SWAPCOPY(buf, rec->folder.finder_info.put_away_folder_cnid);
492481
}
493482
}
494483

0 commit comments

Comments
 (0)