| 240 | } |
| 241 | |
| 242 | bool load_file(std::string const& filename, std::vector<char>& v |
| 243 | , int limit = 8000000) |
| 244 | { |
| 245 | std::fstream f(filename, std::ios_base::in | std::ios_base::binary); |
| 246 | f.seekg(0, std::ios_base::end); |
| 247 | auto const s = f.tellg(); |
| 248 | if (s > limit || s < 0) return false; |
| 249 | f.seekg(0, std::ios_base::beg); |
| 250 | v.resize(static_cast<std::size_t>(s)); |
| 251 | if (s == std::fstream::pos_type(0)) return !f.fail(); |
| 252 | f.read(v.data(), int(v.size())); |
| 253 | return !f.fail(); |
| 254 | } |
| 255 | |
| 256 | bool is_absolute_path(std::string const& f) |
| 257 | { |
no test coverage detected