line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Convert::yEnc::Entry; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
22618
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
99
|
|
4
|
3
|
|
|
3
|
|
3566
|
use Set::IntSpan; |
|
3
|
|
|
|
|
71080
|
|
|
3
|
|
|
|
|
211
|
|
5
|
3
|
|
|
3
|
|
42
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
631
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new |
8
|
|
|
|
|
|
|
{ |
9
|
20
|
|
|
20
|
1
|
3980
|
my($class, $fields) = @_; |
10
|
|
|
|
|
|
|
|
11
|
20
|
100
|
|
|
|
121
|
$fields->{part} ? |
12
|
|
|
|
|
|
|
new Convert::yEnc::EntryM $fields : |
13
|
|
|
|
|
|
|
new Convert::yEnc::EntryS $fields |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub load |
17
|
|
|
|
|
|
|
{ |
18
|
7
|
|
|
7
|
1
|
1786
|
my($class, $line) = @_; |
19
|
|
|
|
|
|
|
|
20
|
7
|
|
|
|
|
23
|
my($size, $bytes, $parts) = split "\t", $line; |
21
|
|
|
|
|
|
|
|
22
|
7
|
100
|
|
|
|
42
|
$parts ? |
23
|
|
|
|
|
|
|
load Convert::yEnc::EntryM $size, $bytes, $parts : |
24
|
|
|
|
|
|
|
load Convert::yEnc::EntryS $size, $bytes |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
package Convert::yEnc::EntryS; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
|
21
|
use base qw(Convert::yEnc::Entry); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
430
|
|
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
33
|
use overload '""' => \&to_string, |
33
|
3
|
|
|
3
|
|
18
|
'eq' => \&_eq; |
|
3
|
|
|
|
|
7
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new |
38
|
|
|
|
|
|
|
{ |
39
|
10
|
|
|
10
|
|
14
|
my($class, $fields) = @_; |
40
|
|
|
|
|
|
|
|
41
|
10
|
|
|
|
|
19
|
my $size = $fields->{size}; |
42
|
10
|
100
|
|
|
|
28
|
$size or return undef; |
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
|
|
38
|
my $entry = { state => 'ybegin', |
45
|
|
|
|
|
|
|
size => $size, |
46
|
|
|
|
|
|
|
bytes => 0 }; |
47
|
|
|
|
|
|
|
|
48
|
9
|
|
|
|
|
199
|
bless $entry, $class |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub load |
52
|
|
|
|
|
|
|
{ |
53
|
3
|
|
|
3
|
|
7
|
my($class, $size, $bytes) = @_; |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
16
|
my $entry = { state => 'yend', |
56
|
|
|
|
|
|
|
size => $size, |
57
|
|
|
|
|
|
|
bytes => $bytes }; |
58
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
15
|
bless $entry, $class |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
1
|
|
5
|
sub ybegin { 0 } |
64
|
1
|
|
|
1
|
|
5
|
sub ypart { 0 } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub yend |
67
|
|
|
|
|
|
|
{ |
68
|
9
|
|
|
9
|
|
444
|
my($entry, $fields) = @_; |
69
|
|
|
|
|
|
|
|
70
|
9
|
100
|
|
|
|
111
|
$entry->{state} eq 'ybegin' or return 0; |
71
|
8
|
|
|
|
|
15
|
$entry->{state} = 'yend'; |
72
|
|
|
|
|
|
|
|
73
|
8
|
|
|
|
|
17
|
my $size = $fields->{size}; |
74
|
8
|
|
|
|
|
15
|
$entry->{bytes} = $size; |
75
|
8
|
50
|
|
|
|
89
|
$size and $size == $entry->{size} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub complete |
79
|
|
|
|
|
|
|
{ |
80
|
9
|
|
|
9
|
|
458
|
my $entry = shift; |
81
|
|
|
|
|
|
|
|
82
|
9
|
|
|
|
|
57
|
$entry->{state} eq 'yend' |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub to_string |
87
|
|
|
|
|
|
|
{ |
88
|
42
|
|
|
42
|
|
108
|
my $entry = shift; |
89
|
42
|
|
50
|
|
|
110
|
my $size = $entry->{size} || 0; |
90
|
42
|
|
100
|
|
|
174
|
my $bytes = $entry->{bytes} || 0; |
91
|
|
|
|
|
|
|
|
92
|
42
|
|
|
|
|
201
|
"$size\t$bytes" |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _eq |
96
|
|
|
|
|
|
|
{ |
97
|
3
|
|
|
3
|
|
1361
|
no warnings qw(uninitialized); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
291
|
|
98
|
|
|
|
|
|
|
|
99
|
2
|
|
|
2
|
|
4
|
my($a, $b) = $_; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
$a->{size }==$b->{size } and |
102
|
2
|
50
|
|
|
|
19
|
$a->{bytes}==$b->{bytes} |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
package Convert::yEnc::EntryM; |
107
|
|
|
|
|
|
|
|
108
|
3
|
|
|
3
|
|
21
|
use base qw(Convert::yEnc::Entry); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
329
|
|
109
|
|
|
|
|
|
|
|
110
|
3
|
|
|
|
|
41
|
use overload '""' => \&to_string, |
111
|
3
|
|
|
3
|
|
18
|
'eq' => \&_eq; |
|
3
|
|
|
|
|
12
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub new |
116
|
|
|
|
|
|
|
{ |
117
|
10
|
|
|
10
|
|
18
|
my($class, $fields) = @_; |
118
|
|
|
|
|
|
|
|
119
|
10
|
50
|
|
|
|
29
|
defined $fields->{size} or return undef; |
120
|
|
|
|
|
|
|
|
121
|
10
|
|
|
|
|
62
|
my $entry = { state => 'ybegin', |
122
|
|
|
|
|
|
|
fSize => $fields->{size}, |
123
|
|
|
|
|
|
|
part => $fields->{part}, |
124
|
|
|
|
|
|
|
total => $fields->{total}, |
125
|
|
|
|
|
|
|
parts => (new Set::IntSpan), |
126
|
|
|
|
|
|
|
bytes => (new Set::IntSpan) }; |
127
|
|
|
|
|
|
|
|
128
|
10
|
|
|
|
|
779
|
bless $entry, $class |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub load |
132
|
|
|
|
|
|
|
{ |
133
|
4
|
|
|
4
|
|
9
|
my($class, $size, $bytes, $parts) = @_; |
134
|
|
|
|
|
|
|
|
135
|
4
|
|
|
|
|
19
|
my $entry = { state => 'yend', |
136
|
|
|
|
|
|
|
fSize => $size, |
137
|
|
|
|
|
|
|
bytes => (new Set::IntSpan $bytes), |
138
|
|
|
|
|
|
|
parts => (new Set::IntSpan $parts) }; |
139
|
|
|
|
|
|
|
|
140
|
4
|
|
|
|
|
443
|
bless $entry, $class |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub ypart |
144
|
|
|
|
|
|
|
{ |
145
|
17
|
|
|
17
|
|
1490
|
my($entry, $fields) = @_; |
146
|
|
|
|
|
|
|
|
147
|
17
|
100
|
|
|
|
63
|
$entry->{state} eq 'ybegin' or return 0; |
148
|
16
|
|
|
|
|
27
|
$entry->{state} = 'ypart'; |
149
|
|
|
|
|
|
|
|
150
|
16
|
|
|
|
|
24
|
my $begin = $fields->{begin}; |
151
|
16
|
|
|
|
|
27
|
my $end = $fields->{end }; |
152
|
16
|
50
|
33
|
|
|
75
|
$begin and $end or return 0; |
153
|
|
|
|
|
|
|
|
154
|
16
|
|
|
|
|
32
|
$entry->{begin} = $begin; |
155
|
16
|
|
|
|
|
31
|
$entry->{end } = $end; |
156
|
|
|
|
|
|
|
|
157
|
16
|
|
|
|
|
97
|
$entry->{pSize} = $end - $begin + 1; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub yend |
161
|
|
|
|
|
|
|
{ |
162
|
17
|
|
|
17
|
|
6033
|
my($entry, $fields) = @_; |
163
|
|
|
|
|
|
|
|
164
|
17
|
100
|
|
|
|
248
|
$entry->{state} eq 'ypart' or return 0; |
165
|
16
|
|
|
|
|
198
|
$entry->{state} = 'yend'; |
166
|
|
|
|
|
|
|
|
167
|
16
|
|
|
|
|
24
|
my $pSize = $fields->{size}; |
168
|
16
|
50
|
|
|
|
208
|
defined $pSize or return 0; |
169
|
|
|
|
|
|
|
|
170
|
16
|
|
|
|
|
24
|
my $part = $fields->{part}; |
171
|
16
|
50
|
|
|
|
49
|
$part == $entry->{part} or return 0; |
172
|
|
|
|
|
|
|
|
173
|
16
|
|
|
|
|
56
|
$entry->{parts}->insert($part); |
174
|
|
|
|
|
|
|
|
175
|
16
|
|
|
|
|
359
|
my $begin = $entry->{begin}; |
176
|
16
|
|
|
|
|
28
|
my $end = $entry->{end }; |
177
|
16
|
|
|
|
|
101
|
my $bytes = "$begin-$end"; |
178
|
|
|
|
|
|
|
|
179
|
16
|
50
|
|
|
|
60
|
valid Set::IntSpan $bytes or return 0; |
180
|
16
|
|
|
|
|
1079
|
$entry->{bytes} = $entry->{bytes}->union($bytes); |
181
|
|
|
|
|
|
|
|
182
|
16
|
|
|
|
|
1532
|
1 |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub ybegin |
186
|
|
|
|
|
|
|
{ |
187
|
11
|
|
|
11
|
|
425
|
my($entry, $fields) = @_; |
188
|
|
|
|
|
|
|
|
189
|
11
|
100
|
|
|
|
107
|
$entry->{state} eq 'yend' or return 0; |
190
|
10
|
|
|
|
|
18
|
$entry->{state} = 'ybegin'; |
191
|
|
|
|
|
|
|
|
192
|
10
|
50
|
|
|
|
32
|
$fields->{size}==$entry->{fSize} or return 0; |
193
|
|
|
|
|
|
|
|
194
|
10
|
|
|
|
|
16
|
my $total = $fields->{total}; |
195
|
10
|
100
|
100
|
|
|
74
|
defined $total and defined $entry->{total} and $total != $entry->{total} and |
|
|
|
100
|
|
|
|
|
196
|
|
|
|
|
|
|
return 0; |
197
|
|
|
|
|
|
|
|
198
|
9
|
|
|
|
|
16
|
my $part = $fields->{part}; |
199
|
9
|
50
|
|
|
|
20
|
defined $part or return 0; |
200
|
9
|
|
|
|
|
13
|
$entry->{part} = $part; |
201
|
|
|
|
|
|
|
|
202
|
9
|
|
|
|
|
43
|
1 |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub complete |
206
|
|
|
|
|
|
|
{ |
207
|
10
|
|
|
10
|
|
904
|
my $entry = shift; |
208
|
|
|
|
|
|
|
|
209
|
10
|
|
|
|
|
44
|
$entry->{fSize} == $entry->{bytes}->cardinality; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub to_string |
214
|
|
|
|
|
|
|
{ |
215
|
65
|
|
|
65
|
|
505
|
my $entry = shift; |
216
|
65
|
|
|
|
|
93
|
my $size = $entry->{fSize}; |
217
|
65
|
|
|
|
|
186
|
my $bytes = $entry->{bytes}->run_list; |
218
|
65
|
|
|
|
|
1106
|
my $parts = $entry->{parts}->run_list; |
219
|
|
|
|
|
|
|
|
220
|
65
|
|
|
|
|
1069
|
"$size\t$bytes\t$parts" |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub _eq |
225
|
|
|
|
|
|
|
{ |
226
|
2
|
|
|
2
|
|
4
|
my($a, $b) = @_; |
227
|
|
|
|
|
|
|
|
228
|
2
|
50
|
33
|
|
|
16
|
$a->{fSize}==$b->{fSize} and |
229
|
|
|
|
|
|
|
$a->{bytes}->equal($b->{bytes}) and |
230
|
|
|
|
|
|
|
$a->{parts}->equal($b->{parts}) |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
1 |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
__END__ |