fix uninitialized variables reported by clang

Signed-off-by: Rene Hopf <renehopf@mac.com>
This commit is contained in:
Rene Hopf 2020-04-18 23:13:58 +02:00
parent 7598146107
commit 91cb49657c
6 changed files with 5 additions and 6 deletions

View file

@ -248,7 +248,7 @@ int Canterp::read() {
int Canterp::execute(const char *line) {
int retval;
double d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11;
double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0, d8 = 0, d9 = 0, d10 = 0, d11 = 0;
int i1, i2, ln=-1;
char s1[256];

View file

@ -69,7 +69,6 @@
static CanonConfig_t canon;
static int debug_velacc = 0;
static const double tiny = 1e-7;
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))

View file

@ -145,7 +145,7 @@ FUNCTION(_) {
struct ofunc_data* dptr = &data;
#define STATE dptr->thestate
int kfactor;
int kfactor = 1;
ofunc* thefunc;
run_ct++;

View file

@ -1709,7 +1709,7 @@ stepgenControl(void *arg, long period, unsigned int channel)
card *pCard = device->pCard;
hal_s32_t stepgen_fb, stepgen_fb_int, last_count_fb_LS16_bits, last_count_fb_MS16_bits, last_count_fb;
hal_float_t ref_vel, match_acc, match_time, avg_v, est_out, est_cmd, est_err, dp;
hal_float_t ref_vel = 0, match_acc, match_time, avg_v, est_out, est_cmd, est_err, dp;
//read and count feedbacks
stepgen_fb = pCard->StepGen_fb[channel]; //pCard->StepGen_Fb[channel] is 16.16 bit fixed point feedback in [step] unit

View file

@ -1602,7 +1602,7 @@ fail1:
case 64:
shift = 0;
}
if (abs((p->s64_param - p->s64_written) >> shift) > 2) break;
if (abs(((int)(p->s64_param) - (int)(p->s64_written)) >> shift) > 2) break;
*inst->state2 = 2; // increment indices
return *inst->state2;
default:

View file

@ -259,7 +259,7 @@ int main(int argc, char **argv)
char *tokens[MAX_TOK+1];
char eline [(LINELEN + 2) * (MAX_EXTEND_LINES + 1)];
char *elineptr;
char *elinenext;
char *elinenext = 0;
int newLinePos;
halcmd_set_linenumber(linenumber++);