Skip to content

Commit 66bc012

Browse files
committed
UNICHARSET: Use new serialization API
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent eb90068 commit 66bc012

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/ccutil/unicharset.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,13 @@ class UNICHARSET {
354354
// Returns true if the operation is successful.
355355
bool save_to_file(FILE *file) const {
356356
STRING str;
357-
if (!save_to_string(&str)) return false;
358-
if (fwrite(&str[0], str.length(), 1, file) != 1) return false;
359-
return true;
357+
return save_to_string(&str) &&
358+
tesseract::Serialize(file, &str[0], str.length());
360359
}
360+
361361
bool save_to_file(tesseract::TFile *file) const {
362362
STRING str;
363-
if (!save_to_string(&str)) return false;
364-
if (file->FWrite(&str[0], str.length(), 1) != 1) return false;
365-
return true;
363+
return save_to_string(&str) && file->Serialize(&str[0], str.length());
366364
}
367365

368366
// Saves the content of the UNICHARSET to the given STRING.

0 commit comments

Comments
 (0)