| 679 | } |
| 680 | |
| 681 | bool path_read_binary(const string &path, vector<uint8_t> &binary) |
| 682 | { |
| 683 | /* read binary file into memory */ |
| 684 | FILE *f = path_fopen(path, "rb"); |
| 685 | |
| 686 | if (!f) { |
| 687 | binary.resize(0); |
| 688 | return false; |
| 689 | } |
| 690 | |
| 691 | binary.resize(path_file_size(path)); |
| 692 | |
| 693 | if (binary.empty()) { |
| 694 | fclose(f); |
| 695 | return false; |
| 696 | } |
| 697 | |
| 698 | if (fread(binary.data(), sizeof(uint8_t), binary.size(), f) != binary.size()) { |
| 699 | fclose(f); |
| 700 | return false; |
| 701 | } |
| 702 | |
| 703 | fclose(f); |
| 704 | |
| 705 | return true; |
| 706 | } |
| 707 | |
| 708 | bool path_read_compressed_binary(const string &path, vector<uint8_t> &binary) |
| 709 | { |
no test coverage detected