We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66bc012 commit bb6c012Copy full SHA for bb6c012
src/ccstruct/points.cpp
@@ -61,15 +61,14 @@ static int sign(int x) {
61
62
// Writes to the given file. Returns false in case of error.
63
bool ICOORD::Serialize(FILE* fp) const {
64
- if (fwrite(&xcoord, sizeof(xcoord), 1, fp) != 1) return false;
65
- if (fwrite(&ycoord, sizeof(ycoord), 1, fp) != 1) return false;
66
- return true;
+ return tesseract::Serialize(fp, &xcoord) &&
+ tesseract::Serialize(fp, &ycoord);
67
}
68
// Reads from the given file. Returns false in case of error.
69
// If swap is true, assumes a big/little-endian swap is needed.
70
bool ICOORD::DeSerialize(bool swap, FILE* fp) {
71
- if (fread(&xcoord, sizeof(xcoord), 1, fp) != 1) return false;
72
- if (fread(&ycoord, sizeof(ycoord), 1, fp) != 1) return false;
+ if (!tesseract::DeSerialize(fp, &xcoord)) return false;
+ if (!tesseract::DeSerialize(fp, &ycoord)) return false;
73
if (swap) {
74
ReverseN(&xcoord, sizeof(xcoord));
75
ReverseN(&ycoord, sizeof(ycoord));
0 commit comments