line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::DBus::Signature; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
707
|
use strict; |
|
9
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
224
|
|
4
|
9
|
|
|
9
|
|
37
|
use warnings; |
|
9
|
|
|
|
|
31
|
|
|
9
|
|
|
|
|
2362
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Returns a list of single complete types (SCTs). |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub split { |
9
|
231
|
|
|
231
|
0
|
297
|
my ($sig) = @_; |
10
|
|
|
|
|
|
|
|
11
|
231
|
|
|
|
|
249
|
my @scts; |
12
|
|
|
|
|
|
|
|
13
|
231
|
|
|
|
|
353
|
while (length($sig)) { |
14
|
296
|
|
|
|
|
708
|
my $next_sct_len = Protocol::DBus::Signature::get_sct_length($sig, 0); |
15
|
296
|
|
|
|
|
672
|
push @scts, substr( $sig, 0, $next_sct_len, q<> ); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
231
|
|
|
|
|
528
|
return @scts; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Returns the length of the single complete type at $sct_offset. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get_sct_length { |
24
|
831
|
|
|
831
|
0
|
3726
|
my ($sig, $sct_offset) = @_; |
25
|
|
|
|
|
|
|
|
26
|
831
|
|
|
|
|
889
|
my $start = $sct_offset; |
27
|
|
|
|
|
|
|
|
28
|
831
|
|
|
|
|
1031
|
my $next = substr($sig, $sct_offset, 1); |
29
|
|
|
|
|
|
|
|
30
|
831
|
100
|
|
|
|
1298
|
if ($next eq 'a') { |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# “{ }” only happens after “a” |
33
|
111
|
|
|
|
|
151
|
my $next_2nd = substr($sig, 1 + $sct_offset, 1); |
34
|
111
|
100
|
|
|
|
179
|
if ($next_2nd eq '{') { |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# 4 for the “a”, “{”, key type, and “}”. |
37
|
|
|
|
|
|
|
# We assume that the signature is well-formed. |
38
|
43
|
|
|
|
|
122
|
return 4 + get_sct_length($sig, 3 + $sct_offset); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
68
|
|
|
|
|
103
|
return 1 + get_sct_length($sig, 1 + $sct_offset); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
720
|
100
|
|
|
|
973
|
if ($next eq '(') { |
45
|
39
|
|
|
|
|
44
|
while (1) { |
46
|
121
|
|
|
|
|
131
|
$sct_offset++; |
47
|
|
|
|
|
|
|
|
48
|
121
|
50
|
|
|
|
160
|
last if $sct_offset >= length($sig); |
49
|
|
|
|
|
|
|
|
50
|
121
|
|
|
|
|
155
|
my $next_in_struct = substr($sig, $sct_offset, 1); |
51
|
|
|
|
|
|
|
|
52
|
121
|
100
|
100
|
|
|
627
|
if ($next_in_struct eq '(' || $next_in_struct eq 'a') { |
|
|
100
|
|
|
|
|
|
53
|
15
|
|
|
|
|
42
|
$sct_offset += get_sct_length($sig, $sct_offset) - 1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
elsif ($next_in_struct eq ')') { |
56
|
39
|
|
|
|
|
50
|
last; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
720
|
|
|
|
|
1234
|
return 1 + ($sct_offset - $start); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |