Skip to content

Commit

Permalink
wordrec: Replace NULL by nullptr
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Apr 22, 2018
1 parent 8374e37 commit 58d9593
Show file tree
Hide file tree
Showing 21 changed files with 240 additions and 240 deletions.
6 changes: 3 additions & 3 deletions wordrec/associate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void AssociateUtils::ComputeStats(int col, int row,
AssociateStats *stats) {
stats->Clear();

ASSERT_HOST(word_res != NULL);
ASSERT_HOST(word_res != nullptr);
if (word_res->blob_widths.empty()) {
return;
}
Expand All @@ -55,7 +55,7 @@ void AssociateUtils::ComputeStats(int col, int row,
float normalizing_height = kBlnXHeight;
ROW* blob_row = word_res->blob_row;
// TODO(rays/daria) Can unicharset.script_has_xheight be useful here?
if (fixed_pitch && blob_row != NULL) {
if (fixed_pitch && blob_row != nullptr) {
// For fixed pitch language like CJK, we use the full text height
// as the normalizing factor so we are not dependent on xheight
// calculation.
Expand Down Expand Up @@ -126,7 +126,7 @@ void AssociateUtils::ComputeStats(int col, int row,
// the means and variances are computed for the path so far (not
// considering characters to the right of the last character on the path).
stats->full_wh_ratio = wh_ratio + right_gap;
if (parent_stats != NULL) {
if (parent_stats != nullptr) {
stats->full_wh_ratio_total =
(parent_stats->full_wh_ratio_total + stats->full_wh_ratio);
float mean =
Expand Down
2 changes: 1 addition & 1 deletion wordrec/associate.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class AssociateUtils {
// information in the (col, row) entry of the ratings matrix is not used).
//
// Note: the function assumes that word_res, stats and
// associate_cost pointers are not NULL.
// associate_cost pointers are not nullptr.
static void ComputeStats(int col, int row,
const AssociateStats *parent_stats,
int parent_path_length,
Expand Down
30 changes: 15 additions & 15 deletions wordrec/chop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int Wordrec::angle_change(EDGEPT *point1, EDGEPT *point2, EDGEPT *point3) {
EDGEPT *Wordrec::pick_close_point(EDGEPT *critical_point,
EDGEPT *vertical_point,
int *best_dist) {
EDGEPT *best_point = NULL;
EDGEPT *best_point = nullptr;
int this_distance;
int found_better;

Expand Down Expand Up @@ -161,46 +161,46 @@ EDGEPT *Wordrec::pick_close_point(EDGEPT *critical_point,
*/
void Wordrec::prioritize_points(TESSLINE *outline, PointHeap* points) {
EDGEPT *this_point;
EDGEPT *local_min = NULL;
EDGEPT *local_max = NULL;
EDGEPT *local_min = nullptr;
EDGEPT *local_max = nullptr;

this_point = outline->loop;
local_min = this_point;
local_max = this_point;
do {
if (this_point->vec.y < 0) {
/* Look for minima */
if (local_max != NULL)
if (local_max != nullptr)
new_max_point(local_max, points);
else if (is_inside_angle (this_point))
add_point_to_list(points, this_point);
local_max = NULL;
local_max = nullptr;
local_min = this_point->next;
}
else if (this_point->vec.y > 0) {
/* Look for maxima */
if (local_min != NULL)
if (local_min != nullptr)
new_min_point(local_min, points);
else if (is_inside_angle (this_point))
add_point_to_list(points, this_point);
local_min = NULL;
local_min = nullptr;
local_max = this_point->next;
}
else {
/* Flat area */
if (local_max != NULL) {
if (local_max != nullptr) {
if (local_max->prev->vec.y != 0) {
new_max_point(local_max, points);
}
local_max = this_point->next;
local_min = NULL;
local_min = nullptr;
}
else {
if (local_min->prev->vec.y != 0) {
new_min_point(local_min, points);
}
local_min = this_point->next;
local_max = NULL;
local_max = nullptr;
}
}

Expand All @@ -216,7 +216,7 @@ void Wordrec::prioritize_points(TESSLINE *outline, PointHeap* points) {
*
* Found a new minimum point try to decide whether to save it or not.
* Return the new value for the local minimum. If a point is saved then
* the local minimum is reset to NULL.
* the local minimum is reset to nullptr.
*/
void Wordrec::new_min_point(EDGEPT *local_min, PointHeap* points) {
int16_t dir;
Expand All @@ -240,7 +240,7 @@ void Wordrec::new_min_point(EDGEPT *local_min, PointHeap* points) {
*
* Found a new minimum point try to decide whether to save it or not.
* Return the new value for the local minimum. If a point is saved then
* the local minimum is reset to NULL.
* the local minimum is reset to nullptr.
*/
void Wordrec::new_max_point(EDGEPT *local_max, PointHeap* points) {
int16_t dir;
Expand Down Expand Up @@ -280,7 +280,7 @@ void Wordrec::vertical_projection_point(EDGEPT *split_point, EDGEPT *target_poin
int x = split_point->pos.x; /* X value of vertical */
int best_dist = LARGE_DISTANCE;/* Best point found */

if (*best_point != NULL)
if (*best_point != nullptr)
best_dist = edgept_dist(split_point, *best_point);

p = target_point;
Expand All @@ -291,13 +291,13 @@ void Wordrec::vertical_projection_point(EDGEPT *split_point, EDGEPT *target_poin
!same_point(split_point->pos, p->pos) &&
!same_point(split_point->pos, p->next->pos) &&
!p->IsChopPt() &&
(*best_point == NULL || !same_point((*best_point)->pos, p->pos))) {
(*best_point == nullptr || !same_point((*best_point)->pos, p->pos))) {

if (near_point(split_point, p, p->next, &this_edgept)) {
new_point_it.add_before_then_move(this_edgept);
}

if (*best_point == NULL)
if (*best_point == nullptr)
best_dist = edgept_dist (split_point, this_edgept);

this_edgept =
Expand Down
Loading

0 comments on commit 58d9593

Please sign in to comment.