From 127d0e31f069695ea53c1c9709fdc0c6add498f8 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 30 Mar 2019 14:17:24 +0100 Subject: [PATCH] serialis: Modernize and format code Signed-off-by: Stefan Weil --- src/ccutil/params.h | 1 + src/ccutil/serialis.h | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ccutil/params.h b/src/ccutil/params.h index 4f90b9dc1e..5cef181683 100644 --- a/src/ccutil/params.h +++ b/src/ccutil/params.h @@ -22,6 +22,7 @@ #include #include "genericvector.h" +#include "host.h" // for BOOL8 #include "strngs.h" namespace tesseract { diff --git a/src/ccutil/serialis.h b/src/ccutil/serialis.h index 9f7f6a6ac2..c1d1483ced 100644 --- a/src/ccutil/serialis.h +++ b/src/ccutil/serialis.h @@ -2,7 +2,6 @@ * File: serialis.h (Formerly serialmac.h) * Description: Inline routines and macros for serialisation functions * Author: Phil Cheatle - * Created: Tue Oct 08 08:33:12 BST 1991 * * (C) Copyright 1990, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,12 +19,13 @@ #ifndef SERIALIS_H #define SERIALIS_H +#include // uint8_t +#include #include #include -#include -#include "host.h" -template class GenericVector; +template +class GenericVector; class STRING; /*********************************************************************** @@ -46,11 +46,10 @@ constexpr size_t countof(T const (&)[N]) noexcept { // Function to read a GenericVector from a whole file. // Returns false on failure. -typedef bool (*FileReader)(const STRING& filename, GenericVector* data); +using FileReader = bool (*)(const STRING&, GenericVector*); // Function to write a GenericVector to a whole file. // Returns false on failure. -typedef bool (*FileWriter)(const GenericVector& data, - const STRING& filename); +using FileWriter = bool (*)(const GenericVector&, const STRING&); // Deserialize data from file. bool DeSerialize(FILE* fp, char* data, size_t n = 1); @@ -88,7 +87,9 @@ class TFile { // From an open file and an end offset. bool Open(FILE* fp, int64_t end_offset); // Sets the value of the swap flag, so that FReadEndian does the right thing. - void set_swap(bool value) { swap_ = value; } + void set_swap(bool value) { + swap_ = value; + } // Deserialize data. bool DeSerialize(char* data, size_t count = 1);