Reads from the given file. Returns false in case of error. If swap is true, assumes a big/little-endian swap is needed.
| 53 | // Reads from the given file. Returns false in case of error. |
| 54 | // If swap is true, assumes a big/little-endian swap is needed. |
| 55 | bool TrainingSampleSet::FontClassInfo::DeSerialize(bool swap, FILE* fp) { |
| 56 | if (fread(&num_raw_samples, sizeof(num_raw_samples), 1, fp) != 1) |
| 57 | return false; |
| 58 | if (fread(&canonical_sample, sizeof(canonical_sample), 1, fp) != 1) |
| 59 | return false; |
| 60 | if (fread(&canonical_dist, sizeof(canonical_dist), 1, fp) != 1) return false; |
| 61 | if (!samples.DeSerialize(swap, fp)) return false; |
| 62 | if (swap) { |
| 63 | ReverseN(&num_raw_samples, sizeof(num_raw_samples)); |
| 64 | ReverseN(&canonical_sample, sizeof(canonical_sample)); |
| 65 | ReverseN(&canonical_dist, sizeof(canonical_dist)); |
| 66 | } |
| 67 | return true; |
| 68 | } |
| 69 | |
| 70 | TrainingSampleSet::TrainingSampleSet(const FontInfoTable& font_table) |
| 71 | : num_raw_samples_(0), unicharset_size_(0), |
nothing calls this directly
no test coverage detected