Skip to content

Commit 127d0e3

Browse files
committed
serialis: Modernize and format code
Signed-off-by: Stefan Weil <[email protected]>
1 parent 8b663e7 commit 127d0e3

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/ccutil/params.h

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <cstdio>
2323

2424
#include "genericvector.h"
25+
#include "host.h" // for BOOL8
2526
#include "strngs.h"
2627

2728
namespace tesseract {

src/ccutil/serialis.h

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* File: serialis.h (Formerly serialmac.h)
33
* Description: Inline routines and macros for serialisation functions
44
* Author: Phil Cheatle
5-
* Created: Tue Oct 08 08:33:12 BST 1991
65
*
76
* (C) Copyright 1990, Hewlett-Packard Ltd.
87
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,12 +19,13 @@
2019
#ifndef SERIALIS_H
2120
#define SERIALIS_H
2221

22+
#include <cstdint> // uint8_t
23+
#include <cstdio>
2324
#include <cstdlib>
2425
#include <cstring>
25-
#include <cstdio>
26-
#include "host.h"
2726

28-
template <typename T> class GenericVector;
27+
template <typename T>
28+
class GenericVector;
2929
class STRING;
3030

3131
/***********************************************************************
@@ -46,11 +46,10 @@ constexpr size_t countof(T const (&)[N]) noexcept {
4646

4747
// Function to read a GenericVector<char> from a whole file.
4848
// Returns false on failure.
49-
typedef bool (*FileReader)(const STRING& filename, GenericVector<char>* data);
49+
using FileReader = bool (*)(const STRING&, GenericVector<char>*);
5050
// Function to write a GenericVector<char> to a whole file.
5151
// Returns false on failure.
52-
typedef bool (*FileWriter)(const GenericVector<char>& data,
53-
const STRING& filename);
52+
using FileWriter = bool (*)(const GenericVector<char>&, const STRING&);
5453

5554
// Deserialize data from file.
5655
bool DeSerialize(FILE* fp, char* data, size_t n = 1);
@@ -88,7 +87,9 @@ class TFile {
8887
// From an open file and an end offset.
8988
bool Open(FILE* fp, int64_t end_offset);
9089
// Sets the value of the swap flag, so that FReadEndian does the right thing.
91-
void set_swap(bool value) { swap_ = value; }
90+
void set_swap(bool value) {
91+
swap_ = value;
92+
}
9293

9394
// Deserialize data.
9495
bool DeSerialize(char* data, size_t count = 1);

0 commit comments

Comments
 (0)