package resize_fat::directory; use diagnostics; use strict; use common qw(:system); use resize_fat::dir_entry; use resize_fat::io; my $format = "a8 a3 C C C S7 I"; my @fields = ( 'name', 'extension', 'attributes', 'is_upper_case_name', 'creation_time_low', #- milliseconds 'creation_time_high', 'creation_date', 'access_date', 'first_cluster_high', #- for FAT32 'time', 'date', 'first_cluster', 'length', ); my $psizeof_format = psizeof($format); 1; sub entry_size { $psizeof_format } #- call `f' for each entry of the directory #- if f return true, then modification in the entry are taken back sub traverse($$) { my ($directory, $f) = @_; for (my $i = 0;; $i++) { my $raw = \substr($directory, $i * $psizeof_format, $psizeof_format); #- empty entry means end of directory $$raw =~ /^\0*$/ and return $directory; my $entry; @{$entry}{@fields} = unpack $format, $$raw; &$f($entry) and $$raw = pack $format, @{$entry}{@fields}; } $directory; } sub traverse_all($$) { my ($fs, $f) = @_; my $traverse_all; $traverse_all = sub { my ($entry) = @_; &$f($entry); resize_fat::dir_entry::is_directory($entry) and traverse(resize_fat::io::read_file($fs, resize_fat::dir_entry::get_cluster($entry)), $traverse_all); undef; #- no need to write back (cf traverse) }; my $directory = $resize_fat::isFAT32 ? resize_fat::io::read_file($fs, $fs->{fat32_root_dir_cluster}) : resize_fat::io::read($fs, $fs->{root_dir_offset}, $fs->{root_dir_size}); traverse($directory, $traverse_all); undef $traverse_all; #- circular reference is no good for perl's poor GC :( } #- function used by construct_dir_tree to translate the `cluster' fields in each #- directory entry sub remap($$) { my ($fs, $directory) = @_; traverse($directory, \&resize_fat::dir_entry::remap); } tats/phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php'>stats
path: root/phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2014-06-16 22:24:59 +0200
committerAndreas Fischer <bantu@phpbb.com>2014-06-16 22:24:59 +0200
commit4d6afb26380d192efc556640499b6f5c43fbdf3c (patch)
tree4517a02476b14ffcd3f51e8aa62634292ab28f32 /phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php
parent0b106ab0e3f9fe94e42a55db27d1d989c06b5039 (diff)
parentca3cdadd083dfa2e4e0596d17424c7d9b541785c (diff)
downloadforums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar
forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar.gz
forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar.bz2
forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.tar.xz
forums-4d6afb26380d192efc556640499b6f5c43fbdf3c.zip
Merge pull request #2604 from Nicofuma/ticket/12722
[ticket/12722] Add Generic.Formatting.SpaceAfterCast in the legacy ruleset * Nicofuma/ticket/12722: [ticket/12722] Add Generic.Formatting.SpaceAfterCast in the legacy ruleset
Diffstat (limited to 'phpBB/phpbb/db/migration/data/v310/profilefield_cleanup.php')
0 files changed, 0 insertions, 0 deletions