Skip to content

Commit 8c84d29

Browse files
stweilzdenop
authored andcommitted
Fix CID 1270406, CID 1270407 and CID 1270411 Arguments in wrong order (#1410)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 660b366 commit 8c84d29

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

textord/tospace.cpp

+19-17
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ void Textord::block_spacing_stats(
171171
blob_box = box_next (&blob_it);
172172
if (blob_box.width () < minwidth)
173173
minwidth = blob_box.width ();
174-
gap_width = blob_box.left () - prev_blob_box.right ();
175-
if (!ignore_big_gap (row, row_length, gapmap,
176-
prev_blob_box.right (), blob_box.left ())) {
174+
int16_t left = prev_blob_box.right();
175+
int16_t right = blob_box.left();
176+
gap_width = right - left;
177+
if (!ignore_big_gap(row, row_length, gapmap, left, right)) {
177178
all_gap_stats.add (gap_width, 1);
178179

179-
centre_to_centre = (blob_box.left () + blob_box.right () -
180-
(prev_blob_box.left () +
181-
prev_blob_box.right ())) / 2;
180+
centre_to_centre = (right + blob_box.right () -
181+
(prev_blob_box.left () + left)) / 2;
182182
//DEBUG
183183
centre_to_centre_stats.add (centre_to_centre, 1);
184184
// DEBUG
@@ -245,11 +245,11 @@ void Textord::block_spacing_stats(
245245
blob_box = reduced_box_next (row, &blob_it);
246246
else
247247
blob_box = box_next (&blob_it);
248-
gap_width = blob_box.left () - prev_blob_box.right ();
248+
int16_t left = prev_blob_box.right();
249+
int16_t right = blob_box.left();
250+
gap_width = right - left;
249251
if ((gap_width > real_space_threshold) &&
250-
!ignore_big_gap (row, row_length, gapmap,
251-
prev_blob_box.right (),
252-
blob_box.left ())) {
252+
!ignore_big_gap(row, row_length, gapmap, left, right)) {
253253
/*
254254
If tosp_use_cert_spaces is enabled, the estimate of the space gap is
255255
restricted to obvious spaces - those wider than half the xht or those
@@ -350,11 +350,12 @@ void Textord::row_spacing_stats(
350350
blob_box = reduced_box_next (row, &blob_it);
351351
else
352352
blob_box = box_next (&blob_it);
353-
gap_width = blob_box.left () - prev_blob_box.right ();
354-
if (ignore_big_gap (row, row_length, gapmap,
355-
prev_blob_box.right (), blob_box.left ()))
353+
int16_t left = prev_blob_box.right();
354+
int16_t right = blob_box.left();
355+
gap_width = right - left;
356+
if (ignore_big_gap(row, row_length, gapmap, left, right)) {
356357
large_gap_count++;
357-
else {
358+
} else {
358359
if (gap_width >= real_space_threshold) {
359360
if (!tosp_row_use_cert_spaces ||
360361
(gap_width > tosp_fuzzy_space_factor2 * row->xheight) ||
@@ -728,9 +729,10 @@ BOOL8 Textord::isolated_row_stats(TO_ROW *row,
728729
blob_box = reduced_box_next (row, &blob_it);
729730
else
730731
blob_box = box_next (&blob_it);
731-
gap_width = blob_box.left () - prev_blob_box.right ();
732-
if (!ignore_big_gap (row, row_length, gapmap,
733-
prev_blob_box.right (), blob_box.left ()) &&
732+
int16_t left = prev_blob_box.right();
733+
int16_t right = blob_box.left();
734+
gap_width = right - left;
735+
if (!ignore_big_gap(row, row_length, gapmap, left, right) &&
734736
(gap_width > crude_threshold_estimate)) {
735737
if ((gap_width > tosp_fuzzy_space_factor2 * row->xheight) ||
736738
((gap_width > tosp_fuzzy_space_factor1 * row->xheight) &&

0 commit comments

Comments
 (0)