line |
true |
false |
branch |
11
|
1303 |
0 |
FILE* fh = fopen(spath, "rb"); |
12
|
51 |
1252 |
if (fh == NULL) return string(); |
14
|
0 |
1252 |
if (fseek(fh, 0, SEEK_END) != 0) { |
15
|
0 |
0 |
fclose(fh); |
19
|
1252 |
0 |
auto size = ftell(fh); |
20
|
0 |
1252 |
if (size < 0) { |
21
|
0 |
0 |
fclose(fh); |
25
|
1252 |
0 |
rewind(fh); |
26
|
1252 |
0 |
string ret(size); |
27
|
1252 |
0 |
size_t readsize = fread(ret.buf(), sizeof(char), size, fh); |
|
1252 |
0 |
size_t readsize = fread(ret.buf(), sizeof(char), size, fh); |
28
|
0 |
1252 |
if (readsize != (size_t)size) return string(); |
30
|
1252 |
0 |
fclose(fh); |
32
|
1252 |
0 |
return ret; |