line |
true |
false |
branch |
49
|
4011 |
322 |
while ((c = *src++)) { |
50
|
917 |
3094 |
if (c == '.') { |
51
|
917 |
0 |
if (++parts > 3 || part < 0) return 0; |
|
903 |
14 |
if (++parts > 3 || part < 0) return 0; |
54
|
2905 |
189 |
} else if ((c -= '0') >= 0 |
55
|
2814 |
91 |
&& c <= 9) { |
56
|
1239 |
1575 |
if (part < 0) part = c; |
57
|
1547 |
28 |
else if ((part = part*10 + c) > 255) return 0; |
60
|
301 |
21 |
if (part < 0 || parts < 3) return 0; |
82
|
0 |
9 |
if (mode > 3) croak("operand of IP::World::new = %d, should be 0-3", mode); |
84
|
7 |
2 |
if (mode != 2) self.io.p = PerlIO_open(filepath, "rb"); |
88
|
0 |
9 |
if (!self.io.f) croak("Can't open %s: %s", filepath, strerror(errno)); |
92
|
2 |
7 |
if (mode == 1) { |
100
|
0 |
2 |
if (self.addr == MAP_FAILED) |
104
|
3 |
4 |
if (mode < 2) { |
111
|
0 |
3 |
if (!self.addr) croak ("memory allocation for %s failed", filepath); |
118
|
0 |
3 |
if (readLen < 0) croak("read from %s failed: %s", filepath, strerror(errno)); |
119
|
0 |
3 |
if ((STRLEN)readLen != fileLen) |
125
|
5 |
4 |
if (mode < 2) |
157
|
651 |
0 |
if (sv_isobject(self_ref)) { |
159
|
651 |
0 |
if (SvPOK(self_deref)) s = SvPV(self_deref, len); |
|
651 |
0 |
if (SvPOK(self_deref)) s = SvPV(self_deref, len); |
161
|
0 |
651 |
if (len != sizeof(wip_self)) |
165
|
7 |
644 |
if (!SvOK(ip_sv)) goto set_retval; |
|
7 |
0 |
if (!SvOK(ip_sv)) goto set_retval; |
|
0 |
7 |
if (!SvOK(ip_sv)) goto set_retval; |
167
|
644 |
0 |
if (!(flgs & (SVp_POK|SVf_NOK|SVp_NOK|SVf_IOK|SVp_IOK))) goto set_retval; |
168
|
644 |
0 |
s = SvPV(ip_sv, len); |
171
|
343 |
301 |
if (ck_ip4(s, netip) > 0) s = (char *)netip; |
172
|
315 |
28 |
else if (len != 4) goto set_retval; |
177
|
352 |
264 |
if (self.mode < 2) { |
180
|
4512 |
264 |
while (bottom < top-1) { |
183
|
2199 |
2313 |
if (ip < ips[i]) top = i; |
191
|
6016 |
352 |
while (bottom < top-1) { |
195
|
3008 |
3008 |
if (self.mode == 3) { |
205
|
3084 |
2932 |
if (ip < word) top = i; |
211
|
176 |
176 |
if (self.mode == 3) { |
227
|
161 |
455 |
if (word == 26*26) c[0] = c[1] = '?'; |
248
|
9 |
0 |
if (sv_isobject(self_ref)) { |
250
|
9 |
0 |
if (SvPOK(self_deref)) |
251
|
9 |
0 |
s = SvPV(self_deref, len); |
253
|
0 |
9 |
if (len != sizeof(wip_self)) |
257
|
2 |
7 |
if (self.mode == 1) munmap((caddr_t)self.addr, (size_t)((self.entries<<4)/3)); |
260
|
3 |
4 |
if (self.mode < 2) Safefree(self.addr); |
263
|
2 |
2 |
if (self.mode == 3) PerlIO_close(self.io.p); |