Fix a shapetable serialization issue -- sizeof(bool) is not portable.

See http://code.google.com/p/tesseract-ocr/issues/detail?id=669



git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@720 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
david.eger@gmail.com 2012-04-17 00:00:26 +00:00
parent a253ea224a
commit 71b3200625

View File

@ -56,7 +56,7 @@ int UnicharAndFonts::SortByUnicharId(const void* v1, const void* v2) {
// Writes to the given file. Returns false in case of error.
bool Shape::Serialize(FILE* fp) {
if (fwrite(&unichars_sorted_, sizeof(unichars_sorted_), 1, fp) != 1)
if (fwrite(&unichars_sorted_, 1, 1, fp) != 1)
return false;
if (!unichars_.SerializeClasses(fp)) return false;
return true;
@ -64,7 +64,7 @@ bool Shape::Serialize(FILE* fp) {
// Reads from the given file. Returns false in case of error.
// If swap is true, assumes a big/little-endian swap is needed.
bool Shape::DeSerialize(bool swap, FILE* fp) {
if (fread(&unichars_sorted_, sizeof(unichars_sorted_), 1, fp) != 1)
if (fread(&unichars_sorted_, 1, 1, fp) != 1)
return false;
if (!unichars_.DeSerializeClasses(swap, fp)) return false;
return true;