Skip to content

Commit bb6c012

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

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/ccstruct/points.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@ static int sign(int x) {
6161

6262
// Writes to the given file. Returns false in case of error.
6363
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;
64+
return tesseract::Serialize(fp, &xcoord) &&
65+
tesseract::Serialize(fp, &ycoord);
6766
}
6867
// Reads from the given file. Returns false in case of error.
6968
// If swap is true, assumes a big/little-endian swap is needed.
7069
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;
70+
if (!tesseract::DeSerialize(fp, &xcoord)) return false;
71+
if (!tesseract::DeSerialize(fp, &ycoord)) return false;
7372
if (swap) {
7473
ReverseN(&xcoord, sizeof(xcoord));
7574
ReverseN(&ycoord, sizeof(ycoord));

0 commit comments

Comments
 (0)