- fseek(f_fsc,sizeof(EMUFS_FSC)*n_gap_before,0);
- gap_new.n_marker = gap_before.n_marker;
- gap_new.n_freespace = gap_before.n_freespace + n_freespace + gap_after.n_freespace;
+ if (pos_gap_before < pos_gap_after) {
+ fseek(f_fsc,sizeof(EMUFS_FSC)*pos_gap_before,0);
+ destination = sizeof(EMUFS_FSC)*pos_gap_after;
+ }
+ else {
+ fseek(f_fsc,sizeof(EMUFS_FSC)*pos_gap_after,0);
+ destination = sizeof(EMUFS_FSC)*pos_gap_before;
+ }
+ gap_new.marker = gap_before.marker;
+ gap_new.freespace = gap_before.freespace + freespace + gap_after.freespace;