Skip to content

Commit 66b71e6

Browse files
committed
Fix CID 1164621 (Uninitialized scalar field)
Format also some comments. Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent 8582ee0 commit 66b71e6

File tree

1 file changed

+44
-45
lines changed

1 file changed

+44
-45
lines changed

src/textord/pitsync1.cpp

+44-45
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,12 @@
2222
#include "pitsync1.h"
2323

2424
ELISTIZE (FPSEGPT) CLISTIZE (FPSEGPT_LIST)
25-
#define EXTERN
26-
EXTERN
27-
INT_VAR (pitsync_linear_version, 6, "Use new fast algorithm");
28-
EXTERN
29-
double_VAR (pitsync_joined_edge, 0.75,
30-
"Dist inside big blob for chopping");
31-
EXTERN
32-
double_VAR (pitsync_offset_freecut_fraction, 0.25,
33-
"Fraction of cut for free cuts");
34-
EXTERN
35-
INT_VAR (pitsync_fake_depth, 1, "Max advance fake generation");
25+
26+
INT_VAR(pitsync_linear_version, 6, "Use new fast algorithm");
27+
double_VAR(pitsync_joined_edge, 0.75, "Dist inside big blob for chopping");
28+
double_VAR(pitsync_offset_freecut_fraction, 0.25,
29+
"Fraction of cut for free cuts");
30+
INT_VAR(pitsync_fake_depth, 1, "Max advance fake generation");
3631

3732
/**********************************************************************
3833
* FPSEGPT::FPSEGPT
@@ -63,7 +58,7 @@ FPSEGPT::FPSEGPT( //constructor
6358
**********************************************************************/
6459

6560
FPSEGPT::FPSEGPT ( //constructor
66-
int16_t x //position
61+
int16_t x //position
6762
):xpos (x) {
6863
pred = nullptr;
6964
mean_sum = 0;
@@ -83,17 +78,22 @@ int16_t x //position
8378
**********************************************************************/
8479

8580
FPSEGPT::FPSEGPT ( //constructor
86-
int16_t x, //position
81+
int16_t x, //position
8782
BOOL8 faking, //faking this one
88-
int16_t offset, //dist to gap
89-
int16_t region_index, //segment number
90-
int16_t pitch, //proposed pitch
91-
int16_t pitch_error, //allowed tolerance
83+
int16_t offset, //dist to gap
84+
int16_t region_index, //segment number
85+
int16_t pitch, //proposed pitch
86+
int16_t pitch_error, //allowed tolerance
9287
FPSEGPT_LIST * prev_list //previous segment
93-
):xpos (x) {
94-
int16_t best_fake; //on previous
88+
)
89+
: fake_count(0),
90+
xpos(x),
91+
mean_sum(0.0),
92+
sq_sum(0.0)
93+
{
94+
int16_t best_fake; //on previous
9595
FPSEGPT *segpt; //segment point
96-
int32_t dist; //from prev segment
96+
int32_t dist; //from prev segment
9797
double sq_dist; //squared distance
9898
double mean; //mean pitch
9999
double total; //total dists
@@ -133,7 +133,6 @@ FPSEGPT_LIST * prev_list //previous segment
133133
pred = nullptr; //fail it
134134
}
135135

136-
137136
/**********************************************************************
138137
* check_pitch_sync
139138
*
@@ -144,28 +143,28 @@ FPSEGPT_LIST * prev_list //previous segment
144143

145144
double check_pitch_sync( //find segmentation
146145
BLOBNBOX_IT *blob_it, //blobs to do
147-
int16_t blob_count, //no of blobs
148-
int16_t pitch, //pitch estimate
149-
int16_t pitch_error, //tolerance
146+
int16_t blob_count, //no of blobs
147+
int16_t pitch, //pitch estimate
148+
int16_t pitch_error, //tolerance
150149
STATS *projection, //vertical
151150
FPSEGPT_LIST *seg_list //output list
152151
) {
153-
int16_t x; //current coord
154-
int16_t min_index; //blob number
155-
int16_t max_index; //blob number
156-
int16_t left_edge; //of word
157-
int16_t right_edge; //of word
158-
int16_t right_max; //max allowed x
159-
int16_t min_x; //in this region
152+
int16_t x; //current coord
153+
int16_t min_index; //blob number
154+
int16_t max_index; //blob number
155+
int16_t left_edge; //of word
156+
int16_t right_edge; //of word
157+
int16_t right_max; //max allowed x
158+
int16_t min_x; //in this region
160159
int16_t max_x;
161160
int16_t region_index;
162-
int16_t best_region_index = 0; //for best result
163-
int16_t offset; //dist to legal area
164-
int16_t left_best_x; //edge of good region
165-
int16_t right_best_x; //right edge
166-
TBOX min_box; //bounding box
167-
TBOX max_box; //bounding box
168-
TBOX next_box; //box of next blob
161+
int16_t best_region_index = 0; //for best result
162+
int16_t offset; //dist to legal area
163+
int16_t left_best_x; //edge of good region
164+
int16_t right_best_x; //right edge
165+
TBOX min_box; //bounding box
166+
TBOX max_box; //bounding box
167+
TBOX next_box; //box of next blob
169168
FPSEGPT *segpt; //segment point
170169
FPSEGPT_LIST *segpts; //points in a segment
171170
double best_cost; //best path
@@ -362,17 +361,17 @@ double check_pitch_sync( //find segmentation
362361

363362
void make_illegal_segment( //find segmentation
364363
FPSEGPT_LIST *prev_list, //previous segments
365-
TBOX blob_box, //bounding box
364+
TBOX blob_box, //bounding box
366365
BLOBNBOX_IT blob_it, //iterator
367-
int16_t region_index, //number of segment
368-
int16_t pitch, //pitch estimate
369-
int16_t pitch_error, //tolerance
366+
int16_t region_index, //number of segment
367+
int16_t pitch, //pitch estimate
368+
int16_t pitch_error, //tolerance
370369
FPSEGPT_LIST *seg_list //output list
371370
) {
372-
int16_t x; //current coord
373-
int16_t min_x = 0; //in this region
371+
int16_t x; //current coord
372+
int16_t min_x = 0; //in this region
374373
int16_t max_x = 0;
375-
int16_t offset; //dist to edge
374+
int16_t offset; //dist to edge
376375
FPSEGPT *segpt; //segment point
377376
FPSEGPT *prevpt; //previous point
378377
float best_cost; //best path

0 commit comments

Comments
 (0)