UNICHARSET: Use new serialization API

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-07-18 13:59:47 +02:00
parent eb90068b5f
commit 66bc012d27

View File

@ -354,15 +354,13 @@ class UNICHARSET {
// Returns true if the operation is successful.
bool save_to_file(FILE *file) const {
STRING str;
if (!save_to_string(&str)) return false;
if (fwrite(&str[0], str.length(), 1, file) != 1) return false;
return true;
return save_to_string(&str) &&
tesseract::Serialize(file, &str[0], str.length());
}
bool save_to_file(tesseract::TFile *file) const {
STRING str;
if (!save_to_string(&str)) return false;
if (file->FWrite(&str[0], str.length(), 1) != 1) return false;
return true;
return save_to_string(&str) && file->Serialize(&str[0], str.length());
}
// Saves the content of the UNICHARSET to the given STRING.